From e5deaae52880e7ddb7efab0b190e5f5c750f55c4 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 12 May 2008 08:19:32 -0400
Subject: [PATCH] - Updated PEAR::DB package to version 1.7.13

---
 program/lib/DB/ibase.php |   45 ++++++++++++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/program/lib/DB/ibase.php b/program/lib/DB/ibase.php
index b5e2386..913fbf3 100644
--- a/program/lib/DB/ibase.php
+++ b/program/lib/DB/ibase.php
@@ -21,7 +21,7 @@
  * @package    DB
  * @author     Sterling Hughes <sterling@php.net>
  * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2005 The PHP Group
+ * @copyright  1997-2007 The PHP Group
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
  * @version    CVS: $Id$
  * @link       http://pear.php.net/package/DB
@@ -47,9 +47,9 @@
  * @package    DB
  * @author     Sterling Hughes <sterling@php.net>
  * @author     Daniel Convissor <danielc@php.net>
- * @copyright  1997-2005 The PHP Group
+ * @copyright  1997-2007 The PHP Group
  * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    Release: @package_version@
+ * @version    Release: 1.7.13
  * @link       http://pear.php.net/package/DB
  * @since      Class became stable in Release 1.7.0
  */
@@ -123,6 +123,7 @@
         -625 => DB_ERROR_CONSTRAINT_NOT_NULL,
         -803 => DB_ERROR_CONSTRAINT,
         -804 => DB_ERROR_VALUE_COUNT_ON_ROW,
+        // -902 =>  // Covers too many errors, need to use regex on msg
         -904 => DB_ERROR_CONNECT_FAILED,
         -922 => DB_ERROR_NOSUCHDB,
         -923 => DB_ERROR_CONNECT_FAILED,
@@ -275,7 +276,7 @@
      */
     function simpleQuery($query)
     {
-        $ismanip = DB::isManip($query);
+        $ismanip = $this->_checkManip($query);
         $this->last_query = $query;
         $query = $this->modifyQuery($query);
         $result = @ibase_query($this->connection, $query);
@@ -412,7 +413,7 @@
      */
     function freeResult($result)
     {
-        return @ibase_free_result($result);
+        return is_resource($result) ? ibase_free_result($result) : false;
     }
 
     // }}}
@@ -420,8 +421,7 @@
 
     function freeQuery($query)
     {
-        @ibase_free_query($query);
-        return true;
+        return is_resource($query) ? ibase_free_query($query) : false;
     }
 
     // }}}
@@ -521,8 +521,14 @@
         $this->last_query = $query;
         $newquery = $this->modifyQuery($newquery);
         $stmt = @ibase_prepare($this->connection, $newquery);
-        $this->prepare_types[(int)$stmt] = $types;
-        $this->manip_query[(int)$stmt]   = DB::isManip($query);
+
+        if ($stmt === false) {
+            $stmt = $this->ibaseRaiseError();
+        } else {
+            $this->prepare_types[(int)$stmt] = $types;
+            $this->manip_query[(int)$stmt]   = DB::isManip($query);
+        }
+
         return $stmt;
     }
 
@@ -547,9 +553,9 @@
         $data = (array)$data;
         $this->last_parameters = $data;
 
-        $types =& $this->prepare_types[(int)$stmt];
+        $types = $this->prepare_types[(int)$stmt];
         if (count($types) != count($data)) {
-            $tmp =& $this->raiseError(DB_ERROR_MISMATCH);
+            $tmp = $this->raiseError(DB_ERROR_MISMATCH);
             return $tmp;
         }
 
@@ -568,7 +574,7 @@
             } elseif ($types[$i] == DB_PARAM_OPAQUE) {
                 $fp = @fopen($data[$key], 'rb');
                 if (!$fp) {
-                    $tmp =& $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
+                    $tmp = $this->raiseError(DB_ERROR_ACCESS_VIOLATION);
                     return $tmp;
                 }
                 $data[$key] = fread($fp, filesize($data[$key]));
@@ -581,7 +587,7 @@
 
         $res = call_user_func_array('ibase_execute', $data);
         if (!$res) {
-            $tmp =& $this->ibaseRaiseError();
+            $tmp = $this->ibaseRaiseError();
             return $tmp;
         }
         /* XXX need this?
@@ -589,10 +595,13 @@
             @ibase_commit($this->connection);
         }*/
         $this->last_stmt = $stmt;
-        if ($this->manip_query[(int)$stmt]) {
+        if ($this->manip_query[(int)$stmt] || $this->_next_query_manip) {
+            $this->_last_query_manip = true;
+            $this->_next_query_manip = false;
             $tmp = DB_OK;
         } else {
-            $tmp =& new DB_result($this, $res);
+            $this->_last_query_manip = false;
+            $tmp = new DB_result($this, $res);
         }
         return $tmp;
     }
@@ -698,7 +707,7 @@
         $repeat = 0;
         do {
             $this->pushErrorHandling(PEAR_ERROR_RETURN);
-            $result =& $this->query("SELECT GEN_ID(${sqn}, 1) "
+            $result = $this->query("SELECT GEN_ID(${sqn}, 1) "
                                    . 'FROM RDB$GENERATORS '
                                    . "WHERE RDB\$GENERATOR_NAME='${sqn}'");
             $this->popErrorHandling();
@@ -856,7 +865,7 @@
         if ($errno === null) {
             $errno = $this->errorCode($this->errorNative());
         }
-        $tmp =& $this->raiseError($errno, null, null, null, @ibase_errmsg());
+        $tmp = $this->raiseError($errno, null, null, null, @ibase_errmsg());
         return $tmp;
     }
 
@@ -925,6 +934,8 @@
                     => DB_ERROR_ACCESS_VIOLATION,
                 '/arithmetic exception, numeric overflow, or string truncation/i'
                     => DB_ERROR_INVALID,
+                '/feature is not supported/i'
+                    => DB_ERROR_NOT_CAPABLE,
             );
         }
 

--
Gitblit v1.9.1