diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2002-03-27 19:16:13 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2002-03-27 19:16:13 +0000 |
commit | d235d9b8a3b63d81e2ba60dfc54937a318ae0f95 (patch) | |
tree | e68e15ad5928da839bf81399e2eeedcbeebfa508 /src/bin/psql/command.c | |
parent | 2442e79e3276a6c4f29e5a415858c7a487ec18b2 (diff) |
Reset parenthesis level counter upon \r.
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r-- | src/bin/psql/command.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 97f58dc3f61..a0d4a5ca1a4 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.70 2002/03/19 02:32:21 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.71 2002/03/27 19:16:13 petere Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -52,7 +52,8 @@ static backslashResult exec_command(const char *cmd, const char *options_string, const char **continue_parse, - PQExpBuffer query_buf); + PQExpBuffer query_buf, + volatile int *paren_level); /* different ways for scan_option to handle parameter words */ enum option_type @@ -94,7 +95,8 @@ static bool do_shell(const char *command); backslashResult HandleSlashCmds(const char *line, PQExpBuffer query_buf, - const char **end_of_cmd) + const char **end_of_cmd, + volatile int *paren_level) { backslashResult status = CMD_SKIP_LINE; char *my_line; @@ -132,7 +134,7 @@ HandleSlashCmds(const char *line, my_line[blank_loc] = '\0'; } - status = exec_command(my_line, options_string, &continue_parse, query_buf); + status = exec_command(my_line, options_string, &continue_parse, query_buf, paren_level); if (status == CMD_UNKNOWN) { @@ -147,7 +149,7 @@ HandleSlashCmds(const char *line, new_cmd[1] = '\0'; /* use line for options, because my_line was clobbered above */ - status = exec_command(new_cmd, line + 1, &continue_parse, query_buf); + status = exec_command(new_cmd, line + 1, &continue_parse, query_buf, paren_level); /* * continue_parse must be relative to my_line for calculation @@ -192,7 +194,8 @@ static backslashResult exec_command(const char *cmd, const char *options_string, const char **continue_parse, - PQExpBuffer query_buf) + PQExpBuffer query_buf, + volatile int *paren_level) { bool success = true; /* indicate here if the command ran ok or * failed */ @@ -636,6 +639,8 @@ exec_command(const char *cmd, else if (strcmp(cmd, "r") == 0 || strcmp(cmd, "reset") == 0) { resetPQExpBuffer(query_buf); + if (paren_level) + *paren_level = 0; if (!quiet) puts(gettext("Query buffer reset (cleared).")); } |