Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
4e82924e
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,发现更多精彩内容 >>
提交
4e82924e
编写于
7月 31, 1996
作者:
M
Marc G. Fournier
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Row count patch from Bruce
上级
7d2000e3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
38 addition
and
26 deletion
+38
-26
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-exec.c
+35
-23
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-fe.h
+3
-3
未找到文件。
src/interfaces/libpq/fe-exec.c
浏览文件 @
4e82924e
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.1
1 1996/07/31 06:05:46
scrappy Exp $
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.1
2 1996/07/31 18:40:09
scrappy Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -829,21 +829,22 @@ PQprint(FILE *fout,
nFields
=
PQnfields
(
res
);
if
(
nFields
>
0
)
{
/* only print tuples with at least 1 field. */
int
i
,
j
;
int
nTups
;
int
*
fieldMax
=
NULL
;
/* keep -Wall happy */
unsigned
char
*
fieldNotNum
=
NULL
;
/* keep -Wall happy */
char
**
fields
=
NULL
;
/*keep -Wall happy */
int
i
,
j
;
int
nTups
;
int
*
fieldMax
=
NULL
;
/* in case we don't use them */
unsigned
char
*
fieldNotNum
=
NULL
;
char
*
border
=
NULL
;
char
**
fields
=
NULL
;
char
**
fieldNames
;
int
fieldMaxLen
=
0
;
char
*
border
=
NULL
;
int
numFieldName
;
int
numFieldName
;
int
fs_len
=
strlen
(
po
->
fieldSep
);
int
total_line_length
=
0
;
int
usePipe
=
0
;
char
*
pagerenv
;
int
total_line_length
=
0
;
int
usePipe
=
0
;
char
*
pagerenv
;
char
buf
[
8192
*
2
+
1
];
nTups
=
PQntuples
(
res
);
nTups
=
PQntuples
(
res
);
if
(
!
(
fieldNames
=
(
char
**
)
calloc
(
nFields
,
sizeof
(
char
*
))))
{
perror
(
"calloc"
);
...
...
@@ -882,7 +883,10 @@ PQprint(FILE *fout,
if
(
fout
==
NULL
)
fout
=
stdout
;
if
(
po
->
pager
&&
fout
==
stdout
&&
isatty
(
fileno
(
stdout
)))
{
if
(
po
->
pager
&&
fout
==
stdout
&&
isatty
(
fileno
(
stdin
))
&&
isatty
(
fileno
(
stdout
)))
{
/* try to pipe to the pager program if possible */
#ifdef TIOCGWINSZ
if
(
ioctl
(
fileno
(
stdout
),
TIOCGWINSZ
,
&
screen_size
)
==
-
1
||
...
...
@@ -907,8 +911,7 @@ PQprint(FILE *fout,
screen_size
.
ws_row
-
(
po
->
header
!=
0
)
*
(
total_line_length
/
screen_size
.
ws_col
+
1
)
*
2
/*- 1 */
/* newline at end of tuple list */
/*- (quiet == 0)*/
-
(
po
->
header
!=
0
)
*
2
/* row count and newline */
)))
{
fout
=
popen
(
pagerenv
,
"w"
);
...
...
@@ -927,7 +930,8 @@ PQprint(FILE *fout,
perror
(
"calloc"
);
exit
(
1
);
}
}
else
}
else
if
(
po
->
header
&&
!
po
->
html3
)
{
if
(
po
->
expanded
)
...
...
@@ -936,7 +940,8 @@ PQprint(FILE *fout,
fprintf
(
fout
,
"%-*s%s Value
\n
"
,
fieldMaxLen
-
fs_len
,
"Field"
,
po
->
fieldSep
);
else
fprintf
(
fout
,
"%s%sValue
\n
"
,
"Field"
,
po
->
fieldSep
);
}
else
}
else
{
int
len
=
0
;
for
(
j
=
0
;
j
<
nFields
;
j
++
)
...
...
@@ -959,8 +964,8 @@ PQprint(FILE *fout,
else
fprintf
(
fout
,
"<centre><h2>Query retrieved %d tuples * %d fields</h2></centre>
\n
"
,
nTups
,
nFields
);
}
for
(
i
=
0
;
i
<
nTups
;
i
++
)
{
char
buf
[
8192
*
2
+
1
];
for
(
i
=
0
;
i
<
nTups
;
i
++
)
{
if
(
po
->
expanded
)
{
if
(
po
->
html3
)
...
...
@@ -968,7 +973,8 @@ PQprint(FILE *fout,
else
fprintf
(
fout
,
"-- RECORD %d --
\n
"
,
i
);
}
for
(
j
=
0
;
j
<
nFields
;
j
++
)
{
for
(
j
=
0
;
j
<
nFields
;
j
++
)
{
char
*
pval
,
*
p
,
*
o
;
int
plen
;
if
((
plen
=
PQgetlength
(
res
,
i
,
j
))
<
1
||
!
(
pval
=
PQgetvalue
(
res
,
i
,
j
))
||
!*
pval
)
...
...
@@ -996,7 +1002,8 @@ PQprint(FILE *fout,
exit
(
1
);
}
strcpy
(
fields
[
i
*
nFields
+
j
],
buf
);
}
else
}
else
{
if
(
po
->
expanded
)
{
...
...
@@ -1089,7 +1096,8 @@ efield:
{
fprintf
(
fout
,
"<th align=%s>%s</th>"
,
fieldNotNum
[
j
]
?
"left"
:
"right"
,
fieldNames
[
j
]);
}
else
}
else
{
int
n
=
strlen
(
s
);
if
(
n
>
fieldMax
[
j
])
...
...
@@ -1139,10 +1147,14 @@ efield:
}
free
(
fields
);
}
if
(
po
->
header
&&
!
po
->
html3
)
fprintf
(
fout
,
"(%d row%s)
\n\n
"
,
PQntuples
(
res
),
(
PQntuples
(
res
)
==
1
)
?
""
:
"s"
);
free
(
fieldMax
);
free
(
fieldNotNum
);
free
(
fieldNames
);
if
(
usePipe
)
{
if
(
usePipe
)
{
pclose
(
fout
);
signal
(
SIGPIPE
,
SIG_DFL
);
}
...
...
src/interfaces/libpq/libpq-fe.h
浏览文件 @
4e82924e
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: libpq-fe.h,v 1.
4 1996/07/27 02:55:23
scrappy Exp $
* $Id: libpq-fe.h,v 1.
5 1996/07/31 18:40:12
scrappy Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -128,12 +128,12 @@ typedef struct pg_result{
}
PGresult
;
struct
_PQprintOpt
{
bool
header
;
/* print output field head
ers or no
t */
bool
header
;
/* print output field head
ings and row coun
t */
bool
align
;
/* fill align the fields */
bool
standard
;
/* old brain dead format */
bool
html3
;
/* output html tables */
bool
expanded
;
/* expand tables */
bool
pager
;
/* use pager for output if needed */
bool
pager
;
/* use pager for output if needed */
char
*
fieldSep
;
/* field separator */
char
*
tableOpt
;
/* insert to HTML <table ...> */
char
*
caption
;
/* HTML <caption> */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录