Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
2f131ca5
Commit
2f131ca5
authored
25 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Fix select '1--2'; for PEter.
parent
a1642132
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/bin/psql/mainloop.c
+32
-24
32 additions, 24 deletions
src/bin/psql/mainloop.c
with
32 additions
and
24 deletions
src/bin/psql/mainloop.c
+
32
−
24
View file @
2f131ca5
...
@@ -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.3
1
2000/06/
29 16:27:57
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/mainloop.c,v 1.3
2
2000/06/
30 18:03:40
momjian Exp $
*/
*/
#include
"postgres.h"
#include
"postgres.h"
#include
"mainloop.h"
#include
"mainloop.h"
...
@@ -44,7 +44,7 @@ MainLoop(FILE *source)
...
@@ -44,7 +44,7 @@ MainLoop(FILE *source)
bool
success
;
bool
success
;
volatile
char
in_quote
;
/* == 0 for no in_quote */
volatile
char
in_quote
;
/* == 0 for no in_quote */
volatile
bool
xcomment
;
/* in extended comment */
volatile
bool
in_
xcomment
;
/* in extended comment */
volatile
int
paren_level
;
volatile
int
paren_level
;
unsigned
int
query_start
;
unsigned
int
query_start
;
volatile
int
count_eof
=
0
;
volatile
int
count_eof
=
0
;
...
@@ -80,7 +80,7 @@ MainLoop(FILE *source)
...
@@ -80,7 +80,7 @@ MainLoop(FILE *source)
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
xcomment
=
false
;
in_
xcomment
=
false
;
in_quote
=
0
;
in_quote
=
0
;
paren_level
=
0
;
paren_level
=
0
;
slashCmdStatus
=
CMD_UNKNOWN
;
/* set default */
slashCmdStatus
=
CMD_UNKNOWN
;
/* set default */
...
@@ -123,7 +123,7 @@ MainLoop(FILE *source)
...
@@ -123,7 +123,7 @@ MainLoop(FILE *source)
resetPQExpBuffer
(
query_buf
);
resetPQExpBuffer
(
query_buf
);
/* reset parsing state */
/* reset parsing state */
xcomment
=
false
;
in_
xcomment
=
false
;
in_quote
=
0
;
in_quote
=
0
;
paren_level
=
0
;
paren_level
=
0
;
count_eof
=
0
;
count_eof
=
0
;
...
@@ -147,7 +147,7 @@ MainLoop(FILE *source)
...
@@ -147,7 +147,7 @@ MainLoop(FILE *source)
line
=
xstrdup
(
query_buf
->
data
);
line
=
xstrdup
(
query_buf
->
data
);
resetPQExpBuffer
(
query_buf
);
resetPQExpBuffer
(
query_buf
);
/* reset parsing state since we are rescanning whole line */
/* reset parsing state since we are rescanning whole line */
xcomment
=
false
;
in_
xcomment
=
false
;
in_quote
=
0
;
in_quote
=
0
;
paren_level
=
0
;
paren_level
=
0
;
slashCmdStatus
=
CMD_UNKNOWN
;
slashCmdStatus
=
CMD_UNKNOWN
;
...
@@ -168,7 +168,7 @@ MainLoop(FILE *source)
...
@@ -168,7 +168,7 @@ MainLoop(FILE *source)
prompt_status
=
PROMPT_SINGLEQUOTE
;
prompt_status
=
PROMPT_SINGLEQUOTE
;
else
if
(
in_quote
&&
in_quote
==
'"'
)
else
if
(
in_quote
&&
in_quote
==
'"'
)
prompt_status
=
PROMPT_DOUBLEQUOTE
;
prompt_status
=
PROMPT_DOUBLEQUOTE
;
else
if
(
xcomment
)
else
if
(
in_
xcomment
)
prompt_status
=
PROMPT_COMMENT
;
prompt_status
=
PROMPT_COMMENT
;
else
if
(
paren_level
)
else
if
(
paren_level
)
prompt_status
=
PROMPT_PAREN
;
prompt_status
=
PROMPT_PAREN
;
...
@@ -296,36 +296,36 @@ MainLoop(FILE *source)
...
@@ -296,36 +296,36 @@ MainLoop(FILE *source)
bslash_count
=
0
;
bslash_count
=
0
;
rescan:
rescan:
/* start of extended comment? */
/*
if
(
line
[
i
]
==
'/'
&&
line
[
i
+
thislen
]
==
'*'
)
* It is important to place the in_* test routines
* before the in_* detection routines.
* i.e. we have to test if we are in a quote before
* testing for comments. bjm 2000-06-30
*/
/* in quote? */
if
(
in_quote
)
{
{
xcomment
=
true
;
/* end of quote */
ADVANCE_1
;
if
(
line
[
i
]
==
in_quote
&&
bslash_count
%
2
==
0
)
in_quote
=
'\0'
;
}
}
/* in extended comment? */
/* in extended comment? */
else
if
(
xcomment
)
else
if
(
in_
xcomment
)
{
{
if
(
line
[
i
]
==
'*'
&&
line
[
i
+
thislen
]
==
'/'
)
if
(
line
[
i
]
==
'*'
&&
line
[
i
+
thislen
]
==
'/'
)
{
{
xcomment
=
false
;
in_
xcomment
=
false
;
ADVANCE_1
;
ADVANCE_1
;
}
}
}
}
/* single-line comment? truncate line */
/* start of extended comment? */
else
if
(
line
[
i
]
==
'-'
&&
line
[
i
+
thislen
]
==
'-'
)
else
if
(
line
[
i
]
==
'/'
&&
line
[
i
+
thislen
]
==
'*'
)
{
line
[
i
]
=
'\0'
;
/* remove comment */
break
;
}
/* in quote? */
else
if
(
in_quote
)
{
{
/* end of quote */
in_xcomment
=
true
;
if
(
line
[
i
]
==
in_quote
&&
bslash_count
%
2
==
0
)
ADVANCE_1
;
in_quote
=
'\0'
;
}
}
/* start of quote */
/* start of quote */
...
@@ -333,6 +333,14 @@ MainLoop(FILE *source)
...
@@ -333,6 +333,14 @@ MainLoop(FILE *source)
(
line
[
i
]
==
'\''
||
line
[
i
]
==
'"'
))
(
line
[
i
]
==
'\''
||
line
[
i
]
==
'"'
))
in_quote
=
line
[
i
];
in_quote
=
line
[
i
];
/* single-line comment? truncate line */
else
if
(
line
[
i
]
==
'-'
&&
line
[
i
+
thislen
]
==
'-'
)
{
line
[
i
]
=
'\0'
;
/* remove comment */
break
;
}
/* count nested parentheses */
/* count nested parentheses */
else
if
(
line
[
i
]
==
'('
)
else
if
(
line
[
i
]
==
'('
)
paren_level
++
;
paren_level
++
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment