Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
fc211f82
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,发现更多精彩内容 >>
提交
fc211f82
编写于
2月 03, 2012
作者:
M
Michael Meskes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Applied Peter's patch to PQconnectdbParams in ecpglib instead of the old
PQconectdb.
上级
39909d1d
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
43 addition
and
32 deletion
+43
-32
src/interfaces/ecpg/ecpglib/connect.c
src/interfaces/ecpg/ecpglib/connect.c
+43
-32
未找到文件。
src/interfaces/ecpg/ecpglib/connect.c
浏览文件 @
fc211f82
...
...
@@ -260,14 +260,6 @@ ECPGnoticeReceiver(void *arg, const PGresult *result)
ecpg_log
(
"raising sqlcode %d
\n
"
,
sqlcode
);
}
static
int
strlen_or_null
(
const
char
*
string
)
{
if
(
!
string
)
return
0
;
return
(
strlen
(
string
));
}
/* this contains some quick hacks, needs to be cleaned up, but it works */
bool
ECPGconnect
(
int
lineno
,
int
c
,
const
char
*
name
,
const
char
*
user
,
const
char
*
passwd
,
const
char
*
connection_name
,
int
autocommit
)
...
...
@@ -281,8 +273,9 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
*
tmp
,
*
port
=
NULL
,
*
realname
=
NULL
,
*
options
=
NULL
,
*
connect_string
=
NULL
;
*
options
=
NULL
;
const
char
*
conn_keywords
[
6
];
const
char
*
conn_values
[
6
];
ecpg_init_sqlca
(
sqlca
);
...
...
@@ -482,34 +475,52 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
options
?
"with options "
:
""
,
options
?
options
:
""
,
(
user
&&
strlen
(
user
)
>
0
)
?
"for user "
:
""
,
user
?
user
:
""
);
connect_string
=
ecpg_alloc
(
strlen_or_null
(
host
)
+
strlen_or_null
(
port
)
+
strlen_or_null
(
options
)
+
strlen_or_null
(
realname
)
+
strlen_or_null
(
user
)
+
strlen_or_null
(
passwd
)
+
sizeof
(
" host = port = dbname = user = password ="
),
lineno
);
if
(
options
)
/* replace '&' if tehre are any */
if
(
options
)
/* replace '&' if there are any */
for
(
i
=
0
;
options
[
i
];
i
++
)
if
(
options
[
i
]
==
'&'
)
options
[
i
]
=
' '
;
sprintf
(
connect_string
,
"%s%s %s%s %s%s %s%s %s%s %s"
,
realname
?
"dbname="
:
""
,
realname
?
realname
:
""
,
host
?
"host="
:
""
,
host
?
host
:
""
,
port
?
"port="
:
""
,
port
?
port
:
""
,
(
user
&&
strlen
(
user
)
>
0
)
?
"user="
:
""
,
user
?
user
:
""
,
(
passwd
&&
strlen
(
passwd
)
>
0
)
?
"password="
:
""
,
passwd
?
passwd
:
""
,
options
?
options
:
""
);
i
=
0
;
if
(
realname
)
{
conn_keywords
[
i
]
=
"dbname"
;
conn_values
[
i
]
=
realname
;
i
++
;
}
if
(
host
)
{
conn_keywords
[
i
]
=
"host"
;
conn_values
[
i
]
=
host
;
i
++
;
}
if
(
port
)
{
conn_keywords
[
i
]
=
"port"
;
conn_values
[
i
]
=
port
;
i
++
;
}
if
(
user
&&
strlen
(
user
)
>
0
)
{
conn_keywords
[
i
]
=
"user"
;
conn_values
[
i
]
=
user
;
i
++
;
}
if
(
passwd
&&
strlen
(
passwd
)
>
0
)
{
conn_keywords
[
i
]
=
"password"
;
conn_values
[
i
]
=
passwd
;
i
++
;
}
if
(
options
)
{
conn_keywords
[
i
]
=
"options"
;
conn_values
[
i
]
=
options
;
i
++
;
}
conn_keywords
[
i
]
=
NULL
;
/* terminator */
/*
* this is deprecated this->connection = PQsetdbLogin(host, port, options,
* NULL, realname, user, passwd);
*/
this
->
connection
=
PQconnectdb
(
connect_string
);
this
->
connection
=
PQconnectdbParams
(
conn_keywords
,
conn_values
,
0
);
ecpg_free
(
connect_string
);
if
(
host
)
ecpg_free
(
host
);
if
(
port
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录