Postgres DB fixes
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 26 May 2010 22:11:00 +0000 (16:11 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 27 May 2010 16:44:53 +0000 (10:44 -0600)
framework/Db/lib/Horde/Db/Adapter/Pdo/Pgsql.php
framework/Db/lib/Horde/Db/Adapter/Postgresql/Schema.php

index 07779be..15c6b2b 100644 (file)
@@ -138,8 +138,13 @@ class Horde_Db_Adapter_Pdo_Pgsql extends Horde_Db_Adapter_Pdo_Base
      * @param   int     $idValue
      * @param   string  $sequenceName
      */
-    public function insert($sql, $arg1=null, $arg2=null, $pk=null, $idValue=null, $sequenceName=null)
+    public function insert($sql, $arg1 = null, $arg2 = null, $pk = null,
+                           $idValue = null, $sequenceName = null)
     {
+        if ($this->_write) {
+            return $this->_write->insert($sql, $arg1, $arg2, $pk, $idValue, $sequenceName);
+        }
+
         // Extract the table from the insert sql. Yuck.
         $temp = explode(' ', $sql, 4);
         $table = str_replace('"', '', $temp[2]);
index 53c18e6..7ca6940 100644 (file)
@@ -61,7 +61,7 @@ class Horde_Db_Adapter_Postgresql_Schema extends Horde_Db_Adapter_Base_Schema
         if (!$column)
             return parent::quote($value, $column);
 
-        if (is_string($value) && $column->getType() == 'binary' && method_exists($column, 'stringToBinary')) {
+        if (is_string($value) && ($column->getType() == 'binary')) {
             /*@TODO test blobs/bytea fields with postgres/pdo and figure out how
               this should work */
             return $this->quotedStringPrefix() . "'" . $column->stringToBinary($value) . "'";