1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-27 23:21:58 +03:00

Add E'' to internally created SQL strings that contain backslashes.

Improve code clarity by using macros for E'' processing.
This commit is contained in:
Bruce Momjian
2005-07-02 17:01:59 +00:00
parent 654efe6aaa
commit 74b49a8129
12 changed files with 91 additions and 89 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.169 2005/06/12 00:00:21 neilc Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-exec.c,v 1.170 2005/07/02 17:01:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -2368,23 +2368,9 @@ PQescapeString(char *to, const char *from, size_t length)
while (remaining > 0 && *source != '\0')
{
switch (*source)
{
case '\\':
*target++ = '\\';
*target++ = '\\';
break;
case '\'':
*target++ = '\'';
*target++ = '\'';
break;
default:
*target++ = *source;
break;
}
source++;
if (SQL_STR_DOUBLE(*source))
*target++ = *source;
*target++ = *source++;
remaining--;
}
@ -2449,7 +2435,7 @@ PQescapeBytea(const unsigned char *bintext, size_t binlen, size_t *bytealen)
}
else if (*vp == '\'')
{
rp[0] = '\\';
rp[0] = '\'';
rp[1] = '\'';
rp += 2;
}