diff options
author | Bruce Momjian <bruce@momjian.us> | 1998-08-29 04:05:46 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 1998-08-29 04:05:46 +0000 |
commit | a060d5bedf67aec472bd3bfc55750ee98628b8e7 (patch) | |
tree | 046d704db79cf5507a81815fdffdcc5741ffffb8 /src/bin/psql/psql.c | |
parent | d15c37ca82c28659afb5da3cb50830b4e941a140 (diff) | |
download | postgresql-a060d5bedf67aec472bd3bfc55750ee98628b8e7.tar.gz postgresql-a060d5bedf67aec472bd3bfc55750ee98628b8e7.zip |
Hello!
Here is a new patch for libpq, to make it work on Win32 again (since
the latest modifications broke it a little).
Please also add the file "libpq.rc" to the interfaces/libpq directory.
This will allow version-stamping of the generated DLL file, so that
automatic install programs (and interested users) can determine
the version of the file. The file is currently set as "prerelease".
Before the release, somebody should change the line "FILEFLAGS
VS_FF_PRERELEASE" to "FILEFLAGS 0". That information should probably
go into toos\RELEASE_CHANGES.
The patch is against the cvs as of ~ 1998-08-26 14:30 CEST.
//Magnus
Diffstat (limited to 'src/bin/psql/psql.c')
-rw-r--r-- | src/bin/psql/psql.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/bin/psql/psql.c b/src/bin/psql/psql.c index d9c3fd1e5ee..715fb50a2c9 100644 --- a/src/bin/psql/psql.c +++ b/src/bin/psql/psql.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.156 1998/08/27 13:25:18 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.157 1998/08/29 04:05:39 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -89,7 +89,8 @@ char *__progname = "psql"; #define PROMPT_READY '=' #define PROMPT_CONTINUE '-' #define PROMPT_COMMENT '*' -#define PROMPT_QUOTE '\'' +#define PROMPT_SINGLEQUOTE '\'' +#define PROMPT_DOUBLEQUOTE '"' /* Backslash command handling: * 0 - send currently constructed query to backend (i.e. we got a \g) @@ -2310,7 +2311,7 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source) /* We've reached the end of our command input. */ bool success; - bool in_quote; + char in_quote; /* == 0 for no in_quote */ bool was_bslash; /* backslash */ int paren_level; char *query_start; @@ -2380,8 +2381,10 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source) { if (interactive && !pset->quiet) { - if (in_quote) - pset->prompt[strlen(pset->prompt) - 3] = PROMPT_QUOTE; + if (in_quote && in_quote == PROMPT_SINGLEQUOTE) + pset->prompt[strlen(pset->prompt) - 3] = PROMPT_SINGLEQUOTE; + else if (in_quote && in_quote == PROMPT_DOUBLEQUOTE) + pset->prompt[strlen(pset->prompt) - 3] = PROMPT_DOUBLEQUOTE; else if (xcomment != NULL) pset->prompt[strlen(pset->prompt) - 3] = PROMPT_COMMENT; else if (query[0] != '\0' && !querySent) @@ -2500,7 +2503,7 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source) was_bslash = true; /* inside a quote? */ - if (in_quote && (line[i] != '\'' || was_bslash)) + if (in_quote && (line[i] != in_quote || was_bslash)) /* do nothing */ ; else if (xcomment != NULL) /* inside an extended * comment? */ @@ -2548,8 +2551,10 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source) line[i] = '\0'; /* remove comment */ break; } - else if (line[i] == '\'') - in_quote ^= 1; + else if (in_quote && line[i] == in_quote) + in_quote = false; + else if (!in_quote && (line[i] == '\'' || line[i] == '"')) + in_quote = line[i]; /* semi-colon? then send query now */ else if (!paren_level && line[i] == ';') { |