From e5deaae52880e7ddb7efab0b190e5f5c750f55c4 Mon Sep 17 00:00:00 2001 From: alecpl Date: Mon, 12 May 2008 12:19:32 +0000 Subject: - Updated PEAR::DB package to version 1.7.13 --- program/lib/DB/ibase.php | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'program/lib/DB/ibase.php') diff --git a/program/lib/DB/ibase.php b/program/lib/DB/ibase.php index b5e2386a0..913fbf3eb 100644 --- a/program/lib/DB/ibase.php +++ b/program/lib/DB/ibase.php @@ -21,7 +21,7 @@ * @package DB * @author Sterling Hughes * @author Daniel Convissor - * @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 @@ require_once 'DB/common.php'; * @package DB * @author Sterling Hughes * @author Daniel Convissor - * @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 @@ class DB_ibase extends DB_common -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 @@ class DB_ibase extends DB_common */ 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 @@ class DB_ibase extends DB_common */ function freeResult($result) { - return @ibase_free_result($result); + return is_resource($result) ? ibase_free_result($result) : false; } // }}} @@ -420,8 +421,7 @@ class DB_ibase extends DB_common function freeQuery($query) { - @ibase_free_query($query); - return true; + return is_resource($query) ? ibase_free_query($query) : false; } // }}} @@ -521,8 +521,14 @@ class DB_ibase extends DB_common $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 @@ class DB_ibase extends DB_common $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 @@ class DB_ibase extends DB_common } 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 @@ class DB_ibase extends DB_common $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 @@ class DB_ibase extends DB_common @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 @@ class DB_ibase extends DB_common $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 @@ class DB_ibase extends DB_common 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 @@ class DB_ibase extends DB_common => DB_ERROR_ACCESS_VIOLATION, '/arithmetic exception, numeric overflow, or string truncation/i' => DB_ERROR_INVALID, + '/feature is not supported/i' + => DB_ERROR_NOT_CAPABLE, ); } -- cgit v1.2.3