3
3
*
4
4
* Copyright 2000 by PostgreSQL Global Development Group
5
5
*
6
- * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.70 2002/03/19 02:32:21 momjian Exp $
6
+ * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.71 2002/03/27 19:16:13 petere Exp $
7
7
*/
8
8
#include "postgres_fe.h"
9
9
#include "command.h"
52
52
static backslashResult exec_command (const char * cmd ,
53
53
const char * options_string ,
54
54
const char * * continue_parse ,
55
- PQExpBuffer query_buf );
55
+ PQExpBuffer query_buf ,
56
+ volatile int * paren_level );
56
57
57
58
/* different ways for scan_option to handle parameter words */
58
59
enum option_type
@@ -94,7 +95,8 @@ static bool do_shell(const char *command);
94
95
backslashResult
95
96
HandleSlashCmds (const char * line ,
96
97
PQExpBuffer query_buf ,
97
- const char * * end_of_cmd )
98
+ const char * * end_of_cmd ,
99
+ volatile int * paren_level )
98
100
{
99
101
backslashResult status = CMD_SKIP_LINE ;
100
102
char * my_line ;
@@ -132,7 +134,7 @@ HandleSlashCmds(const char *line,
132
134
my_line [blank_loc ] = '\0' ;
133
135
}
134
136
135
- status = exec_command (my_line , options_string , & continue_parse , query_buf );
137
+ status = exec_command (my_line , options_string , & continue_parse , query_buf , paren_level );
136
138
137
139
if (status == CMD_UNKNOWN )
138
140
{
@@ -147,7 +149,7 @@ HandleSlashCmds(const char *line,
147
149
new_cmd [1 ] = '\0' ;
148
150
149
151
/* use line for options, because my_line was clobbered above */
150
- status = exec_command (new_cmd , line + 1 , & continue_parse , query_buf );
152
+ status = exec_command (new_cmd , line + 1 , & continue_parse , query_buf , paren_level );
151
153
152
154
/*
153
155
* continue_parse must be relative to my_line for calculation
@@ -192,7 +194,8 @@ static backslashResult
192
194
exec_command (const char * cmd ,
193
195
const char * options_string ,
194
196
const char * * continue_parse ,
195
- PQExpBuffer query_buf )
197
+ PQExpBuffer query_buf ,
198
+ volatile int * paren_level )
196
199
{
197
200
bool success = true; /* indicate here if the command ran ok or
198
201
* failed */
@@ -636,6 +639,8 @@ exec_command(const char *cmd,
636
639
else if (strcmp (cmd , "r" ) == 0 || strcmp (cmd , "reset" ) == 0 )
637
640
{
638
641
resetPQExpBuffer (query_buf );
642
+ if (paren_level )
643
+ * paren_level = 0 ;
639
644
if (!quiet )
640
645
puts (gettext ("Query buffer reset (cleared)." ));
641
646
}
0 commit comments