~ubuntu-branches/ubuntu/precise/psqlodbc/precise

« back to all changes in this revision

Viewing changes to multibyte.h

  • Committer: Bazaar Package Importer
  • Author(s): Peter Eisentraut
  • Date: 2008-05-09 10:40:32 UTC
  • mfrom: (1.1.5 upstream) (4.1.1 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080509104032-brus47zgn7ak380w
Tags: 1:08.03.0200-1
* New upstream release
  - Disables some broken code (closes: #396218)
  - Obsoletes psqlodbc-413534.diff and most of psqlodbc-358949.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
#include "qresult.h"
10
10
 
11
11
/* PostgreSQL client encoding */
12
 
#define SQL_ASCII                       0       /* SQL/ASCII */
13
 
#define EUC_JP                          1       /* EUC for Japanese */
14
 
#define EUC_CN                          2       /* EUC for Chinese */
15
 
#define EUC_KR                          3       /* EUC for Korean */
16
 
#define EUC_TW                          4       /* EUC for Taiwan */
17
 
#define JOHAB                           5
18
 
#define UTF8                            6       /* Unicode UTF-8 */
19
 
#define MULE_INTERNAL           7       /* Mule internal code */
20
 
#define LATIN1                          8       /* ISO-8859 Latin 1 */
21
 
#define LATIN2                          9       /* ISO-8859 Latin 2 */
22
 
#define LATIN3                          10      /* ISO-8859 Latin 3 */
23
 
#define LATIN4                          11      /* ISO-8859 Latin 4 */
24
 
#define LATIN5                          12      /* ISO-8859 Latin 5 */
25
 
#define LATIN6                          13      /* ISO-8859 Latin 6 */
26
 
#define LATIN7                          14      /* ISO-8859 Latin 7 */
27
 
#define LATIN8                          15      /* ISO-8859 Latin 8 */
28
 
#define LATIN9                          16      /* ISO-8859 Latin 9 */
29
 
#define LATIN10                         17      /* ISO-8859 Latin 10 */
30
 
#define WIN1256                         18      /* Arabic Windows */
31
 
#define WIN1258                         19      /* Vietnamese Windows */
32
 
#define WIN874                          20      /* Thai Windows */
33
 
#define KOI8R                           21      /* KOI8-R/U */
34
 
#define WIN1251                         22      /* windows-1251 */
35
 
#define WIN866                          23      /* Alternativny Variant (MS-DOS CP866) */
36
 
#define ISO_8859_5                      24      /* ISO-8859-5 */
37
 
#define ISO_8859_6                      25      /* ISO-8859-6 */
38
 
#define ISO_8859_7                      26      /* ISO-8859-7 */
39
 
#define ISO_8859_8                      27      /* ISO-8859-8 */
40
 
 
41
 
#define SJIS                            28      /* Shift JIS */
42
 
#define BIG5                            29      /* Big5 */
43
 
#define GBK                                     30      /* GBK */
44
 
#define UHC                                     31  /* UHC */
45
 
#define WIN1250                         32      /* windows-1250 */
46
 
#define GB18030                         33      /* GB18030 */
47
 
 
48
 
#define PG_UNICODE                      34  /* UNICODE ( < Ver8.1) */
49
 
                                            /* Can't call it UNICODE as that's already used */
50
 
#define TCVN                            35  /* TCVN ( < Ver8.1) */
51
 
#define ALT                             36  /* ALT ( < Var8.1) */
52
 
#define WIN                             37  /* WIN ( < Ver8.1) */
53
 
 
54
 
#define OTHER                           -1
 
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
        ,EUC_JIS_2004           /* EUC for SHIFT-JIS-2004 Japanese */
 
48
        ,SJIS                   /* Shift JIS */
 
49
        ,BIG5                   /* Big5 */
 
50
        ,GBK                    /* GBK */
 
51
        ,UHC                    /* UHC */
 
52
        ,GB18030                /* GB18030 */
 
53
        ,SHIFT_JIS_2004         /* SHIFT-JIS-2004 Japanese, JIS X 0213 */
 
54
        ,OTHER          =       -1
 
55
};
55
56
 
56
57
#define MAX_CHARACTERSET_NAME   24
57
58
#define MAX_CHARACTER_LEN       6
68
69
/* New Type */
69
70
 
70
71
extern void CC_lookup_characterset(ConnectionClass *self);
 
72
extern const char *get_environment_encoding(const ConnectionClass *conn, const char *setenc, const char *svrenc, BOOL bStartup);
71
73
 
72
74
extern int pg_CS_stat(int stat,unsigned int charcter,int characterset_code);
73
75
extern int pg_CS_code(const UCHAR *stat_string);
74
 
extern UCHAR *pg_CS_name(int code);
 
76
extern const UCHAR *pg_CS_name(int code);
75
77
 
76
78
typedef struct pg_CS
77
79
{
78
80
        UCHAR *name;
79
81
        int code;
80
82
}pg_CS;
81
 
extern int pg_mbslen(int ccsc, const UCHAR *string);
 
83
extern size_t   pg_mbslen(int ccsc, const UCHAR *string);
82
84
extern UCHAR *pg_mbschr(int ccsc, const UCHAR *string, unsigned int character);
83
85
extern UCHAR *pg_mbsinc(int ccsc, const UCHAR *current );
84
86
 
87
89
{
88
90
        int     ccsc;
89
91
        const UCHAR *encstr;
90
 
        int     pos;
 
92
        ssize_t pos;
91
93
        int     ccst;
92
94
} encoded_str;
93
95
#define ENCODE_STATUS(enc)      ((enc).ccst)
95
97
void encoded_str_constr(encoded_str *encstr, int ccsc, const char *str);
96
98
#define make_encoded_str(encstr, conn, str) encoded_str_constr(encstr, conn->ccsc, str)
97
99
extern int encoded_nextchar(encoded_str *encstr);
98
 
extern int encoded_byte_check(encoded_str *encstr, int abspos);
99
 
#define check_client_encoding(X) pg_CS_name(pg_CS_code(X))
 
100
extern ssize_t encoded_position_shift(encoded_str *encstr, size_t shift);
 
101
extern int encoded_byte_check(encoded_str *encstr, size_t abspos);
 
102
/* #define check_client_encoding(X) pg_CS_name(pg_CS_code(X)) */
 
103
UCHAR *check_client_encoding(const UCHAR *sql_string);
100
104
#endif /* __MULTIBUYTE_H__ */