Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
5d2cf6af
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,发现更多精彩内容 >>
提交
5d2cf6af
编写于
1月 17, 1999
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TCL_ARRAYS option patches from Massimo Dal Zotto
上级
f134a1a9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
79 addition
and
36 deletion
+79
-36
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/arrayfuncs.c
+7
-1
src/interfaces/libpgtcl/pgtclCmds.c
src/interfaces/libpgtcl/pgtclCmds.c
+72
-35
未找到文件。
src/backend/utils/adt/arrayfuncs.c
浏览文件 @
5d2cf6af
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.3
5 1999/01/17 06:18:45 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.3
6 1999/01/17 21:12:55 tgl
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -699,8 +699,10 @@ array_out(ArrayType *v, Oid element_type)
for
(
tmp
=
values
[
i
];
*
tmp
;
tmp
++
)
{
overall_length
+=
1
;
#ifndef TCL_ARRAYS
if
(
*
tmp
==
'"'
)
overall_length
+=
1
;
#endif
}
overall_length
+=
1
;
}
...
...
@@ -729,6 +731,7 @@ array_out(ArrayType *v, Oid element_type)
if
(
!
typbyval
)
{
strcat
(
p
,
"
\"
"
);
#ifndef TCL_ARRAYS
l
=
strlen
(
p
);
for
(
tmp
=
values
[
k
];
*
tmp
;
tmp
++
)
{
...
...
@@ -737,6 +740,9 @@ array_out(ArrayType *v, Oid element_type)
p
[
l
++
]
=
*
tmp
;
}
p
[
l
]
=
'\0'
;
#else
strcat
(
p
,
values
[
k
]);
#endif
strcat
(
p
,
"
\"
"
);
}
else
...
...
src/interfaces/libpgtcl/pgtclCmds.c
浏览文件 @
5d2cf6af
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.3
8 1998/10/14 15:17:51
tgl Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpgtcl/Attic/pgtclCmds.c,v 1.3
9 1999/01/17 21:12:55
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -472,39 +472,50 @@ Pg_exec(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
get information about the results of a query
syntax:
pg_result result ?option?
pg_result result ?option?
the options are:
-status
the status of the result
-error
the error message, if the status indicates error; otherwise an empty string
-conn
the connection that produced the result
-oid
if command was an INSERT, the OID of the inserted tuple
-numTuples
the number of tuples in the query
-numAttrs
returns the number of attributes returned by the query
-assign arrayName
assign the results to an array, using subscripts of the form
(tupno,attributeName)
-assignbyidx arrayName ?appendstr?
assign the results to an array using the first field's value as a key.
All but the first field of each tuple are stored, using subscripts of the form
(field0value,attributeNameappendstr)
-getTuple tupleNumber
returns the values of the tuple in a list
-tupleArray tupleNumber arrayName
stores the values of the tuple in array arrayName, indexed
by the attributes returned
-attributes
returns a list of the name/type pairs of the tuple attributes
-lAttributes
returns a list of the {name type len} entries of the tuple attributes
-clear
clear the result buffer. Do not reuse after this
-status the status of the result
-error the error message, if the status indicates error; otherwise
an empty string
-conn the connection that produced the result
-oid if command was an INSERT, the OID of the inserted tuple
-numTuples the number of tuples in the query
-numAttrs returns the number of attributes returned by the query
-assign arrayName
assign the results to an array, using subscripts of the form
(tupno,attributeName)
-assignbyidx arrayName ?appendstr?
assign the results to an array using the first field's value
as a key.
All but the first field of each tuple are stored, using
subscripts of the form (field0value,attributeNameappendstr)
-getTuple tupleNumber
returns the values of the tuple in a list
-tupleArray tupleNumber arrayName
stores the values of the tuple in array arrayName, indexed
by the attributes returned
-attributes
returns a list of the name/type pairs of the tuple attributes
-lAttributes
returns a list of the {name type len} entries of the tuple
attributes
-clear clear the result buffer. Do not reuse after this
**********************************/
int
Pg_result
(
ClientData
cData
,
Tcl_Interp
*
interp
,
int
argc
,
char
*
argv
[])
...
...
@@ -621,15 +632,24 @@ Pg_result(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
*/
for
(
tupno
=
0
;
tupno
<
PQntuples
(
result
);
tupno
++
)
{
const
char
*
field0
=
PQgetvalue
(
result
,
tupno
,
0
);
char
*
workspace
=
malloc
(
strlen
(
field0
)
+
strlen
(
appendstr
)
+
210
);
const
char
*
field0
=
#ifdef TCL_ARRAYS
tcl_value
(
PQgetvalue
(
result
,
tupno
,
0
));
#else
PQgetvalue
(
result
,
tupno
,
0
);
#endif
char
*
workspace
=
malloc
(
strlen
(
field0
)
+
strlen
(
appendstr
)
+
210
);
for
(
i
=
1
;
i
<
PQnfields
(
result
);
i
++
)
{
sprintf
(
workspace
,
"%s,%.200s%s"
,
field0
,
PQfname
(
result
,
i
),
appendstr
);
if
(
Tcl_SetVar2
(
interp
,
arrVar
,
workspace
,
#ifdef TCL_ARRAYS
tcl_value
(
PQgetvalue
(
result
,
tupno
,
i
)),
#else
PQgetvalue
(
result
,
tupno
,
i
),
#endif
TCL_LEAVE_ERR_MSG
)
==
NULL
)
{
free
(
workspace
);
...
...
@@ -654,8 +674,15 @@ Pg_result(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
Tcl_AppendResult
(
interp
,
"argument to getTuple cannot exceed number of tuples - 1"
,
0
);
return
TCL_ERROR
;
}
#ifdef TCL_ARRAYS
for
(
i
=
0
;
i
<
PQnfields
(
result
);
i
++
)
{
Tcl_AppendElement
(
interp
,
tcl_value
(
PQgetvalue
(
result
,
tupno
,
i
)));
}
#else
for
(
i
=
0
;
i
<
PQnfields
(
result
);
i
++
)
Tcl_AppendElement
(
interp
,
PQgetvalue
(
result
,
tupno
,
i
));
#endif
return
TCL_OK
;
}
else
if
(
strcmp
(
opt
,
"-tupleArray"
)
==
0
)
...
...
@@ -674,7 +701,11 @@ Pg_result(ClientData cData, Tcl_Interp * interp, int argc, char *argv[])
for
(
i
=
0
;
i
<
PQnfields
(
result
);
i
++
)
{
if
(
Tcl_SetVar2
(
interp
,
argv
[
4
],
PQfname
(
result
,
i
),
#ifdef TCL_ARRAYS
tcl_value
(
PQgetvalue
(
result
,
tupno
,
i
)),
#else
PQgetvalue
(
result
,
tupno
,
i
),
#endif
TCL_LEAVE_ERR_MSG
)
==
NULL
)
return
TCL_ERROR
;
}
...
...
@@ -1302,7 +1333,13 @@ Pg_select(ClientData cData, Tcl_Interp * interp, int argc, char **argv)
Tcl_SetVar2
(
interp
,
argv
[
3
],
".tupno"
,
buffer
,
0
);
for
(
column
=
0
;
column
<
ncols
;
column
++
)
Tcl_SetVar2
(
interp
,
argv
[
3
],
info
[
column
].
cname
,
PQgetvalue
(
result
,
tupno
,
column
),
0
);
Tcl_SetVar2
(
interp
,
argv
[
3
],
info
[
column
].
cname
,
#ifdef TCL_ARRAYS
tcl_value
(
PQgetvalue
(
result
,
tupno
,
column
)),
#else
PQgetvalue
(
result
,
tupno
,
column
),
#endif
0
);
Tcl_SetVar2
(
interp
,
argv
[
3
],
".command"
,
"update"
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录