Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 is currently offline  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

Previous Topic: OleDB x64 cannot be built
Next Topic: MSSQL strange problem and ugly workaround patch...
Goto Forum:
  


Current Time: Thu Mar 28 12:58:58 CET 2024

Total time taken to generate the page: 0.00934 seconds