Commit 7c5ac5ce authored by Bruce Momjian's avatar Bruce Momjian

Separate prepared statement and bind parameters with comma.

Fix printing of NULL bind parameters, use "NULL".
parent 5f6f70a0
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.501 2006/08/29 02:32:41 momjian Exp $ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.502 2006/08/29 20:10:42 momjian Exp $
* *
* NOTES * NOTES
* this is the "main" module of the postgres backend and * this is the "main" module of the postgres backend and
...@@ -1539,17 +1539,23 @@ exec_bind_message(StringInfo input_message) ...@@ -1539,17 +1539,23 @@ exec_bind_message(StringInfo input_message)
-1); -1);
/* Save the parameter values */ /* Save the parameter values */
appendStringInfo(&bind_values_str, "%s$%d = '", appendStringInfo(&bind_values_str, "%s$%d = ",
bind_values_str.len ? ", " : "", bind_values_str.len ? ", " : "",
paramno + 1); paramno + 1);
for (p = pstring; *p; p++) if (pstring)
{ {
if (*p == '\'') /* double single quotes */ appendStringInfoChar(&bind_values_str, '\'');
for (p = pstring; *p; p++)
{
if (*p == '\'') /* double single quotes */
appendStringInfoChar(&bind_values_str, *p);
appendStringInfoChar(&bind_values_str, *p); appendStringInfoChar(&bind_values_str, *p);
appendStringInfoChar(&bind_values_str, *p); }
appendStringInfoChar(&bind_values_str, '\'');
} }
appendStringInfoChar(&bind_values_str, '\''); else
appendStringInfo(&bind_values_str, "NULL");
/* Free result of encoding conversion, if any */ /* Free result of encoding conversion, if any */
if (pstring && pstring != pbuf.data) if (pstring && pstring != pbuf.data)
pfree(pstring); pfree(pstring);
...@@ -1782,7 +1788,7 @@ exec_execute_message(const char *portal_name, long max_rows) ...@@ -1782,7 +1788,7 @@ exec_execute_message(const char *portal_name, long max_rows)
*portal_name ? portal_name : ""), *portal_name ? portal_name : ""),
errdetail("prepare: %s%s%s", sourceText, errdetail("prepare: %s%s%s", sourceText,
/* optionally print bind parameters */ /* optionally print bind parameters */
bindText ? " bind: " : "", bindText ? ", bind: " : "",
bindText ? bindText : ""))); bindText ? bindText : "")));
BeginCommand(portal->commandTag, dest); BeginCommand(portal->commandTag, dest);
...@@ -1896,7 +1902,7 @@ exec_execute_message(const char *portal_name, long max_rows) ...@@ -1896,7 +1902,7 @@ exec_execute_message(const char *portal_name, long max_rows)
*portal_name ? portal_name : ""), *portal_name ? portal_name : ""),
errdetail("prepare: %s%s%s", sourceText, errdetail("prepare: %s%s%s", sourceText,
/* optionally print bind parameters */ /* optionally print bind parameters */
bindText ? " bind: " : "", bindText ? ", bind: " : "",
bindText ? bindText : ""))); bindText ? bindText : "")));
} }
} }
......
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