Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.5.0b4

Bug #16405 Compatibility issues with escaped strings
Submitted: 2009-07-05 16:31 UTC Modified: 2009-08-02 09:41 UTC
From: hschletz Assigned: hschletz
Status: Closed Package: MDB2_Driver_pgsql (version 1.5.0b2)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  



Patch enforce_escapes_in_normal_quotes Revisions
Revision 2009-07-05 16:32 UTC
Developer hschletz
 
Download patch

diff -ru MDB2.orig/Driver/pgsql.php MDB2/Driver/pgsql.php
--- MDB2.orig/Driver/pgsql.php	2009-01-14 17:39:15.000000000 +0100
+++ MDB2/Driver/pgsql.php	2009-07-05 17:01:07.107318411 +0200
@@ -452,6 +452,27 @@
             }
         }
 
+        // Enable extra compatibility settings on 8.2 and later
+        $version = pg_parameter_status($connection, 'server_version');
+        if ($version == false) {
+            return $this->raiseError(null, null, null,
+                'Unable to retrieve server version', __FUNCTION__);
+        }
+        $version = explode ('.', $version);
+        if (    $version['0'] > 8
+            || ($version['0'] == 8 && $version['1'] >= 2)
+        ) {
+            if (!@pg_query($connection, "SET SESSION STANDARD_CONFORMING_STRINGS = OFF")) {
+                return $this->raiseError(null, null, null,
+                    'Unable to set standard_conforming_strings to off', __FUNCTION__);
+            }
+
+            if (!@pg_query($connection, "SET SESSION ESCAPE_STRING_WARNING = OFF")) {
+                return $this->raiseError(null, null, null,
+                    'Unable to set escape_string_warning to off', __FUNCTION__);
+            }
+        }
+
         return $connection;
     }