xref: /php-src/ext/mysqlnd/mysqlnd_charset.h (revision 7466f9c9)
1 /*
2   +----------------------------------------------------------------------+
3   | Copyright (c) The PHP Group                                          |
4   +----------------------------------------------------------------------+
5   | This source file is subject to version 3.01 of the PHP license,      |
6   | that is bundled with this package in the file LICENSE, and is        |
7   | available through the world-wide-web at the following url:           |
8   | https://www.php.net/license/3_01.txt                                 |
9   | If you did not receive a copy of the PHP license and are unable to   |
10   | obtain it through the world-wide-web, please send a note to          |
11   | license@php.net so we can mail you a copy immediately.               |
12   +----------------------------------------------------------------------+
13   | Authors: Andrey Hristov <andrey@php.net>                             |
14   |          Ulf Wendel <uw@php.net>                                     |
15   |          Georg Richter <georg@php.net>                               |
16   +----------------------------------------------------------------------+
17 */
18 
19 #ifndef MYSQLND_CHARSET_H
20 #define MYSQLND_CHARSET_H
21 
22 #define MYSQLND_UTF8_MB3_DEFAULT_ID 33
23 #define MYSQLND_UTF8_MB4_DEFAULT_ID 45
24 
25 PHPAPI zend_ulong mysqlnd_cset_escape_quotes(const MYSQLND_CHARSET * const charset, char * newstr,
26 											 const char * escapestr, const size_t escapestr_len);
27 
28 PHPAPI zend_ulong mysqlnd_cset_escape_slashes(const MYSQLND_CHARSET * const cset, char * newstr,
29 										 	  const char * escapestr, const size_t escapestr_len);
30 
31 struct st_mysqlnd_plugin_charsets
32 {
33 	const struct st_mysqlnd_plugin_header plugin_header;
34 	struct
35 	{
36 		const MYSQLND_CHARSET * (*const find_charset_by_nr)(unsigned int charsetnr);
37 		const MYSQLND_CHARSET * (*const find_charset_by_name)(const char * const name);
38 		zend_ulong 			(*const escape_quotes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, const size_t escapestr_len);
39 		zend_ulong			(*const escape_slashes)(const MYSQLND_CHARSET * const cset, char * newstr, const char * escapestr, const size_t escapestr_len);
40 	} methods;
41 };
42 
43 void mysqlnd_charsets_plugin_register(void);
44 
45 #endif /* MYSQLND_CHARSET_H */
46