1 | /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB |
2 | |
3 | This library is free software; you can redistribute it and/or |
4 | modify it under the terms of the GNU Library General Public |
5 | License as published by the Free Software Foundation; either |
6 | version 2 of the License, or (at your option) any later version. |
7 | |
8 | This library is distributed in the hope that it will be useful, |
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 | Library General Public License for more details. |
12 | |
13 | You should have received a copy of the GNU Library General Public |
14 | License along with this library; if not, write to the Free |
15 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
16 | MA 02111-1301, USA */ |
17 | |
18 | /* |
19 | A better inplementation of the UNIX ctype(3) library. |
20 | Notes: my_global.h should be included before ctype.h |
21 | */ |
22 | |
23 | #ifndef _mariadb_ctype_h |
24 | #define _mariadb_ctype_h |
25 | |
26 | #include <ctype.h> |
27 | |
28 | #ifdef __cplusplus |
29 | extern "C" { |
30 | #endif |
31 | |
32 | #define CHARSET_DIR "charsets/" |
33 | #define MY_CS_NAME_SIZE 32 |
34 | |
35 | #define MADB_DEFAULT_CHARSET_NAME "latin1" |
36 | #define MADB_DEFAULT_COLLATION_NAME "latin1_swedish_ci" |
37 | #define MADB_AUTODETECT_CHARSET_NAME "auto" |
38 | |
39 | /* we use the mysqlnd implementation */ |
40 | typedef struct ma_charset_info_st |
41 | { |
42 | unsigned int nr; /* so far only 1 byte for charset */ |
43 | unsigned int state; |
44 | const char *csname; |
45 | const char *name; |
46 | const char *dir; |
47 | unsigned int codepage; |
48 | const char *encoding; |
49 | unsigned int char_minlen; |
50 | unsigned int char_maxlen; |
51 | unsigned int (*mb_charlen)(unsigned int c); |
52 | unsigned int (*mb_valid)(const char *start, const char *end); |
53 | } MARIADB_CHARSET_INFO; |
54 | |
55 | extern const MARIADB_CHARSET_INFO mariadb_compiled_charsets[]; |
56 | extern MARIADB_CHARSET_INFO *ma_default_charset_info; |
57 | extern MARIADB_CHARSET_INFO *ma_charset_bin; |
58 | extern MARIADB_CHARSET_INFO *ma_charset_latin1; |
59 | extern MARIADB_CHARSET_INFO *ma_charset_utf8_general_ci; |
60 | extern MARIADB_CHARSET_INFO *ma_charset_utf16le_general_ci; |
61 | |
62 | MARIADB_CHARSET_INFO *find_compiled_charset(unsigned int cs_number); |
63 | MARIADB_CHARSET_INFO *find_compiled_charset_by_name(const char *name); |
64 | |
65 | size_t mysql_cset_escape_quotes(const MARIADB_CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len); |
66 | size_t mysql_cset_escape_slashes(const MARIADB_CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len); |
67 | const char* madb_get_os_character_set(void); |
68 | #ifdef _WIN32 |
69 | int madb_get_windows_cp(const char *charset); |
70 | #endif |
71 | |
72 | #ifdef __cplusplus |
73 | } |
74 | #endif |
75 | |
76 | #endif |
77 | |