Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7c5ac5c

Browse files
committed
Separate prepared statement and bind parameters with comma.
Fix printing of NULL bind parameters, use "NULL".
1 parent5f6f70a commit7c5ac5c

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.501 2006/08/2902:32:41 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.502 2006/08/2920:10:42 momjian Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1539,17 +1539,23 @@ exec_bind_message(StringInfo input_message)
15391539
-1);
15401540

15411541
/* Save the parameter values */
1542-
appendStringInfo(&bind_values_str,"%s$%d ='",
1542+
appendStringInfo(&bind_values_str,"%s$%d = ",
15431543
bind_values_str.len ?", " :"",
15441544
paramno+1);
1545-
for (p=pstring;*p;p++)
1545+
if (pstring)
15461546
{
1547-
if (*p=='\'')/* double single quotes */
1547+
appendStringInfoChar(&bind_values_str,'\'');
1548+
for (p=pstring;*p;p++)
1549+
{
1550+
if (*p=='\'')/* double single quotes */
1551+
appendStringInfoChar(&bind_values_str,*p);
15481552
appendStringInfoChar(&bind_values_str,*p);
1549-
appendStringInfoChar(&bind_values_str,*p);
1553+
}
1554+
appendStringInfoChar(&bind_values_str,'\'');
15501555
}
1551-
appendStringInfoChar(&bind_values_str,'\'');
1552-
1556+
else
1557+
appendStringInfo(&bind_values_str,"NULL");
1558+
15531559
/* Free result of encoding conversion, if any */
15541560
if (pstring&&pstring!=pbuf.data)
15551561
pfree(pstring);
@@ -1782,7 +1788,7 @@ exec_execute_message(const char *portal_name, long max_rows)
17821788
*portal_name ?portal_name :""),
17831789
errdetail("prepare: %s%s%s",sourceText,
17841790
/* optionally print bind parameters */
1785-
bindText ?" bind: " :"",
1791+
bindText ?", bind: " :"",
17861792
bindText ?bindText :"")));
17871793

17881794
BeginCommand(portal->commandTag,dest);
@@ -1896,7 +1902,7 @@ exec_execute_message(const char *portal_name, long max_rows)
18961902
*portal_name ?portal_name :""),
18971903
errdetail("prepare: %s%s%s",sourceText,
18981904
/* optionally print bind parameters */
1899-
bindText ?" bind: " :"",
1905+
bindText ?", bind: " :"",
19001906
bindText ?bindText :"")));
19011907
}
19021908
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp