Modification MDB2

This commit is contained in:
Regis Houssin 2007-01-04 00:28:13 +00:00
parent 884c949e18
commit 5d04534e10
2 changed files with 79 additions and 79 deletions

View File

@ -282,7 +282,7 @@ class MDB2
if (is_array($options)) { if (is_array($options)) {
foreach ($options as $option => $value) { foreach ($options as $option => $value) {
$test = $db->setOption($option, $value); $test = $db->setOption($option, $value);
if (PEAR::isError($test)) { if (DOLIPEAR::isError($test)) {
return $test; return $test;
} }
} }
@ -384,14 +384,14 @@ class MDB2
$debug = (!empty($options['debug'])); $debug = (!empty($options['debug']));
$err = MDB2::loadClass($class_name, $debug); $err = MDB2::loadClass($class_name, $debug);
if (PEAR::isError($err)) { if (DOLIPEAR::isError($err)) {
return $err; return $err;
} }
$db =& new $class_name(); $db =& new $class_name();
$db->setDSN($dsninfo); $db->setDSN($dsninfo);
$err = MDB2::setOptions($db, $options); $err = MDB2::setOptions($db, $options);
if (PEAR::isError($err)) { if (DOLIPEAR::isError($err)) {
return $err; return $err;
} }
@ -432,12 +432,12 @@ class MDB2
function &connect($dsn, $options = false) function &connect($dsn, $options = false)
{ {
$db =& MDB2::factory($dsn, $options); $db =& MDB2::factory($dsn, $options);
if (PEAR::isError($db)) { if (DOLIPEAR::isError($db)) {
return $db; return $db;
} }
$err = $db->connect(); $err = $db->connect();
if (PEAR::isError($err)) { if (DOLIPEAR::isError($err)) {
$dsn = $db->getDSN('string', 'xxx'); $dsn = $db->getDSN('string', 'xxx');
$db->disconnect(); $db->disconnect();
$err->addUserInfo($dsn); $err->addUserInfo($dsn);
@ -546,7 +546,7 @@ class MDB2
/** /**
* This method is used to communicate an error and invoke error * This method is used to communicate an error and invoke error
* callbacks etc. Basically a wrapper for PEAR::raiseError * callbacks etc. Basically a wrapper for DOLIDOLIPEAR::raiseError
* without the message string. * without the message string.
* *
* @param mixed int error code * @param mixed int error code
@ -572,7 +572,7 @@ class MDB2
*/ */
function &raiseError($code = null, $mode = null, $options = null, $userinfo = null) function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
{ {
$err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); $err =& DOLIDOLIPEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
return $err; return $err;
} }
@ -741,7 +741,7 @@ class MDB2
return $errorMessages; return $errorMessages;
} }
if (PEAR::isError($value)) { if (DOLIDOLIPEAR::isError($value)) {
$value = $value->getCode(); $value = $value->getCode();
} }
@ -943,7 +943,7 @@ class MDB2
* @category Database * @category Database
* @author Stig Bakken <ssb@fast.no> * @author Stig Bakken <ssb@fast.no>
*/ */
class MDB2_Error extends PEAR_Error class MDB2_Error extends DOLIPEAR_Error
{ {
// {{{ constructor: function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null) // {{{ constructor: function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
@ -975,7 +975,7 @@ class MDB2_Error extends PEAR_Error
* @category Database * @category Database
* @author Lukas Smith <smith@pooteeweet.org> * @author Lukas Smith <smith@pooteeweet.org>
*/ */
class MDB2_Driver_Common extends PEAR class MDB2_Driver_Common extends DOLIPEAR
{ {
// {{{ Variables (Properties) // {{{ Variables (Properties)
@ -1371,7 +1371,7 @@ class MDB2_Driver_Common extends PEAR
/** /**
* This method is used to communicate an error and invoke error * This method is used to communicate an error and invoke error
* callbacks etc. Basically a wrapper for PEAR::raiseError * callbacks etc. Basically a wrapper for DOLIDOLIPEAR::raiseError
* without the message string. * without the message string.
* *
* @param mixed integer error code, or a PEAR error object (all other * @param mixed integer error code, or a PEAR error object (all other
@ -1396,8 +1396,8 @@ class MDB2_Driver_Common extends PEAR
{ {
$userinfo = "[Error message: $userinfo]\n"; $userinfo = "[Error message: $userinfo]\n";
// The error is yet a MDB2 error object // The error is yet a MDB2 error object
if (PEAR::isError($code)) { if (DOLIDOLIPEAR::isError($code)) {
// because we use the static PEAR::raiseError, our global // because we use the static DOLIDOLIPEAR::raiseError, our global
// handler should be used if it is set // handler should be used if it is set
if (is_null($mode) && !empty($this->_default_error_mode)) { if (is_null($mode) && !empty($this->_default_error_mode)) {
$mode = $this->_default_error_mode; $mode = $this->_default_error_mode;
@ -1424,7 +1424,7 @@ class MDB2_Driver_Common extends PEAR
} }
} }
$err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); $err =& DOLIDOLIPEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
if ($err->getMode() !== PEAR_ERROR_RETURN if ($err->getMode() !== PEAR_ERROR_RETURN
&& isset($this->nested_transaction_counter) && !$this->has_transaction_error) { && isset($this->nested_transaction_counter) && !$this->has_transaction_error) {
$this->has_transaction_error =& $err; $this->has_transaction_error =& $err;
@ -1718,7 +1718,7 @@ class MDB2_Driver_Common extends PEAR
function getConnection() function getConnection()
{ {
$result = $this->connect(); $result = $this->connect();
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
return $this->connection; return $this->connection;
@ -1845,7 +1845,7 @@ class MDB2_Driver_Common extends PEAR
} }
$err = MDB2::loadClass($class_name, $this->getOption('debug')); $err = MDB2::loadClass($class_name, $this->getOption('debug'));
if (PEAR::isError($err)) { if (DOLIDOLIPEAR::isError($err)) {
return $err; return $err;
} }
@ -1856,7 +1856,7 @@ class MDB2_Driver_Common extends PEAR
if ($class_name != $class_name_new) { if ($class_name != $class_name_new) {
$class_name = $class_name_new; $class_name = $class_name_new;
$err = MDB2::loadClass($class_name, $this->getOption('debug')); $err = MDB2::loadClass($class_name, $this->getOption('debug'));
if (PEAR::isError($err)) { if (DOLIDOLIPEAR::isError($err)) {
return $err; return $err;
} }
} }
@ -1902,7 +1902,7 @@ class MDB2_Driver_Common extends PEAR
$method = strtolower($match[2]).$match[3]; $method = strtolower($match[2]).$match[3];
if (!isset($this->modules[$module]) || !is_object($this->modules[$module])) { if (!isset($this->modules[$module]) || !is_object($this->modules[$module])) {
$result =& $this->loadModule($module); $result =& $this->loadModule($module);
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
} }
@ -2089,7 +2089,7 @@ class MDB2_Driver_Common extends PEAR
if ($this->supports('savepoints') && $savepoint) { if ($this->supports('savepoints') && $savepoint) {
if ($force_rollback || $this->has_transaction_error) { if ($force_rollback || $this->has_transaction_error) {
$result = $this->rollback($savepoint); $result = $this->rollback($savepoint);
if (!PEAR::isError($result)) { if (!DOLIDOLIPEAR::isError($result)) {
$result = false; $result = false;
$this->has_transaction_error = false; $this->has_transaction_error = false;
} }
@ -2110,7 +2110,7 @@ class MDB2_Driver_Common extends PEAR
if ($this->in_transaction) { if ($this->in_transaction) {
if ($force_rollback || $this->has_transaction_error) { if ($force_rollback || $this->has_transaction_error) {
$result = $this->rollback(); $result = $this->rollback();
if (!PEAR::isError($result)) { if (!DOLIDOLIPEAR::isError($result)) {
$result = false; $result = false;
} }
} else { } else {
@ -2351,12 +2351,12 @@ class MDB2_Driver_Common extends PEAR
$query = $this->_modifyQuery($query, $is_manip, $limit, $offset); $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIDOLIPEAR::isError($connection)) {
return $connection; return $connection;
} }
$result =& $this->_doQuery($query, $is_manip, $connection, false); $result =& $this->_doQuery($query, $is_manip, $connection, false);
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
@ -2407,7 +2407,7 @@ class MDB2_Driver_Common extends PEAR
$this->last_query = $query; $this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre')); $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
if ($result) { if ($result) {
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
$query = $result; $query = $result;
@ -2456,12 +2456,12 @@ class MDB2_Driver_Common extends PEAR
$query = $this->_modifyQuery($query, true, $limit, $offset); $query = $this->_modifyQuery($query, true, $limit, $offset);
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIDOLIPEAR::isError($connection)) {
return $connection; return $connection;
} }
$result =& $this->_doQuery($query, true, $connection, $this->database_name); $result =& $this->_doQuery($query, true, $connection, $this->database_name);
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
@ -2493,12 +2493,12 @@ class MDB2_Driver_Common extends PEAR
$query = $this->_modifyQuery($query, false, $limit, $offset); $query = $this->_modifyQuery($query, false, $limit, $offset);
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIDOLIPEAR::isError($connection)) {
return $connection; return $connection;
} }
$result =& $this->_doQuery($query, false, $connection, $this->database_name); $result =& $this->_doQuery($query, false, $connection, $this->database_name);
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
@ -2531,7 +2531,7 @@ class MDB2_Driver_Common extends PEAR
if ($this->supports('result_introspection')) { if ($this->supports('result_introspection')) {
$this->loadModule('Reverse', null, true); $this->loadModule('Reverse', null, true);
$tableInfo = $this->reverse->tableInfo($result); $tableInfo = $this->reverse->tableInfo($result);
if (PEAR::isError($tableInfo)) { if (DOLIDOLIPEAR::isError($tableInfo)) {
return $tableInfo; return $tableInfo;
} }
$types = array(); $types = array();
@ -2563,7 +2563,7 @@ class MDB2_Driver_Common extends PEAR
} }
if (!empty($types)) { if (!empty($types)) {
$err = $result->setResultTypes($types); $err = $result->setResultTypes($types);
if (PEAR::isError($err)) { if (DOLIDOLIPEAR::isError($err)) {
$result->free(); $result->free();
return $err; return $err;
} }
@ -2664,7 +2664,7 @@ class MDB2_Driver_Common extends PEAR
} }
$col = $this->queryCol($query, $type); $col = $this->queryCol($query, $type);
if (PEAR::isError($col)) { if (DOLIDOLIPEAR::isError($col)) {
return $col; return $col;
} }
if (!is_array($col) || count($col) == 0) { if (!is_array($col) || count($col) == 0) {
@ -2775,38 +2775,38 @@ class MDB2_Driver_Common extends PEAR
$result = null; $result = null;
$in_transaction = $this->in_transaction; $in_transaction = $this->in_transaction;
if (!$in_transaction && PEAR::isError($result = $this->beginTransaction())) { if (!$in_transaction && DOLIDOLIPEAR::isError($result = $this->beginTransaction())) {
return $result; return $result;
} }
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIDOLIPEAR::isError($connection)) {
return $connection; return $connection;
} }
$condition = ' WHERE '.implode(' AND ', $condition); $condition = ' WHERE '.implode(' AND ', $condition);
$query = "DELETE FROM $table$condition"; $query = "DELETE FROM $table$condition";
$result =& $this->_doQuery($query, true, $connection); $result =& $this->_doQuery($query, true, $connection);
if (!PEAR::isError($result)) { if (!DOLIDOLIPEAR::isError($result)) {
$affected_rows = $this->_affectedRows($connection, $result); $affected_rows = $this->_affectedRows($connection, $result);
$insert = implode(', ', array_keys($values)); $insert = implode(', ', array_keys($values));
$values = implode(', ', $values); $values = implode(', ', $values);
$query = "INSERT INTO $table ($insert) VALUES ($values)"; $query = "INSERT INTO $table ($insert) VALUES ($values)";
$result =& $this->_doQuery($query, true, $connection); $result =& $this->_doQuery($query, true, $connection);
if (!PEAR::isError($result)) { if (!DOLIDOLIPEAR::isError($result)) {
$affected_rows += $this->_affectedRows($connection, $result);; $affected_rows += $this->_affectedRows($connection, $result);;
} }
} }
if (!$in_transaction) { if (!$in_transaction) {
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
$this->rollback(); $this->rollback();
} else { } else {
$result = $this->commit(); $result = $this->commit();
} }
} }
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
@ -2846,7 +2846,7 @@ class MDB2_Driver_Common extends PEAR
$this->offset = $this->limit = 0; $this->offset = $this->limit = 0;
$result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre')); $result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre'));
if ($result) { if ($result) {
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
$query = $result; $query = $result;
@ -2876,7 +2876,7 @@ class MDB2_Driver_Common extends PEAR
} }
$new_pos = $this->_skipDelimitedStrings($query, $position, $p_position); $new_pos = $this->_skipDelimitedStrings($query, $position, $p_position);
if (PEAR::isError($new_pos)) { if (DOLIDOLIPEAR::isError($new_pos)) {
return $new_pos; return $new_pos;
} }
if ($new_pos != $position) { if ($new_pos != $position) {
@ -2994,7 +2994,7 @@ class MDB2_Driver_Common extends PEAR
function quote($value, $type = null, $quote = true, $escape_wildcards = false) function quote($value, $type = null, $quote = true, $escape_wildcards = false)
{ {
$result = $this->loadModule('Datatype', null, true); $result = $this->loadModule('Datatype', null, true);
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
@ -3020,7 +3020,7 @@ class MDB2_Driver_Common extends PEAR
function getDeclaration($type, $name, $field) function getDeclaration($type, $name, $field)
{ {
$result = $this->loadModule('Datatype', null, true); $result = $this->loadModule('Datatype', null, true);
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
return $this->datatype->getDeclaration($type, $name, $field); return $this->datatype->getDeclaration($type, $name, $field);
@ -3042,7 +3042,7 @@ class MDB2_Driver_Common extends PEAR
function compareDefinition($current, $previous) function compareDefinition($current, $previous)
{ {
$result = $this->loadModule('Datatype', null, true); $result = $this->loadModule('Datatype', null, true);
if (PEAR::isError($result)) { if (DOLIDOLIPEAR::isError($result)) {
return $result; return $result;
} }
return $this->datatype->compareDefinition($current, $previous); return $this->datatype->compareDefinition($current, $previous);
@ -3391,11 +3391,11 @@ class MDB2_Result_Common extends MDB2_Result
function setResultTypes($types) function setResultTypes($types)
{ {
$load = $this->db->loadModule('Datatype', null, true); $load = $this->db->loadModule('Datatype', null, true);
if (PEAR::isError($load)) { if (DOLIDOLIPEAR::isError($load)) {
return $load; return $load;
} }
$types = $this->db->datatype->checkResultTypes($types); $types = $this->db->datatype->checkResultTypes($types);
if (PEAR::isError($types)) { if (DOLIPEAR::isError($types)) {
return $types; return $types;
} }
$this->types = $types; $this->types = $types;
@ -3464,7 +3464,7 @@ class MDB2_Result_Common extends MDB2_Result
{ {
$fetchmode = is_numeric($colnum) ? MDB2_FETCHMODE_ORDERED : MDB2_FETCHMODE_ASSOC; $fetchmode = is_numeric($colnum) ? MDB2_FETCHMODE_ORDERED : MDB2_FETCHMODE_ASSOC;
$row = $this->fetchRow($fetchmode, $rownum); $row = $this->fetchRow($fetchmode, $rownum);
if (!is_array($row) || PEAR::isError($row)) { if (!is_array($row) || DOLIPEAR::isError($row)) {
return $row; return $row;
} }
if (!array_key_exists($colnum, $row)) { if (!array_key_exists($colnum, $row)) {
@ -3500,7 +3500,7 @@ class MDB2_Result_Common extends MDB2_Result
$column[] = $row[$colnum]; $column[] = $row[$colnum];
} while (is_array($row = $this->fetchRow($fetchmode))); } while (is_array($row = $this->fetchRow($fetchmode)));
} }
if (PEAR::isError($row)) { if (DOLIPEAR::isError($row)) {
return $row; return $row;
} }
return $column; return $column;
@ -3537,7 +3537,7 @@ class MDB2_Result_Common extends MDB2_Result
{ {
$all = array(); $all = array();
$row = $this->fetchRow($fetchmode); $row = $this->fetchRow($fetchmode);
if (PEAR::isError($row)) { if (DOLIPEAR::isError($row)) {
return $row; return $row;
} elseif (!$row) { } elseif (!$row) {
return $all; return $all;
@ -3663,7 +3663,7 @@ class MDB2_Result_Common extends MDB2_Result
{ {
if (!isset($this->column_names)) { if (!isset($this->column_names)) {
$result = $this->_getColumnNames(); $result = $this->_getColumnNames();
if (PEAR::isError($result)) { if (DOLIPEAR::isError($result)) {
return $result; return $result;
} }
$this->column_names = $result; $this->column_names = $result;
@ -3951,7 +3951,7 @@ class MDB2_Statement_Common
$parameters = array_keys($values); $parameters = array_keys($values);
foreach ($parameters as $key => $parameter) { foreach ($parameters as $key => $parameter) {
$err = $this->bindValue($parameter, $values[$parameter], $types[$key]); $err = $this->bindValue($parameter, $values[$parameter], $types[$key]);
if (PEAR::isError($err)) { if (DOLIPEAR::isError($err)) {
return $err; return $err;
} }
} }
@ -4012,7 +4012,7 @@ class MDB2_Statement_Common
$parameters = array_keys($values); $parameters = array_keys($values);
foreach ($parameters as $key => $parameter) { foreach ($parameters as $key => $parameter) {
$err = $this->bindParam($parameter, $values[$parameter], $types[$key]); $err = $this->bindParam($parameter, $values[$parameter], $types[$key]);
if (PEAR::isError($err)) { if (DOLIPEAR::isError($err)) {
return $err; return $err;
} }
} }
@ -4080,7 +4080,7 @@ class MDB2_Statement_Common
} else { } else {
$type = !empty($this->types[$parameter]) ? $this->types[$parameter] : null; $type = !empty($this->types[$parameter]) ? $this->types[$parameter] : null;
$value_quoted = $this->db->quote($value, $type); $value_quoted = $this->db->quote($value, $type);
if (PEAR::isError($value_quoted)) { if (DOLIPEAR::isError($value_quoted)) {
return $value_quoted; return $value_quoted;
} }
} }

View File

@ -190,7 +190,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$text = $this->escapePattern($text); $text = $this->escapePattern($text);
} }
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIPEAR::::isError($connection)) {
return $connection; return $connection;
} }
$text = @mysql_real_escape_string($text, $connection); $text = @mysql_real_escape_string($text, $connection);
@ -231,7 +231,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
} }
$query = $this->start_transaction ? 'START TRANSACTION' : 'SET AUTOCOMMIT = 1'; $query = $this->start_transaction ? 'START TRANSACTION' : 'SET AUTOCOMMIT = 1';
$result =& $this->_doQuery($query, true); $result =& $this->_doQuery($query, true);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
$this->in_transaction = true; $this->in_transaction = true;
@ -278,13 +278,13 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
} }
$result =& $this->_doQuery('COMMIT', true); $result =& $this->_doQuery('COMMIT', true);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
if (!$this->start_transaction) { if (!$this->start_transaction) {
$query = 'SET AUTOCOMMIT = 0'; $query = 'SET AUTOCOMMIT = 0';
$result =& $this->_doQuery($query, true); $result =& $this->_doQuery($query, true);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
} }
@ -324,13 +324,13 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$query = 'ROLLBACK'; $query = 'ROLLBACK';
$result =& $this->_doQuery($query, true); $result =& $this->_doQuery($query, true);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
if (!$this->start_transaction) { if (!$this->start_transaction) {
$query = 'SET AUTOCOMMIT = 0'; $query = 'SET AUTOCOMMIT = 0';
$result =& $this->_doQuery($query, true); $result =& $this->_doQuery($query, true);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
} }
@ -395,7 +395,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$this->disconnect(false); $this->disconnect(false);
} }
if (!PEAR::loadExtension($this->phptype)) { if (!DOLIPEAR::::loadExtension($this->phptype)) {
return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, return $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'extension '.$this->phptype.' is not compiled into PHP', __FUNCTION__); 'extension '.$this->phptype.' is not compiled into PHP', __FUNCTION__);
} }
@ -440,7 +440,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
if (!empty($this->dsn['charset'])) { if (!empty($this->dsn['charset'])) {
$result = $this->setCharset($this->dsn['charset'], $connection); $result = $this->setCharset($this->dsn['charset'], $connection);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
} }
@ -527,7 +527,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
{ {
if (is_null($connection)) { if (is_null($connection)) {
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIPEAR::::isError($connection)) {
return $connection; return $connection;
} }
} }
@ -594,7 +594,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$this->last_query = $query; $this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre')); $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
if ($result) { if ($result) {
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
$query = $result; $query = $result;
@ -606,7 +606,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
if (is_null($connection)) { if (is_null($connection)) {
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIPEAR::::isError($connection)) {
return $connection; return $connection;
} }
} }
@ -653,7 +653,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
{ {
if (is_null($connection)) { if (is_null($connection)) {
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIPEAR::::isError($connection)) {
return $connection; return $connection;
} }
} }
@ -712,7 +712,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
function getServerVersion($native = false) function getServerVersion($native = false)
{ {
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIPEAR::::isError($connection)) {
return $connection; return $connection;
} }
if ($this->connected_server_info) { if ($this->connected_server_info) {
@ -783,7 +783,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$query = $this->_modifyQuery($query, $is_manip, $limit, $offset); $query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
$result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre')); $result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre'));
if ($result) { if ($result) {
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
$query = $result; $query = $result;
@ -810,7 +810,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
} }
$new_pos = $this->_skipDelimitedStrings($query, $position, $p_position); $new_pos = $this->_skipDelimitedStrings($query, $position, $p_position);
if (PEAR::isError($new_pos)) { if (DOLIPEAR::::isError($new_pos)) {
return $new_pos; return $new_pos;
} }
if ($new_pos != $position) { if ($new_pos != $position) {
@ -841,13 +841,13 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
} }
} }
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIPEAR::::isError($connection)) {
return $connection; return $connection;
} }
$statement_name = sprintf($this->options['statement_format'], $this->phptype, md5(time() + rand())); $statement_name = sprintf($this->options['statement_format'], $this->phptype, md5(time() + rand()));
$query = "PREPARE $statement_name FROM ".$this->quote($query, 'text'); $query = "PREPARE $statement_name FROM ".$this->quote($query, 'text');
$statement =& $this->_doQuery($query, true, $connection); $statement =& $this->_doQuery($query, true, $connection);
if (PEAR::isError($statement)) { if (DOLIPEAR::::isError($statement)) {
return $statement; return $statement;
} }
@ -957,13 +957,13 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
} }
$connection = $this->getConnection(); $connection = $this->getConnection();
if (PEAR::isError($connection)) { if (DOLIPEAR::::isError($connection)) {
return $connection; return $connection;
} }
$query = "REPLACE INTO $table ($query) VALUES ($values)"; $query = "REPLACE INTO $table ($query) VALUES ($values)";
$result =& $this->_doQuery($query, true, $connection); $result =& $this->_doQuery($query, true, $connection);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
return $this->_affectedRows($connection, $result); return $this->_affectedRows($connection, $result);
@ -991,11 +991,11 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$this->expectError(MDB2_ERROR_NOSUCHTABLE); $this->expectError(MDB2_ERROR_NOSUCHTABLE);
$result =& $this->_doQuery($query, true); $result =& $this->_doQuery($query, true);
$this->popExpect(); $this->popExpect();
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) { if ($ondemand && $result->getCode() == MDB2_ERROR_NOSUCHTABLE) {
$this->loadModule('Manager', null, true); $this->loadModule('Manager', null, true);
$result = $this->manager->createSequence($seq_name); $result = $this->manager->createSequence($seq_name);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $this->raiseError($result, null, null, return $this->raiseError($result, null, null,
'on demand sequence '.$seq_name.' could not be created', __FUNCTION__); 'on demand sequence '.$seq_name.' could not be created', __FUNCTION__);
} else { } else {
@ -1008,7 +1008,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
if (is_numeric($value)) { if (is_numeric($value)) {
$query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value"; $query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
$result =& $this->_doQuery($query, true); $result =& $this->_doQuery($query, true);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
$this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name; $this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
} }
} }
@ -1076,7 +1076,7 @@ class MDB2_Result_mysql extends MDB2_Result_Common
{ {
if (!is_null($rownum)) { if (!is_null($rownum)) {
$seek = $this->seek($rownum); $seek = $this->seek($rownum);
if (PEAR::isError($seek)) { if (DOLIPEAR::::isError($seek)) {
return $seek; return $seek;
} }
} }
@ -1141,7 +1141,7 @@ class MDB2_Result_mysql extends MDB2_Result_Common
{ {
$columns = array(); $columns = array();
$numcols = $this->numCols(); $numcols = $this->numCols();
if (PEAR::isError($numcols)) { if (DOLIPEAR::::isError($numcols)) {
return $numcols; return $numcols;
} }
for ($column = 0; $column < $numcols; $column++) { for ($column = 0; $column < $numcols; $column++) {
@ -1250,7 +1250,7 @@ class MDB2_BufferedResult_mysql extends MDB2_Result_mysql
function valid() function valid()
{ {
$numrows = $this->numRows(); $numrows = $this->numRows();
if (PEAR::isError($numrows)) { if (DOLIPEAR::::isError($numrows)) {
return $numrows; return $numrows;
} }
return $this->rownum < ($numrows - 1); return $this->rownum < ($numrows - 1);
@ -1315,7 +1315,7 @@ class MDB2_Statement_mysql extends MDB2_Statement_Common
} }
$connection = $this->db->getConnection(); $connection = $this->db->getConnection();
if (PEAR::isError($connection)) { if (DOLIPEAR::::isError($connection)) {
return $connection; return $connection;
} }
@ -1350,7 +1350,7 @@ class MDB2_Statement_mysql extends MDB2_Statement_Common
} }
$param_query = 'SET @'.$parameter.' = '.$this->db->quote($value, $type); $param_query = 'SET @'.$parameter.' = '.$this->db->quote($value, $type);
$result = $this->db->_doQuery($param_query, true, $connection); $result = $this->db->_doQuery($param_query, true, $connection);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
} }
@ -1358,7 +1358,7 @@ class MDB2_Statement_mysql extends MDB2_Statement_Common
} }
$result = $this->db->_doQuery($query, $this->is_manip, $connection); $result = $this->db->_doQuery($query, $this->is_manip, $connection);
if (PEAR::isError($result)) { if (DOLIPEAR::::isError($result)) {
return $result; return $result;
} }
@ -1392,7 +1392,7 @@ class MDB2_Statement_mysql extends MDB2_Statement_Common
if (!is_null($this->statement)) { if (!is_null($this->statement)) {
$connection = $this->db->getConnection(); $connection = $this->db->getConnection();
if (PEAR::isError($connection)) { if (DOLIPEAR::::isError($connection)) {
return $connection; return $connection;
} }
$query = 'DEALLOCATE PREPARE '.$this->statement; $query = 'DEALLOCATE PREPARE '.$this->statement;