Modification MDB2

This commit is contained in:
Regis Houssin 2007-01-04 14:29:33 +00:00
parent 4073a7acaa
commit 870675f62f
2 changed files with 64 additions and 64 deletions

View File

@ -572,7 +572,7 @@ class MDB2
*/
function &raiseError($code = null, $mode = null, $options = null, $userinfo = null)
{
$err =& DOLIDOLIPEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
$err =& DOLIPEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
return $err;
}
@ -741,7 +741,7 @@ class MDB2
return $errorMessages;
}
if (DOLIDOLIPEAR::isError($value)) {
if (DOLIPEAR::isError($value)) {
$value = $value->getCode();
}
@ -1371,7 +1371,7 @@ class MDB2_Driver_Common extends DOLIPEAR
/**
* This method is used to communicate an error and invoke error
* callbacks etc. Basically a wrapper for DOLIDOLIPEAR::raiseError
* callbacks etc. Basically a wrapper for DOLIPEAR::raiseError
* without the message string.
*
* @param mixed integer error code, or a PEAR error object (all other
@ -1396,8 +1396,8 @@ class MDB2_Driver_Common extends DOLIPEAR
{
$userinfo = "[Error message: $userinfo]\n";
// The error is yet a MDB2 error object
if (DOLIDOLIPEAR::isError($code)) {
// because we use the static DOLIDOLIPEAR::raiseError, our global
if (DOLIPEAR::isError($code)) {
// because we use the static DOLIPEAR::raiseError, our global
// handler should be used if it is set
if (is_null($mode) && !empty($this->_default_error_mode)) {
$mode = $this->_default_error_mode;
@ -1424,8 +1424,8 @@ class MDB2_Driver_Common extends DOLIPEAR
}
}
$err =& DOLIDOLIPEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
if ($err->getMode() !== PEAR_ERROR_RETURN
$err =& DOLIPEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
if ($err->getMode() !== DOLIPEAR_ERROR_RETURN
&& isset($this->nested_transaction_counter) && !$this->has_transaction_error) {
$this->has_transaction_error =& $err;
}
@ -1718,7 +1718,7 @@ class MDB2_Driver_Common extends DOLIPEAR
function getConnection()
{
$result = $this->connect();
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
return $this->connection;
@ -1845,7 +1845,7 @@ class MDB2_Driver_Common extends DOLIPEAR
}
$err = MDB2::loadClass($class_name, $this->getOption('debug'));
if (DOLIDOLIPEAR::isError($err)) {
if (DOLIPEAR::isError($err)) {
return $err;
}
@ -1856,7 +1856,7 @@ class MDB2_Driver_Common extends DOLIPEAR
if ($class_name != $class_name_new) {
$class_name = $class_name_new;
$err = MDB2::loadClass($class_name, $this->getOption('debug'));
if (DOLIDOLIPEAR::isError($err)) {
if (DOLIPEAR::isError($err)) {
return $err;
}
}
@ -1902,7 +1902,7 @@ class MDB2_Driver_Common extends DOLIPEAR
$method = strtolower($match[2]).$match[3];
if (!isset($this->modules[$module]) || !is_object($this->modules[$module])) {
$result =& $this->loadModule($module);
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
}
@ -2089,7 +2089,7 @@ class MDB2_Driver_Common extends DOLIPEAR
if ($this->supports('savepoints') && $savepoint) {
if ($force_rollback || $this->has_transaction_error) {
$result = $this->rollback($savepoint);
if (!DOLIDOLIPEAR::isError($result)) {
if (!DOLIPEAR::isError($result)) {
$result = false;
$this->has_transaction_error = false;
}
@ -2110,7 +2110,7 @@ class MDB2_Driver_Common extends DOLIPEAR
if ($this->in_transaction) {
if ($force_rollback || $this->has_transaction_error) {
$result = $this->rollback();
if (!DOLIDOLIPEAR::isError($result)) {
if (!DOLIPEAR::isError($result)) {
$result = false;
}
} else {
@ -2351,12 +2351,12 @@ class MDB2_Driver_Common extends DOLIPEAR
$query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
$connection = $this->getConnection();
if (DOLIDOLIPEAR::isError($connection)) {
if (DOLIPEAR::isError($connection)) {
return $connection;
}
$result =& $this->_doQuery($query, $is_manip, $connection, false);
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
@ -2407,7 +2407,7 @@ class MDB2_Driver_Common extends DOLIPEAR
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
if ($result) {
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
$query = $result;
@ -2456,12 +2456,12 @@ class MDB2_Driver_Common extends DOLIPEAR
$query = $this->_modifyQuery($query, true, $limit, $offset);
$connection = $this->getConnection();
if (DOLIDOLIPEAR::isError($connection)) {
if (DOLIPEAR::isError($connection)) {
return $connection;
}
$result =& $this->_doQuery($query, true, $connection, $this->database_name);
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
@ -2493,12 +2493,12 @@ class MDB2_Driver_Common extends DOLIPEAR
$query = $this->_modifyQuery($query, false, $limit, $offset);
$connection = $this->getConnection();
if (DOLIDOLIPEAR::isError($connection)) {
if (DOLIPEAR::isError($connection)) {
return $connection;
}
$result =& $this->_doQuery($query, false, $connection, $this->database_name);
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
@ -2531,7 +2531,7 @@ class MDB2_Driver_Common extends DOLIPEAR
if ($this->supports('result_introspection')) {
$this->loadModule('Reverse', null, true);
$tableInfo = $this->reverse->tableInfo($result);
if (DOLIDOLIPEAR::isError($tableInfo)) {
if (DOLIPEAR::isError($tableInfo)) {
return $tableInfo;
}
$types = array();
@ -2563,7 +2563,7 @@ class MDB2_Driver_Common extends DOLIPEAR
}
if (!empty($types)) {
$err = $result->setResultTypes($types);
if (DOLIDOLIPEAR::isError($err)) {
if (DOLIPEAR::isError($err)) {
$result->free();
return $err;
}
@ -2664,7 +2664,7 @@ class MDB2_Driver_Common extends DOLIPEAR
}
$col = $this->queryCol($query, $type);
if (DOLIDOLIPEAR::isError($col)) {
if (DOLIPEAR::isError($col)) {
return $col;
}
if (!is_array($col) || count($col) == 0) {
@ -2775,38 +2775,38 @@ class MDB2_Driver_Common extends DOLIPEAR
$result = null;
$in_transaction = $this->in_transaction;
if (!$in_transaction && DOLIDOLIPEAR::isError($result = $this->beginTransaction())) {
if (!$in_transaction && DOLIPEAR::isError($result = $this->beginTransaction())) {
return $result;
}
$connection = $this->getConnection();
if (DOLIDOLIPEAR::isError($connection)) {
if (DOLIPEAR::isError($connection)) {
return $connection;
}
$condition = ' WHERE '.implode(' AND ', $condition);
$query = "DELETE FROM $table$condition";
$result =& $this->_doQuery($query, true, $connection);
if (!DOLIDOLIPEAR::isError($result)) {
if (!DOLIPEAR::isError($result)) {
$affected_rows = $this->_affectedRows($connection, $result);
$insert = implode(', ', array_keys($values));
$values = implode(', ', $values);
$query = "INSERT INTO $table ($insert) VALUES ($values)";
$result =& $this->_doQuery($query, true, $connection);
if (!DOLIDOLIPEAR::isError($result)) {
if (!DOLIPEAR::isError($result)) {
$affected_rows += $this->_affectedRows($connection, $result);;
}
}
if (!$in_transaction) {
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
$this->rollback();
} else {
$result = $this->commit();
}
}
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
@ -2846,7 +2846,7 @@ class MDB2_Driver_Common extends DOLIPEAR
$this->offset = $this->limit = 0;
$result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre'));
if ($result) {
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
$query = $result;
@ -2876,7 +2876,7 @@ class MDB2_Driver_Common extends DOLIPEAR
}
$new_pos = $this->_skipDelimitedStrings($query, $position, $p_position);
if (DOLIDOLIPEAR::isError($new_pos)) {
if (DOLIPEAR::isError($new_pos)) {
return $new_pos;
}
if ($new_pos != $position) {
@ -2994,7 +2994,7 @@ class MDB2_Driver_Common extends DOLIPEAR
function quote($value, $type = null, $quote = true, $escape_wildcards = false)
{
$result = $this->loadModule('Datatype', null, true);
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
@ -3020,7 +3020,7 @@ class MDB2_Driver_Common extends DOLIPEAR
function getDeclaration($type, $name, $field)
{
$result = $this->loadModule('Datatype', null, true);
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
return $this->datatype->getDeclaration($type, $name, $field);
@ -3042,7 +3042,7 @@ class MDB2_Driver_Common extends DOLIPEAR
function compareDefinition($current, $previous)
{
$result = $this->loadModule('Datatype', null, true);
if (DOLIDOLIPEAR::isError($result)) {
if (DOLIPEAR::isError($result)) {
return $result;
}
return $this->datatype->compareDefinition($current, $previous);
@ -3391,7 +3391,7 @@ class MDB2_Result_Common extends MDB2_Result
function setResultTypes($types)
{
$load = $this->db->loadModule('Datatype', null, true);
if (DOLIDOLIPEAR::isError($load)) {
if (DOLIPEAR::isError($load)) {
return $load;
}
$types = $this->db->datatype->checkResultTypes($types);

View File

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