Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
8647c142
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,发现更多精彩内容 >>
提交
8647c142
编写于
12月 19, 2001
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix buffer-overrun problem in pretty printer.
上级
89708371
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
41 addition
and
22 deletion
+41
-22
src/backend/nodes/print.c
src/backend/nodes/print.c
+41
-22
未找到文件。
src/backend/nodes/print.c
浏览文件 @
8647c142
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.
49 2001/10/25 05:49:31 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.
50 2001/12/19 22:35:35 tgl
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -41,6 +41,7 @@ print(void *obj)
s
=
nodeToString
(
obj
);
printf
(
"%s
\n
"
,
s
);
fflush
(
stdout
);
pfree
(
s
);
}
/*
...
...
@@ -49,59 +50,77 @@ print(void *obj)
void
pprint
(
void
*
obj
)
{
#define INDENTSTOP 3
#define MAXINDENT 60
#define LINELEN 80
char
*
s
;
int
i
;
char
line
[
80
];
char
line
[
LINELEN
];
int
indentLev
;
int
indentDist
;
int
j
;
s
=
nodeToString
(
obj
);
indentLev
=
0
;
indentLev
=
0
;
/* logical indent level */
indentDist
=
0
;
/* physical indent distance */
i
=
0
;
for
(;;)
{
for
(
j
=
0
;
j
<
indent
Lev
*
3
;
j
++
)
for
(
j
=
0
;
j
<
indent
Dist
;
j
++
)
line
[
j
]
=
' '
;
for
(;
j
<
75
&&
s
[
i
]
!=
'\0'
;
i
++
,
j
++
)
for
(;
j
<
LINELEN
-
1
&&
s
[
i
]
!=
'\0'
;
i
++
,
j
++
)
{
line
[
j
]
=
s
[
i
];
switch
(
line
[
j
])
{
case
'}'
:
if
(
j
!=
indent
Lev
*
3
)
if
(
j
!=
indent
Dist
)
{
/* print data before the } */
line
[
j
]
=
'\0'
;
printf
(
"%s
\n
"
,
line
);
line
[
indentLev
*
3
]
=
'\0'
;
printf
(
"%s}
\n
"
,
line
);
}
else
/* print the } at indentDist */
line
[
indentDist
]
=
'\0'
;
printf
(
"%s}
\n
"
,
line
);
/* outdent */
if
(
indentLev
>
0
)
{
line
[
j
]
=
'\0'
;
printf
(
"%s}
\n
"
,
line
);
indentLev
--
;
indentDist
=
MIN
(
indentLev
*
INDENTSTOP
,
MAXINDENT
);
}
indentLev
--
;
j
=
indentLev
*
3
-
1
;
/* print the line before :
* and resets */
j
=
indentDist
-
1
;
/* j will equal indentDist on next loop iteration */
break
;
case
')'
:
/* force line break after ')' */
line
[
j
+
1
]
=
'\0'
;
printf
(
"%s
\n
"
,
line
);
j
=
indent
Lev
*
3
-
1
;
j
=
indent
Dist
-
1
;
break
;
case
'{'
:
/* force line break before { */
if
(
j
!=
indentDist
)
{
line
[
j
]
=
'\0'
;
printf
(
"%s
\n
"
,
line
);
}
/* indent */
indentLev
++
;
/* !!! FALLS THROUGH */
indentDist
=
MIN
(
indentLev
*
INDENTSTOP
,
MAXINDENT
);
for
(
j
=
0
;
j
<
indentDist
;
j
++
)
line
[
j
]
=
' '
;
line
[
j
]
=
s
[
i
];
break
;
case
':'
:
if
(
j
!=
0
)
/* force line break before : */
if
(
j
!=
indentDist
)
{
line
[
j
]
=
'\0'
;
printf
(
"%s
\n
"
,
line
);
/* print the line before : and resets */
for
(
j
=
0
;
j
<
indentLev
*
3
;
j
++
)
line
[
j
]
=
' '
;
}
j
=
indentDist
;
line
[
j
]
=
s
[
i
];
break
;
}
...
...
@@ -114,7 +133,7 @@ pprint(void *obj)
if
(
j
!=
0
)
printf
(
"%s
\n
"
,
line
);
fflush
(
stdout
);
return
;
pfree
(
s
)
;
}
/*
...
...
@@ -378,7 +397,7 @@ void
print_plan_recursive
(
Plan
*
p
,
Query
*
parsetree
,
int
indentLevel
,
char
*
label
)
{
int
i
;
char
extraInfo
[
100
];
char
extraInfo
[
NAMEDATALEN
+
100
];
if
(
!
p
)
return
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录