| version 1.2, 2005/11/07 20:37:24 |
version 1.3, 2011/06/17 13:56:39 |
|
|
| * @package DB |
* @package DB |
| * @author Sterling Hughes <sterling@php.net> |
* @author Sterling Hughes <sterling@php.net> |
| * @author Daniel Convissor <danielc@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 |
* @license http://www.php.net/license/3_0.txt PHP License 3.0 |
| * @version CVS: $Id$ |
* @version CVS: $Id$ |
| * @link http://pear.php.net/package/DB |
* @link http://pear.php.net/package/DB |
| Line 47 require_once 'DB/common.php'; |
|
| Line 47 require_once 'DB/common.php'; |
|
| * @package DB |
* @package DB |
| * @author Sterling Hughes <sterling@php.net> |
* @author Sterling Hughes <sterling@php.net> |
| * @author Daniel Convissor <danielc@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 |
* @license http://www.php.net/license/3_0.txt PHP License 3.0 |
| * @version Release: 1.7.6 |
* @version Release: 1.7.14RC2 |
| * @link http://pear.php.net/package/DB |
* @link http://pear.php.net/package/DB |
| * @since Class became stable in Release 1.7.0 |
* @since Class became stable in Release 1.7.0 |
| */ |
*/ |
| Line 123 class DB_ibase extends DB_common |
|
| Line 123 class DB_ibase extends DB_common |
|
| -625 => DB_ERROR_CONSTRAINT_NOT_NULL, |
-625 => DB_ERROR_CONSTRAINT_NOT_NULL, |
| -803 => DB_ERROR_CONSTRAINT, |
-803 => DB_ERROR_CONSTRAINT, |
| -804 => DB_ERROR_VALUE_COUNT_ON_ROW, |
-804 => DB_ERROR_VALUE_COUNT_ON_ROW, |
| |
// -902 => // Covers too many errors, need to use regex on msg |
| -904 => DB_ERROR_CONNECT_FAILED, |
-904 => DB_ERROR_CONNECT_FAILED, |
| -922 => DB_ERROR_NOSUCHDB, |
-922 => DB_ERROR_NOSUCHDB, |
| -923 => DB_ERROR_CONNECT_FAILED, |
-923 => DB_ERROR_CONNECT_FAILED, |
| Line 275 class DB_ibase extends DB_common |
|
| Line 276 class DB_ibase extends DB_common |
|
| */ |
*/ |
| function simpleQuery($query) |
function simpleQuery($query) |
| { |
{ |
| $ismanip = DB::isManip($query); |
$ismanip = $this->_checkManip($query); |
| $this->last_query = $query; |
$this->last_query = $query; |
| $query = $this->modifyQuery($query); |
$query = $this->modifyQuery($query); |
| $result = @ibase_query($this->connection, $query); |
$result = @ibase_query($this->connection, $query); |
| Line 412 class DB_ibase extends DB_common |
|
| Line 413 class DB_ibase extends DB_common |
|
| */ |
*/ |
| function freeResult($result) |
function freeResult($result) |
| { |
{ |
| return @ibase_free_result($result); |
return is_resource($result) ? ibase_free_result($result) : false; |
| } |
} |
| |
|
| // }}} |
// }}} |
| Line 420 class DB_ibase extends DB_common |
|
| Line 421 class DB_ibase extends DB_common |
|
| |
|
| function freeQuery($query) |
function freeQuery($query) |
| { |
{ |
| @ibase_free_query($query); |
return is_resource($query) ? ibase_free_query($query) : false; |
| return true; |
|
| } |
} |
| |
|
| // }}} |
// }}} |
| Line 521 class DB_ibase extends DB_common |
|
| Line 521 class DB_ibase extends DB_common |
|
| $this->last_query = $query; |
$this->last_query = $query; |
| $newquery = $this->modifyQuery($newquery); |
$newquery = $this->modifyQuery($newquery); |
| $stmt = @ibase_prepare($this->connection, $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; |
return $stmt; |
| } |
} |
| |
|
| Line 547 class DB_ibase extends DB_common |
|
| Line 553 class DB_ibase extends DB_common |
|
| $data = (array)$data; |
$data = (array)$data; |
| $this->last_parameters = $data; |
$this->last_parameters = $data; |
| |
|
| $types =& $this->prepare_types[(int)$stmt]; |
$types = $this->prepare_types[(int)$stmt]; |
| if (count($types) != count($data)) { |
if (count($types) != count($data)) { |
| $tmp =& $this->raiseError(DB_ERROR_MISMATCH); |
$tmp = $this->raiseError(DB_ERROR_MISMATCH); |
| return $tmp; |
return $tmp; |
| } |
} |
| |
|
| Line 568 class DB_ibase extends DB_common |
|
| Line 574 class DB_ibase extends DB_common |
|
| } elseif ($types[$i] == DB_PARAM_OPAQUE) { |
} elseif ($types[$i] == DB_PARAM_OPAQUE) { |
| $fp = @fopen($data[$key], 'rb'); |
$fp = @fopen($data[$key], 'rb'); |
| if (!$fp) { |
if (!$fp) { |
| $tmp =& $this->raiseError(DB_ERROR_ACCESS_VIOLATION); |
$tmp = $this->raiseError(DB_ERROR_ACCESS_VIOLATION); |
| return $tmp; |
return $tmp; |
| } |
} |
| $data[$key] = fread($fp, filesize($data[$key])); |
$data[$key] = fread($fp, filesize($data[$key])); |
| Line 581 class DB_ibase extends DB_common |
|
| Line 587 class DB_ibase extends DB_common |
|
| |
|
| $res = call_user_func_array('ibase_execute', $data); |
$res = call_user_func_array('ibase_execute', $data); |
| if (!$res) { |
if (!$res) { |
| $tmp =& $this->ibaseRaiseError(); |
$tmp = $this->ibaseRaiseError(); |
| return $tmp; |
return $tmp; |
| } |
} |
| /* XXX need this? |
/* XXX need this? |
| Line 589 class DB_ibase extends DB_common |
|
| Line 595 class DB_ibase extends DB_common |
|
| @ibase_commit($this->connection); |
@ibase_commit($this->connection); |
| }*/ |
}*/ |
| $this->last_stmt = $stmt; |
$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; |
$tmp = DB_OK; |
| } else { |
} else { |
| $tmp =& new DB_result($this, $res); |
$this->_last_query_manip = false; |
| |
$tmp = new DB_result($this, $res); |
| } |
} |
| return $tmp; |
return $tmp; |
| } |
} |
| Line 698 class DB_ibase extends DB_common |
|
| Line 707 class DB_ibase extends DB_common |
|
| $repeat = 0; |
$repeat = 0; |
| do { |
do { |
| $this->pushErrorHandling(PEAR_ERROR_RETURN); |
$this->pushErrorHandling(PEAR_ERROR_RETURN); |
| $result =& $this->query("SELECT GEN_ID(${sqn}, 1) " |
$result = $this->query("SELECT GEN_ID(${sqn}, 1) " |
| . 'FROM RDB$GENERATORS ' |
. 'FROM RDB$GENERATORS ' |
| . "WHERE RDB\$GENERATOR_NAME='${sqn}'"); |
. "WHERE RDB\$GENERATOR_NAME='${sqn}'"); |
| $this->popErrorHandling(); |
$this->popErrorHandling(); |
| Line 856 class DB_ibase extends DB_common |
|
| Line 865 class DB_ibase extends DB_common |
|
| if ($errno === null) { |
if ($errno === null) { |
| $errno = $this->errorCode($this->errorNative()); |
$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; |
return $tmp; |
| } |
} |
| |
|
| Line 907 class DB_ibase extends DB_common |
|
| Line 916 class DB_ibase extends DB_common |
|
| $error_regexps = array( |
$error_regexps = array( |
| '/generator .* is not defined/' |
'/generator .* is not defined/' |
| => DB_ERROR_SYNTAX, // for compat. w ibase_errcode() |
=> DB_ERROR_SYNTAX, // for compat. w ibase_errcode() |
| |
'/violation of [\w ]+ constraint/i' |
| |
=> DB_ERROR_CONSTRAINT, |
| '/table.*(not exist|not found|unknown)/i' |
'/table.*(not exist|not found|unknown)/i' |
| => DB_ERROR_NOSUCHTABLE, |
=> DB_ERROR_NOSUCHTABLE, |
| '/table .* already exists/i' |
'/table .* already exists/i' |
| Line 917 class DB_ibase extends DB_common |
|
| Line 928 class DB_ibase extends DB_common |
|
| => DB_ERROR_NOT_FOUND, |
=> DB_ERROR_NOT_FOUND, |
| '/validation error for column .* value "\*\*\* null/i' |
'/validation error for column .* value "\*\*\* null/i' |
| => DB_ERROR_CONSTRAINT_NOT_NULL, |
=> DB_ERROR_CONSTRAINT_NOT_NULL, |
| '/violation of [\w ]+ constraint/i' |
|
| => DB_ERROR_CONSTRAINT, |
|
| '/conversion error from string/i' |
'/conversion error from string/i' |
| => DB_ERROR_INVALID_NUMBER, |
=> DB_ERROR_INVALID_NUMBER, |
| '/no permission for/i' |
'/no permission for/i' |
| => DB_ERROR_ACCESS_VIOLATION, |
=> DB_ERROR_ACCESS_VIOLATION, |
| '/arithmetic exception, numeric overflow, or string truncation/i' |
'/arithmetic exception, numeric overflow, or string truncation/i' |
| => DB_ERROR_INVALID, |
=> DB_ERROR_INVALID, |
| |
'/feature is not supported/i' |
| |
=> DB_ERROR_NOT_CAPABLE, |
| ); |
); |
| } |
} |
| |
|