Skip to content

Commit 15364ea

Browse files
author
Michael Meskes
committed
Changed statement escaping to not escape continuation line markers.
1 parent f4b7624 commit 15364ea

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,3 +2327,8 @@ Sun, 02 Mar 2008 11:50:48 +0100
23272327

23282328
- Fixed bug that caused arrays of varchar to be output with incomplete
23292329
name.
2330+
2331+
Thu, 20 Mar 2008 16:54:27 +0100
2332+
2333+
- Changed statement escaping to not escape continuation line markers.
2334+

src/interfaces/ecpg/preproc/output.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/output.c,v 1.23 2007/11/15 21:14:45 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/output.c,v 1.24 2008/03/20 15:56:59 meskes Exp $ */
22

33
#include "postgres_fe.h"
44

@@ -193,7 +193,18 @@ output_escaped_str(char *str, bool quoted)
193193
else if (str[i] == '\n')
194194
fputs("\\\n", yyout);
195195
else if (str[i] == '\\')
196-
fputs("\\\\", yyout);
196+
{
197+
int j = i;
198+
199+
/* check whether this is a continuation line
200+
* if it is, do not output anything because newlines are escaped anyway */
201+
202+
/* accept blanks after the '\' as some other compilers do too */
203+
do { j++; } while (str[j] == ' ' || str[j] == '\t');
204+
205+
if ((str[j] != '\n') && (str[j] != '\r' || str[j + 1] != '\n')) /* not followed by a newline */
206+
fputs("\\\\", yyout);
207+
}
197208
else if (str[i] == '\r' && str[i + 1] == '\n')
198209
{
199210
fputs("\\\r\n", yyout);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy