Home » U++ Library support » U++ SQL » PostgreSQL string insert fix [with patch]
PostgreSQL string insert fix [with patch] [message #20195] |
Tue, 24 February 2009 14:10 |
phirox
Messages: 49 Registered: December 2007
|
Member |
|
|
A small bug with the latest postgres, soon the variable "standard_conforming_strings" will be default on(which is off right now and in previous versions). This will prevent escaping characters in any string. The fix is to insert using E'text' instead of 'text'.
Also the escaping of the " and \ character must also be done for PGSQL and not only MY_SQL.
Patch:
--- SqlCase.cpp (revision 1061)
+++ SqlCase.cpp (working copy)
@@ -134,6 +134,8 @@
*r << "NULL";
break;
}
+ if(dialect == PGSQL)
+ r->Cat('E');
r->Cat('\'');
for(const char *q = x; *q; q++) {
if(*q == '\'') {
@@ -144,7 +146,7 @@
else
r->Cat("\'\'");
} else {
- if((*q == '\"' || *q == '\\') && dialect == MY_SQL)
+ if((*q == '\"' || *q == '\\'))
r->Cat('\\');
r->Cat(*q);
}
[Updated on: Thu, 16 April 2009 17:26] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu Jun 26 15:51:08 CEST 2025
Total time taken to generate the page: 0.04225 seconds
|