diff options
author | Michael Meskes <meskes@postgresql.org> | 2008-03-20 16:04:52 +0000 |
---|---|---|
committer | Michael Meskes <meskes@postgresql.org> | 2008-03-20 16:04:52 +0000 |
commit | 6a78d754d0bcc56e516fcc8db67149dc1031dd91 (patch) | |
tree | 05b4b9b7f13a990b986fd60725e77df77520628b /src/interfaces/ecpg/preproc/output.c | |
parent | 59c4fc5a80d398615d6edf45d742148d0956235f (diff) | |
download | postgresql-6a78d754d0bcc56e516fcc8db67149dc1031dd91.tar.gz postgresql-6a78d754d0bcc56e516fcc8db67149dc1031dd91.zip |
Changed statement escaping to not escape continuation line markers.
Bumped precompiler patchlevel.
Diffstat (limited to 'src/interfaces/ecpg/preproc/output.c')
-rw-r--r-- | src/interfaces/ecpg/preproc/output.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/interfaces/ecpg/preproc/output.c b/src/interfaces/ecpg/preproc/output.c index 74da49a0d20..e58a75212d7 100644 --- a/src/interfaces/ecpg/preproc/output.c +++ b/src/interfaces/ecpg/preproc/output.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/output.c,v 1.23 2007/11/15 21:14:45 momjian Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/output.c,v 1.23.2.1 2008/03/20 16:04:52 meskes Exp $ */ #include "postgres_fe.h" @@ -193,7 +193,18 @@ output_escaped_str(char *str, bool quoted) else if (str[i] == '\n') fputs("\\\n", yyout); else if (str[i] == '\\') - fputs("\\\\", yyout); + { + int j = i; + + /* check whether this is a continuation line + * if it is, do not output anything because newlines are escaped anyway */ + + /* accept blanks after the '\' as some other compilers do too */ + do { j++; } while (str[j] == ' ' || str[j] == '\t'); + + if ((str[j] != '\n') && (str[j] != '\r' || str[j + 1] != '\n')) /* not followed by a newline */ + fputs("\\\\", yyout); + } else if (str[i] == '\r' && str[i + 1] == '\n') { fputs("\\\r\n", yyout); |