Merge commit 'origin/master'
[versaplex.git] / vxodbc / multibyte.h
blobf570af7e7240b2f46cb5c47802be1c37ca6c0c52
1 #ifndef __MULTIBUYTE_H__
2 #define __MULTIBUYTE_H__
3 /*
5 * Multibyte library header ( psqlODBC Only )
7 */
8 #include "psqlodbc.h"
9 #include "qresult.h"
11 /* PostgreSQL client encoding */
12 enum {
13 SQL_ASCII = 0 /* SQL/ASCII */
14 ,EUC_JP /* EUC for Japanese */
15 ,EUC_CN /* EUC for Chinese */
16 ,EUC_KR /* EUC for Korean */
17 ,EUC_TW /* EUC for Taiwan */
18 ,JOHAB
19 ,UTF8 /* Unicode UTF-8 */
20 ,MULE_INTERNAL /* Mule internal code */
21 ,LATIN1 /* ISO-8859 Latin 1 */
22 ,LATIN2 /* ISO-8859 Latin 2 */
23 ,LATIN3 /* ISO-8859 Latin 3 */
24 ,LATIN4 /* ISO-8859 Latin 4 */
25 ,LATIN5 /* ISO-8859 Latin 5 */
26 ,LATIN6 /* ISO-8859 Latin 6 */
27 ,LATIN7 /* ISO-8859 Latin 7 */
28 ,LATIN8 /* ISO-8859 Latin 8 */
29 ,LATIN9 /* ISO-8859 Latin 9 */
30 ,LATIN10 /* ISO-8859 Latin 10 */
31 ,WIN1256 /* Arabic Windows */
32 ,WIN1258 /* Vietnamese Windows */
33 ,WIN866 /* Alternativny Variant (MS-DOS CP866) */
34 ,WIN874 /* Thai Windows */
35 ,KOI8R /* KOI8-R/U */
36 ,WIN1251 /* Cyrillic Windows */
37 ,WIN1252 /* Western Europe Windows */
38 ,ISO_8859_5 /* ISO-8859-5 */
39 ,ISO_8859_6 /* ISO-8859-6 */
40 ,ISO_8859_7 /* ISO-8859-7 */
41 ,ISO_8859_8 /* ISO-8859-8 */
42 ,WIN1250 /* Central Europe Windows */
43 ,WIN1253 /* Greek Windows */
44 ,WIN1254 /* Turkish Windows */
45 ,WIN1255 /* Hebrew Windows */
46 ,WIN1257 /* Baltic(North Europe) Windows */
47 ,SJIS /* Shift JIS */
48 ,BIG5 /* Big5 */
49 ,GBK /* GBK */
50 ,UHC /* UHC */
51 ,GB18030 /* GB18030 */
52 ,OTHER = -1
55 #define MAX_CHARACTERSET_NAME 24
56 #define MAX_CHARACTER_LEN 6
58 /* OLD Type */
59 // extern int multibyte_client_encoding; /* Multibyte client encoding. */
60 // extern int multibyte_status; /* Multibyte charcter status. */
62 // void multibyte_init(void);
63 // unsigned char *check_client_encoding(unsigned char *sql_string);
64 // int multibyte_char_check(unsigned char s);
65 // unsigned char *multibyte_strchr(const unsigned char *string, unsigned int c);
67 /* New Type */
69 extern void CC_lookup_characterset(ConnectionClass *self);
70 extern const char *get_environment_encoding(const ConnectionClass *conn, const char *setenc, const char *svrenc, BOOL bStartup);
72 extern int pg_CS_stat(int stat,unsigned int charcter,int characterset_code);
73 extern int pg_CS_code(const UCHAR *stat_string);
74 extern const UCHAR *pg_CS_name(int code);
76 typedef struct pg_CS
78 const char *name;
79 int code;
80 }pg_CS;
81 extern size_t pg_mbslen(int ccsc, const UCHAR *string);
82 extern UCHAR *pg_mbschr(int ccsc, const UCHAR *string, unsigned int character);
83 extern UCHAR *pg_mbsinc(int ccsc, const UCHAR *current );
85 /* Old Type Compatible */
86 typedef struct
88 int ccsc;
89 const UCHAR *encstr;
90 ssize_t pos;
91 int ccst;
92 } encoded_str;
93 #define ENCODE_STATUS(enc) ((enc).ccst)
95 void encoded_str_constr(encoded_str *encstr, int ccsc, const char *str);
96 #define make_encoded_str(encstr, conn, str) encoded_str_constr(encstr, conn->ccsc, str)
97 extern int encoded_nextchar(encoded_str *encstr);
98 extern ssize_t encoded_position_shift(encoded_str *encstr, size_t shift);
99 extern int encoded_byte_check(encoded_str *encstr, size_t abspos);
100 /* #define check_client_encoding(X) pg_CS_name(pg_CS_code(X)) */
101 UCHAR *check_client_encoding(const UCHAR *sql_string);
102 #endif /* __MULTIBUYTE_H__ */