Commit 15364ea0 authored by Michael Meskes's avatar Michael Meskes

Changed statement escaping to not escape continuation line markers.

parent f4b7624e
...@@ -2327,3 +2327,8 @@ Sun, 02 Mar 2008 11:50:48 +0100 ...@@ -2327,3 +2327,8 @@ Sun, 02 Mar 2008 11:50:48 +0100
- Fixed bug that caused arrays of varchar to be output with incomplete - Fixed bug that caused arrays of varchar to be output with incomplete
name. name.
Thu, 20 Mar 2008 16:54:27 +0100
- Changed statement escaping to not escape continuation line markers.
/* $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.24 2008/03/20 15:56:59 meskes Exp $ */
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -193,7 +193,18 @@ output_escaped_str(char *str, bool quoted) ...@@ -193,7 +193,18 @@ output_escaped_str(char *str, bool quoted)
else if (str[i] == '\n') else if (str[i] == '\n')
fputs("\\\n", yyout); fputs("\\\n", yyout);
else if (str[i] == '\\') else if (str[i] == '\\')
{
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); fputs("\\\\", yyout);
}
else if (str[i] == '\r' && str[i + 1] == '\n') else if (str[i] == '\r' && str[i + 1] == '\n')
{ {
fputs("\\\r\n", yyout); fputs("\\\r\n", yyout);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment