~ubuntu-branches/ubuntu/lucid/psqlodbc/lucid

« back to all changes in this revision

Viewing changes to multibyte.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2004-05-13 10:47:36 UTC
  • Revision ID: james.westby@ubuntu.com-20040513104736-a530gmn0p3knep89
Tags: upstream-07.03.0200
ImportĀ upstreamĀ versionĀ 07.03.0200

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __MULTIBUYTE_H__
 
2
#define __MULTIBUYTE_H__
 
3
/*
 
4
 *
 
5
 * Multibyte library header ( psqlODBC Only )
 
6
 *
 
7
 */
 
8
#include "psqlodbc.h"
 
9
#include "qresult.h"
 
10
 
 
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 TCVN                            19      /* Vietnamese Windows */
 
32
#define WIN874                          20      /* Thai Windows */
 
33
#define KOI8R                           21      /* KOI8-R/U */
 
34
#define WIN1251                         22      /* windows-1251 */
 
35
#define ALT                                     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
#define OTHER                           -1
 
48
 
 
49
#define MAX_CHARACTERSET_NAME   24
 
50
#define MAX_CHARACTER_LEN       6
 
51
 
 
52
/* OLD Type */
 
53
// extern int   multibyte_client_encoding;      /* Multibyte client encoding. */
 
54
// extern int   multibyte_status;       /* Multibyte charcter status. */
 
55
//
 
56
// void         multibyte_init(void);
 
57
// unsigned char *check_client_encoding(unsigned char *sql_string);
 
58
// int                  multibyte_char_check(unsigned char s);
 
59
// unsigned char *multibyte_strchr(const unsigned char *string, unsigned int c);
 
60
 
 
61
/* New Type */
 
62
 
 
63
extern void CC_lookup_characterset(ConnectionClass *self);
 
64
 
 
65
extern int pg_CS_stat(int stat,unsigned int charcter,int characterset_code);
 
66
extern int pg_CS_code(const unsigned char *stat_string);
 
67
extern unsigned char *pg_CS_name(int code);
 
68
 
 
69
typedef struct pg_CS
 
70
{
 
71
        unsigned char *name;
 
72
        int code;
 
73
}pg_CS;
 
74
extern int pg_mbslen(int ccsc, const unsigned char *string);
 
75
extern unsigned char *pg_mbschr(int ccsc, const unsigned char *string, unsigned int character);
 
76
extern unsigned char *pg_mbsinc(int ccsc, const unsigned char *current );
 
77
 
 
78
/* Old Type Compatible */
 
79
typedef struct
 
80
{
 
81
        int     ccsc;
 
82
        const unsigned char *encstr;
 
83
        int     pos;
 
84
        int     ccst;
 
85
} encoded_str;
 
86
#define ENCODE_STATUS(enc)      ((enc).ccst)
 
87
 
 
88
void encoded_str_constr(encoded_str *encstr, int ccsc, const char *str);
 
89
#define make_encoded_str(encstr, conn, str) encoded_str_constr(encstr, conn->ccsc, str)
 
90
extern int encoded_nextchar(encoded_str *encstr);
 
91
extern int encoded_byte_check(encoded_str *encstr, int abspos);
 
92
#define check_client_encoding(X) pg_CS_name(pg_CS_code(X))
 
93
#endif /* __MULTIBUYTE_H__ */