Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
d235d9b8
Commit
d235d9b8
authored
Mar 27, 2002
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset parenthesis level counter upon \r.
parent
2442e79e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
12 deletions
+19
-12
src/bin/psql/command.c
src/bin/psql/command.c
+11
-6
src/bin/psql/command.h
src/bin/psql/command.h
+3
-2
src/bin/psql/mainloop.c
src/bin/psql/mainloop.c
+3
-2
src/bin/psql/startup.c
src/bin/psql/startup.c
+2
-2
No files found.
src/bin/psql/command.c
View file @
d235d9b8
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.7
0 2002/03/19 02:32:21 momjian
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.7
1 2002/03/27 19:16:13 petere
Exp $
*/
*/
#include "postgres_fe.h"
#include "postgres_fe.h"
#include "command.h"
#include "command.h"
...
@@ -52,7 +52,8 @@
...
@@ -52,7 +52,8 @@
static
backslashResult
exec_command
(
const
char
*
cmd
,
static
backslashResult
exec_command
(
const
char
*
cmd
,
const
char
*
options_string
,
const
char
*
options_string
,
const
char
**
continue_parse
,
const
char
**
continue_parse
,
PQExpBuffer
query_buf
);
PQExpBuffer
query_buf
,
volatile
int
*
paren_level
);
/* different ways for scan_option to handle parameter words */
/* different ways for scan_option to handle parameter words */
enum
option_type
enum
option_type
...
@@ -94,7 +95,8 @@ static bool do_shell(const char *command);
...
@@ -94,7 +95,8 @@ static bool do_shell(const char *command);
backslashResult
backslashResult
HandleSlashCmds
(
const
char
*
line
,
HandleSlashCmds
(
const
char
*
line
,
PQExpBuffer
query_buf
,
PQExpBuffer
query_buf
,
const
char
**
end_of_cmd
)
const
char
**
end_of_cmd
,
volatile
int
*
paren_level
)
{
{
backslashResult
status
=
CMD_SKIP_LINE
;
backslashResult
status
=
CMD_SKIP_LINE
;
char
*
my_line
;
char
*
my_line
;
...
@@ -132,7 +134,7 @@ HandleSlashCmds(const char *line,
...
@@ -132,7 +134,7 @@ HandleSlashCmds(const char *line,
my_line
[
blank_loc
]
=
'\0'
;
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
)
if
(
status
==
CMD_UNKNOWN
)
{
{
...
@@ -147,7 +149,7 @@ HandleSlashCmds(const char *line,
...
@@ -147,7 +149,7 @@ HandleSlashCmds(const char *line,
new_cmd
[
1
]
=
'\0'
;
new_cmd
[
1
]
=
'\0'
;
/* use line for options, because my_line was clobbered above */
/* 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
* continue_parse must be relative to my_line for calculation
...
@@ -192,7 +194,8 @@ static backslashResult
...
@@ -192,7 +194,8 @@ static backslashResult
exec_command
(
const
char
*
cmd
,
exec_command
(
const
char
*
cmd
,
const
char
*
options_string
,
const
char
*
options_string
,
const
char
**
continue_parse
,
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
bool
success
=
true
;
/* indicate here if the command ran ok or
* failed */
* failed */
...
@@ -636,6 +639,8 @@ exec_command(const char *cmd,
...
@@ -636,6 +639,8 @@ exec_command(const char *cmd,
else
if
(
strcmp
(
cmd
,
"r"
)
==
0
||
strcmp
(
cmd
,
"reset"
)
==
0
)
else
if
(
strcmp
(
cmd
,
"r"
)
==
0
||
strcmp
(
cmd
,
"reset"
)
==
0
)
{
{
resetPQExpBuffer
(
query_buf
);
resetPQExpBuffer
(
query_buf
);
if
(
paren_level
)
*
paren_level
=
0
;
if
(
!
quiet
)
if
(
!
quiet
)
puts
(
gettext
(
"Query buffer reset (cleared)."
));
puts
(
gettext
(
"Query buffer reset (cleared)."
));
}
}
...
...
src/bin/psql/command.h
View file @
d235d9b8
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/command.h,v 1.1
3 2001/11/05 17:46:30 momjian
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/command.h,v 1.1
4 2002/03/27 19:16:13 petere
Exp $
*/
*/
#ifndef COMMAND_H
#ifndef COMMAND_H
#define COMMAND_H
#define COMMAND_H
...
@@ -28,7 +28,8 @@ typedef enum _backslashResult
...
@@ -28,7 +28,8 @@ typedef enum _backslashResult
backslashResult
HandleSlashCmds
(
const
char
*
line
,
backslashResult
HandleSlashCmds
(
const
char
*
line
,
PQExpBuffer
query_buf
,
PQExpBuffer
query_buf
,
const
char
**
end_of_cmd
);
const
char
**
end_of_cmd
,
volatile
int
*
paren_level
);
int
int
process_file
(
char
*
filename
);
process_file
(
char
*
filename
);
...
...
src/bin/psql/mainloop.c
View file @
d235d9b8
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.4
6 2002/02/18 05:57:41 momjian
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.4
7 2002/03/27 19:16:13 petere
Exp $
*/
*/
#include "postgres_fe.h"
#include "postgres_fe.h"
#include "mainloop.h"
#include "mainloop.h"
...
@@ -465,7 +465,8 @@ MainLoop(FILE *source)
...
@@ -465,7 +465,8 @@ MainLoop(FILE *source)
/* handle backslash command */
/* handle backslash command */
slashCmdStatus
=
HandleSlashCmds
(
&
line
[
i
],
slashCmdStatus
=
HandleSlashCmds
(
&
line
[
i
],
query_buf
->
len
>
0
?
query_buf
:
previous_buf
,
query_buf
->
len
>
0
?
query_buf
:
previous_buf
,
&
end_of_cmd
);
&
end_of_cmd
,
&
paren_level
);
success
=
slashCmdStatus
!=
CMD_ERROR
;
success
=
slashCmdStatus
!=
CMD_ERROR
;
...
...
src/bin/psql/startup.c
View file @
d235d9b8
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright 2000 by PostgreSQL Global Development Group
* Copyright 2000 by PostgreSQL Global Development Group
*
*
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.5
4 2001/11/05 17:46:31 momjian
Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.5
5 2002/03/27 19:16:13 petere
Exp $
*/
*/
#include "postgres_fe.h"
#include "postgres_fe.h"
...
@@ -256,7 +256,7 @@ main(int argc, char *argv[])
...
@@ -256,7 +256,7 @@ main(int argc, char *argv[])
if
((
value
=
GetVariable
(
pset
.
vars
,
"ECHO"
))
&&
strcmp
(
value
,
"all"
)
==
0
)
if
((
value
=
GetVariable
(
pset
.
vars
,
"ECHO"
))
&&
strcmp
(
value
,
"all"
)
==
0
)
puts
(
options
.
action_string
);
puts
(
options
.
action_string
);
successResult
=
HandleSlashCmds
(
options
.
action_string
,
NULL
,
NULL
)
!=
CMD_ERROR
successResult
=
HandleSlashCmds
(
options
.
action_string
,
NULL
,
NULL
,
NULL
)
!=
CMD_ERROR
?
EXIT_SUCCESS
:
EXIT_FAILURE
;
?
EXIT_SUCCESS
:
EXIT_FAILURE
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment