|
8 | 8 | * |
9 | 9 | * |
10 | 10 | * 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 $ |
12 | 12 | * |
13 | 13 | * NOTES |
14 | 14 | * this is the "main" module of the postgres backend and |
@@ -1539,17 +1539,23 @@ exec_bind_message(StringInfo input_message) |
1539 | 1539 | -1); |
1540 | 1540 |
|
1541 | 1541 | /* Save the parameter values */ |
1542 | | -appendStringInfo(&bind_values_str,"%s$%d ='", |
| 1542 | +appendStringInfo(&bind_values_str,"%s$%d = ", |
1543 | 1543 | bind_values_str.len ?", " :"", |
1544 | 1544 | paramno+1); |
1545 | | -for (p=pstring;*p;p++) |
| 1545 | +if (pstring) |
1546 | 1546 | { |
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); |
1548 | 1552 | appendStringInfoChar(&bind_values_str,*p); |
1549 | | -appendStringInfoChar(&bind_values_str,*p); |
| 1553 | +} |
| 1554 | +appendStringInfoChar(&bind_values_str,'\''); |
1550 | 1555 | } |
1551 | | -appendStringInfoChar(&bind_values_str,'\''); |
1552 | | - |
| 1556 | +else |
| 1557 | +appendStringInfo(&bind_values_str,"NULL"); |
| 1558 | + |
1553 | 1559 | /* Free result of encoding conversion, if any */ |
1554 | 1560 | if (pstring&&pstring!=pbuf.data) |
1555 | 1561 | pfree(pstring); |
@@ -1782,7 +1788,7 @@ exec_execute_message(const char *portal_name, long max_rows) |
1782 | 1788 | *portal_name ?portal_name :""), |
1783 | 1789 | errdetail("prepare: %s%s%s",sourceText, |
1784 | 1790 | /* optionally print bind parameters */ |
1785 | | -bindText ?" bind: " :"", |
| 1791 | +bindText ?", bind: " :"", |
1786 | 1792 | bindText ?bindText :""))); |
1787 | 1793 |
|
1788 | 1794 | BeginCommand(portal->commandTag,dest); |
@@ -1896,7 +1902,7 @@ exec_execute_message(const char *portal_name, long max_rows) |
1896 | 1902 | *portal_name ?portal_name :""), |
1897 | 1903 | errdetail("prepare: %s%s%s",sourceText, |
1898 | 1904 | /* optionally print bind parameters */ |
1899 | | -bindText ?" bind: " :"", |
| 1905 | +bindText ?", bind: " :"", |
1900 | 1906 | bindText ?bindText :""))); |
1901 | 1907 | } |
1902 | 1908 | } |
|