Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
8fc386a2
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,发现更多精彩内容 >>
提交
8fc386a2
编写于
1月 15, 2000
作者:
T
Tatsuo Ishii
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Eliminate using putenv().
上级
6095e36c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
46 addition
and
23 deletion
+46
-23
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-connect.c
+16
-11
src/interfaces/libpq/fe-print.c
src/interfaces/libpq/fe-print.c
+20
-8
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-fe.h
+7
-3
src/interfaces/libpq/libpq-int.h
src/interfaces/libpq/libpq-int.h
+3
-1
未找到文件。
src/interfaces/libpq/fe-connect.c
浏览文件 @
8fc386a2
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.1
09 2000/01/14 05:33:15 tgl
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.1
10 2000/01/15 05:37:21 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1299,7 +1299,7 @@ PQconnectPoll(PGconn *conn)
these queries. */
conn
->
status
=
CONNECTION_OK
;
switch
(
PQsetenvPoll
(
conn
->
setenv_handle
))
switch
(
PQsetenvPoll
(
conn
))
{
case
PGRES_POLLING_OK
:
/* Success */
conn
->
status
=
CONNECTION_OK
;
...
...
@@ -1384,8 +1384,9 @@ PQsetenvStart(PGconn *conn)
* ----------------
*/
PostgresPollingStatusType
PQsetenvPoll
(
PG
setenvHandle
handle
)
PQsetenvPoll
(
PG
conn
*
conn
)
{
PGsetenvHandle
handle
=
conn
->
setenv_handle
;
#ifdef MULTIBYTE
static
const
char
envname
[]
=
"PGCLIENTENCODING"
;
#endif
...
...
@@ -1470,16 +1471,12 @@ PQsetenvPoll(PGsetenvHandle handle)
encoding
=
PQgetvalue
(
handle
->
res
,
0
,
0
);
if
(
!
encoding
)
/* this should not happen */
encoding
=
pg_encoding_to_char
(
MULTIBYTE
)
;
encoding
=
SQL_ASCII
;
if
(
encoding
)
{
/* set client encoding via environment variable */
char
*
envbuf
;
envbuf
=
(
char
*
)
malloc
(
strlen
(
envname
)
+
strlen
(
encoding
)
+
2
);
sprintf
(
envbuf
,
"%s=%s"
,
envname
,
encoding
);
putenv
(
envbuf
);
/* set client encoding to pg_conn struct */
conn
->
client_encoding
=
atoi
(
encoding
);
}
PQclear
(
handle
->
res
);
/* We have to keep going in order to clear up the query */
...
...
@@ -1630,7 +1627,7 @@ PQsetenv(PGconn *conn)
return
0
;
for
(;;)
{
flag
=
PQsetenvPoll
(
handle
);
flag
=
PQsetenvPoll
(
conn
);
switch
(
flag
)
{
case
PGRES_POLLING_ACTIVE
:
...
...
@@ -2355,6 +2352,14 @@ PQbackendPID(const PGconn *conn)
return
conn
->
be_pid
;
}
int
PQclientencoding
(
const
PGconn
*
conn
)
{
if
(
!
conn
||
conn
->
status
!=
CONNECTION_OK
)
return
-
1
;
return
conn
->
client_encoding
;
}
void
PQtrace
(
PGconn
*
conn
,
FILE
*
debug_port
)
{
...
...
src/interfaces/libpq/fe-print.c
浏览文件 @
8fc386a2
...
...
@@ -9,7 +9,7 @@
* didn't really belong there.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.2
8 1999/11/11 00:10:14 momjian
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.2
9 2000/01/15 05:37:21 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -498,27 +498,39 @@ PQprintTuples(const PGresult *res,
* the backend is assumed.
*/
int
PQmblen
(
const
unsigned
char
*
s
)
PQmblen
(
const
unsigned
char
*
s
,
int
encoding
)
{
return
(
pg_encoding_mblen
(
encoding
,
s
));
}
/*
* Get encoding id from environment variable PGCLIENTENCODING.
*/
int
PQenv2encoding
(
void
)
{
char
*
str
;
int
encoding
=
-
1
;
int
encoding
=
SQL_ASCII
;
str
=
getenv
(
"PGCLIENTENCODING"
);
if
(
str
&&
*
str
!=
'\0'
)
encoding
=
pg_char_to_encoding
(
str
);
if
(
encoding
<
0
)
encoding
=
MULTIBYTE
;
return
(
pg_encoding_mblen
(
encoding
,
s
));
return
(
encoding
);
}
#else
/* Provide a default definition in case someone calls it anyway */
int
PQmblen
(
const
unsigned
char
*
s
)
PQmblen
(
const
unsigned
char
*
s
,
int
encoding
)
{
return
1
;
}
int
PQenv2encoding
(
void
)
{
return
0
;
}
#endif
/* MULTIBYTE */
...
...
@@ -560,7 +572,7 @@ do_field(const PQprintOpt *po, const PGresult *res,
char
ch
=
'0'
;
#ifdef MULTIBYTE
for
(
p
=
pval
;
*
p
;
p
+=
PQmblen
(
p
))
for
(
p
=
pval
;
*
p
;
p
+=
PQmblen
(
p
,
PQclientencoding
(
res
->
conn
)
))
#else
for
(
p
=
pval
;
*
p
;
p
++
)
#endif
...
...
src/interfaces/libpq/libpq-fe.h
浏览文件 @
8fc386a2
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq-fe.h,v 1.5
4 2000/01/14 05:33:15 tgl
Exp $
* $Id: libpq-fe.h,v 1.5
5 2000/01/15 05:37:21 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -224,6 +224,7 @@ extern "C"
extern
const
char
*
PQerrorMessage
(
const
PGconn
*
conn
);
extern
int
PQsocket
(
const
PGconn
*
conn
);
extern
int
PQbackendPID
(
const
PGconn
*
conn
);
extern
int
PQclientencoding
(
const
PGconn
*
conn
);
/* Enable/disable tracing */
extern
void
PQtrace
(
PGconn
*
conn
,
FILE
*
debug_port
);
...
...
@@ -235,7 +236,7 @@ extern "C"
/* Passing of environment variables */
/* Asynchronous (non-blocking) */
extern
PGsetenvHandle
PQsetenvStart
(
PGconn
*
conn
);
extern
PostgresPollingStatusType
PQsetenvPoll
(
PG
setenvHandle
handle
);
extern
PostgresPollingStatusType
PQsetenvPoll
(
PG
conn
*
conn
);
extern
void
PQsetenvAbort
(
PGsetenvHandle
handle
);
/* Synchronous (blocking) */
...
...
@@ -333,7 +334,10 @@ extern "C"
* 0, use variable width */
/* Determine length of multibyte encoded char at *s */
extern
int
PQmblen
(
const
unsigned
char
*
s
);
extern
int
PQmblen
(
const
unsigned
char
*
s
,
int
encoding
);
/* Get encoding id from environment variable PGCLIENTENCODING */
int
PQenv2encoding
(
void
);
/* === in fe-lobj.c === */
...
...
src/interfaces/libpq/libpq-int.h
浏览文件 @
8fc386a2
...
...
@@ -11,7 +11,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq-int.h,v 1.1
5 2000/01/14 05:33:15 tgl
Exp $
* $Id: libpq-int.h,v 1.1
6 2000/01/15 05:37:21 ishii
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -236,6 +236,8 @@ struct pg_conn
/* Buffer for receiving various parts of messages */
PQExpBufferData
workBuffer
;
/* expansible string */
int
client_encoding
;
/* encoding id */
};
/* ----------------
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录