Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
7031dd68
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,发现更多精彩内容 >>
提交
7031dd68
编写于
2月 23, 2007
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add psql \prompt capability.
Chad Wagner
上级
cc77005d
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
77 addition
and
6 deletion
+77
-6
doc/src/sgml/ref/psql-ref.sgml
doc/src/sgml/ref/psql-ref.sgml
+19
-1
src/bin/psql/command.c
src/bin/psql/command.c
+52
-1
src/bin/psql/help.c
src/bin/psql/help.c
+4
-2
src/bin/psql/tab-complete.c
src/bin/psql/tab-complete.c
+2
-2
未找到文件。
doc/src/sgml/ref/psql-ref.sgml
浏览文件 @
7031dd68
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.18
6 2007/02/21 23:22:42
momjian Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.18
7 2007/02/23 18:20:58
momjian Exp $
PostgreSQL documentation
-->
...
...
@@ -1429,6 +1429,24 @@ lo_import 152801
</listitem>
</varlistentry>
<varlistentry>
<term><literal>\prompt [ <replaceable class="parameter">text</replaceable> ] <replaceable class="parameter">name</replaceable></literal></term>
<listitem>
<para>
Prompts the user to set variable <replaceable
class="parameter">name</>. An optional prompt, <replaceable
class="parameter">text</>, can be specified. (For multi-word
prompts, use single-quotes.)
</para>
<para>
By default, <literal>\prompt</> uses the terminal for input and
output. However, if the <option>-f</> command line switch is
used, <literal>\prompt</> uses standard input and standard output.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><literal>\pset <replaceable class="parameter">parameter</replaceable> [ <replaceable class="parameter">value</replaceable> ]</literal></term>
...
...
src/bin/psql/command.c
浏览文件 @
7031dd68
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.17
7 2007/01/05 22:19:49
momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.17
8 2007/02/23 18:20:58
momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
...
...
@@ -712,6 +712,57 @@ exec_command(const char *cmd,
free
(
pw2
);
}
/* \prompt -- prompt and set variable */
else
if
(
strcmp
(
cmd
,
"prompt"
)
==
0
)
{
char
*
opt
,
*
prompt_text
=
NULL
;
char
*
arg1
,
*
arg2
;
arg1
=
psql_scan_slash_option
(
scan_state
,
OT_NORMAL
,
NULL
,
false
);
arg2
=
psql_scan_slash_option
(
scan_state
,
OT_NORMAL
,
NULL
,
false
);
if
(
!
arg1
)
{
psql_error
(
"
\\
%s: missing required argument
\n
"
,
cmd
);
success
=
false
;
}
else
{
char
*
result
;
if
(
arg2
)
{
prompt_text
=
arg1
;
opt
=
arg2
;
}
else
opt
=
arg1
;
if
(
!
pset
.
inputfile
)
result
=
simple_prompt
(
prompt_text
,
4096
,
true
);
else
{
if
(
prompt_text
)
{
fputs
(
prompt_text
,
stdout
);
fflush
(
stdout
);
}
result
=
gets_fromFile
(
stdin
);
}
if
(
!
SetVariable
(
pset
.
vars
,
opt
,
result
))
{
psql_error
(
"
\\
%s: error
\n
"
,
cmd
);
success
=
false
;
}
free
(
result
);
if
(
prompt_text
)
free
(
prompt_text
);
free
(
opt
);
}
}
/* \pset -- set printing parameters */
else
if
(
strcmp
(
cmd
,
"pset"
)
==
0
)
{
...
...
src/bin/psql/help.c
浏览文件 @
7031dd68
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.11
6 2007/01/05 22:19:4
9 momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.11
7 2007/02/23 18:20:5
9 momjian Exp $
*/
#include "postgres_fe.h"
...
...
@@ -161,7 +161,7 @@ slashUsage(unsigned short int pager)
{
FILE
*
output
;
output
=
PageOutput
(
6
7
,
pager
);
output
=
PageOutput
(
6
9
,
pager
);
/* if you add/remove a line here, change the row count above */
...
...
@@ -184,6 +184,8 @@ slashUsage(unsigned short int pager)
fprintf
(
output
,
_
(
"
\\
timing toggle timing of commands (currently %s)
\n
"
),
ON
(
pset
.
timing
));
fprintf
(
output
,
_
(
"
\\
unset NAME unset (delete) internal variable
\n
"
));
fprintf
(
output
,
_
(
"
\\
prompt [TEXT] NAME
\n
"
" prompt user to set internal variable
\n
"
));
fprintf
(
output
,
_
(
"
\\
! [COMMAND] execute command in shell or start interactive shell
\n
"
));
fprintf
(
output
,
"
\n
"
);
...
...
src/bin/psql/tab-complete.c
浏览文件 @
7031dd68
...
...
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.15
8 2007/02/07 00:52:35 petere
Exp $
* $PostgreSQL: pgsql/src/bin/psql/tab-complete.c,v 1.15
9 2007/02/23 18:20:59 momjian
Exp $
*/
/*----------------------------------------------------------------------
...
...
@@ -542,7 +542,7 @@ psql_completion(char *text, int start, int end)
"
\\
e"
,
"
\\
echo"
,
"
\\
encoding"
,
"
\\
f"
,
"
\\
g"
,
"
\\
h"
,
"
\\
help"
,
"
\\
H"
,
"
\\
i"
,
"
\\
l"
,
"
\\
lo_import"
,
"
\\
lo_export"
,
"
\\
lo_list"
,
"
\\
lo_unlink"
,
"
\\
o"
,
"
\\
p"
,
"
\\
password"
,
"
\\
pset"
,
"
\\
q"
,
"
\\
qecho"
,
"
\\
r"
,
"
\\
o"
,
"
\\
p"
,
"
\\
password"
,
"
\\
p
rompt"
,
"
\\
p
set"
,
"
\\
q"
,
"
\\
qecho"
,
"
\\
r"
,
"
\\
set"
,
"
\\
t"
,
"
\\
T"
,
"
\\
timing"
,
"
\\
unset"
,
"
\\
x"
,
"
\\
w"
,
"
\\
z"
,
"
\\
!"
,
NULL
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录