Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
93501745
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
93501745
编写于
3月 16, 2001
作者:
H
Hiroshi Inoue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Oops I forgot to add new files for multibyte support.
Sorry Eiji.
上级
9d645fd8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
163 addition
and
0 deletion
+163
-0
src/interfaces/odbc/multibyte.c
src/interfaces/odbc/multibyte.c
+124
-0
src/interfaces/odbc/multibyte.h
src/interfaces/odbc/multibyte.h
+39
-0
未找到文件。
src/interfaces/odbc/multibyte.c
0 → 100644
浏览文件 @
93501745
/*
* Module : multibyte.c
*
* Description: Mlutibyte related additional function.
*
* Create 2001-03-03 Eiji Tokuya
*
*/
#include <string.h>
#include "multibyte.h"
int
multibyte_client_encoding
;
/* Multibyte Client Encoding. */
int
multibyte_status
;
/* Multibyte Odds and ends character. */
unsigned
char
*
multibyte_strchr
(
unsigned
char
*
s
,
unsigned
char
c
)
{
int
mb_st
=
0
,
i
=
0
;
while
(
!
(
mb_st
==
0
&&
s
[
i
]
==
c
||
s
[
i
]
==
0
))
{
if
(
s
[
i
]
==
0
)
return
(
0
);
switch
(
multibyte_client_encoding
)
{
case
SJIS
:
{
if
(
mb_st
<
2
&&
s
[
i
]
>
0x80
&&
!
(
s
[
i
]
>
0x9f
&&
s
[
i
]
<
0xe0
))
mb_st
=
2
;
else
if
(
mb_st
==
2
)
mb_st
=
1
;
else
mb_st
=
0
;
}
break
;
/* Chinese Big5 Support. */
case
BIG5
:
{
if
(
mb_st
<
2
&&
s
[
i
]
>
0xA0
)
mb_st
=
2
;
else
if
(
mb_st
==
2
)
mb_st
=
1
;
else
mb_st
=
0
;
}
break
;
default:
{
mb_st
=
0
;
}
}
i
++
;
}
#ifdef _DEBUG
qlog
(
"i = %d
\n
"
,
i
);
#endif
return
(
s
+
i
);
}
void
multibyte_init
(
void
)
{
multibyte_status
=
0
;
}
unsigned
char
*
check_client_encoding
(
unsigned
char
*
str
)
{
if
(
strstr
(
str
,
"%27SJIS%27"
)
||
strstr
(
str
,
"'SJIS'"
)
||
strstr
(
str
,
"'sjis'"
))
{
multibyte_client_encoding
=
SJIS
;
return
(
"SJIS"
);
}
if
(
strstr
(
str
,
"%27BIG5%27"
)
||
strstr
(
str
,
"'BIG5'"
)
||
strstr
(
str
,
"'big5'"
))
{
multibyte_client_encoding
=
BIG5
;
return
(
"BIG5"
);
}
return
(
"OHTER"
);
}
/*
* Multibyte Status Function.
* Input char
* Output 0 : 1 Byte Character.
* 1 : MultibyteCharacter Last Byte.
* N : MultibyteCharacter Fast or Middle Byte.
*/
int
multibyte_char_check
(
unsigned
char
s
)
{
switch
(
multibyte_client_encoding
)
{
/* Japanese Shift-JIS(CP932) Support. */
case
SJIS
:
{
if
(
multibyte_status
<
2
&&
s
>
0x80
&&
!
(
s
>
0x9f
&&
s
<
0xE0
))
multibyte_status
=
2
;
else
if
(
multibyte_status
==
2
)
multibyte_status
=
1
;
else
multibyte_status
=
0
;
}
break
;
/* Chinese Big5(CP950) Support. */
case
BIG5
:
{
if
(
multibyte_status
<
2
&&
s
>
0xA0
)
multibyte_status
=
2
;
else
if
(
multibyte_status
==
2
)
multibyte_status
=
1
;
else
multibyte_status
=
0
;
}
break
;
default:
{
multibyte_status
=
0
;
}
}
#ifdef _DEBUG
qlog
(
"multibyte_client_encoding = %d s = 0x%02X multibyte_stat = %d
\n
"
,
multibyte_client_encoding
,
s
,
multibyte_status
);
#endif
return
(
multibyte_status
);
}
src/interfaces/odbc/multibyte.h
0 → 100644
浏览文件 @
93501745
/*
*
* Multibyte library header ( psqlODBC Only )
*
*
*/
/* PostgreSQL client encoding */
#define SQL_ASCII 0
/* SQL/ASCII */
#define EUC_JP 1
/* EUC for Japanese */
#define EUC_CN 2
/* EUC for Chinese */
#define EUC_KR 3
/* EUC for Korean */
#define EUC_TW 4
/* EUC for Taiwan */
#define UNICODE 5
/* Unicode UTF-8 */
#define MULE_INTERNAL 6
/* Mule internal code */
#define LATIN1 7
/* ISO-8859 Latin 1 */
#define LATIN2 8
/* ISO-8859 Latin 2 */
#define LATIN3 9
/* ISO-8859 Latin 3 */
#define LATIN4 10
/* ISO-8859 Latin 4 */
#define LATIN5 11
/* ISO-8859 Latin 5 */
#define LATIN6 12
/* ISO-8859 Latin 6 */
#define LATIN7 13
/* ISO-8859 Latin 7 */
#define LATIN8 14
/* ISO-8859 Latin 8 */
#define LATIN9 15
/* ISO-8859 Latin 9 */
#define KOI8 16
/* KOI8-R */
#define WIN 17
/* windows-1251 */
#define ALT 18
/* Alternativny Variant (MS-DOS CP866) */
#define SJIS 32
/* Shift JIS */
#define BIG5 33
/* Big5 */
#define WIN1250 34
/* windows-1250 */
extern
int
multibyte_client_encoding
;
/* Multibyte client encoding. */
extern
int
multibyte_status
;
/* Multibyte charcter status. */
void
multibyte_init
(
void
);
unsigned
char
*
check_client_encoding
(
unsigned
char
*
str
);
int
multibyte_char_check
(
unsigned
char
s
);
unsigned
char
*
multibyte_strchr
(
unsigned
char
*
s
,
unsigned
char
c
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录