]> git.nbdom.net Git - nb.git/commitdiff
lib/php/db/types/pgsql.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 4 Dec 2017 17:47:47 +0000 (17:47 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 4 Dec 2017 17:47:47 +0000 (17:47 +0000)
lib/php/db/field.php
lib/php/db/types/pgsql.php

index f2e9d4e84b8f4430dc16defc0884a890a5534210..9531690746c36b061373c8e9ab7697defc6e6427 100644 (file)
@@ -215,7 +215,7 @@ class field extends nb {
         if (strpos($this->type,'date') !== false) return 'NULL';
       }
 
-      if (!($db = $this->db())) return "'".preg_replace("/'/","\\'",$value)."'";
+      if (!($db = $this->db())) return "'".preg_replace("/'/","''",$value)."'";
       return $db->quote($value);
 
     } else {
index c55b3d4a50ff91e35c0d724b87d0aef98ffd9021..ff74038b7f5cb3604fbc7f508f830542a742b2e6 100644 (file)
@@ -2,7 +2,13 @@
 $DB_TYPES['pgsql'] = array (
 'extra_where' => 'denorm',
 'regexp' => '~',
-'quote_name' => '"',
+# NB 04.12.17 'quote_name' => '"',
+# NB 04.12.17 'quote' => function($str) {
+# NB 04.12.17   global $DB_TYPES;
+# NB 04.12.17   $chr = $DB_TYPES['pgsql']['quote_name'];
+# NB 04.12.17   str_replace($chr,$chr.$chr,$str);
+# NB 04.12.17   return $chr . $str . $chr;
+# NB 04.12.17 },
 
 'localFile' => array (getenv('HOME').'/.pgpass','^[^:]+:[^:]+:<D.NAME>:(?P<user>[^:]+):(?<password>[^:]+)'),