- Merge changes from MDB2's trunk

release-0.6
alecpl 15 years ago
parent bc404ffd41
commit 7244b4500e

@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: MDB2.php 292663 2009-12-26 18:21:46Z quipo $
// $Id: MDB2.php 295587 2010-02-28 17:16:38Z quipo $
//
/**
@ -267,7 +267,7 @@ $GLOBALS['_MDB2_dsninfo_default'] = array(
*/
class MDB2
{
// {{{ function setOptions(&$db, $options)
// {{{ function setOptions($db, $options)
/**
* set option array in an exiting database object
@ -279,7 +279,7 @@ class MDB2
*
* @access public
*/
function setOptions(&$db, $options)
static function setOptions($db, $options)
{
if (is_array($options)) {
foreach ($options as $option => $value) {
@ -304,12 +304,9 @@ class MDB2
* @static
* @access public
*/
function classExists($classname)
static function classExists($classname)
{
if (version_compare(phpversion(), "5.0", ">=")) {
return class_exists($classname, false);
}
return class_exists($classname);
return class_exists($classname, false);
}
// }}}
@ -325,7 +322,7 @@ class MDB2
*
* @access public
*/
function loadClass($class_name, $debug)
static function loadClass($class_name, $debug)
{
if (!MDB2::classExists($class_name)) {
$file_name = str_replace('_', DIRECTORY_SEPARATOR, $class_name).'.php';
@ -340,12 +337,12 @@ class MDB2
} else {
$msg = "unable to load class '$class_name' from file '$file_name'";
}
$err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg);
$err = MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg);
return $err;
}
if (!MDB2::classExists($class_name)) {
$msg = "unable to load class '$class_name' from file '$file_name'";
$err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg);
$err = MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg);
return $err;
}
}
@ -353,21 +350,11 @@ class MDB2
}
// }}}
// {{{ function &factory($dsn, $options = false)
// {{{ function factory($dsn, $options = false)
/**
* Create a new MDB2 object for the specified database type
*
* IMPORTANT: In order for MDB2 to work properly it is necessary that
* you make sure that you work with a reference of the original
* object instead of a copy (this is a PHP4 quirk).
*
* For example:
* $db =& MDB2::factory($dsn);
* ^^
* And not:
* $db = MDB2::factory($dsn);
*
* @param mixed 'data source name', see the MDB2::parseDSN
* method for a description of the dsn format.
* Can also be specified as an array of the
@ -379,11 +366,11 @@ class MDB2
*
* @access public
*/
function &factory($dsn, $options = false)
static function factory($dsn, $options = false)
{
$dsninfo = MDB2::parseDSN($dsn);
if (empty($dsninfo['phptype'])) {
$err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND,
$err = MDB2::raiseError(MDB2_ERROR_NOT_FOUND,
null, null, 'no RDBMS driver specified');
return $err;
}
@ -406,23 +393,12 @@ class MDB2
}
// }}}
// {{{ function &connect($dsn, $options = false)
// {{{ function connect($dsn, $options = false)
/**
* Create a new MDB2_Driver_* connection object and connect to the specified
* database
*
* IMPORTANT: In order for MDB2 to work properly it is necessary that
* you make sure that you work with a reference of the original
* object instead of a copy (this is a PHP4 quirk).
*
* For example:
* $db =& MDB2::connect($dsn);
* ^^
* And not:
* $db = MDB2::connect($dsn);
* ^^
*
* @param mixed $dsn 'data source name', see the MDB2::parseDSN
* method for a description of the dsn format.
* Can also be specified as an array of the
@ -436,9 +412,9 @@ class MDB2
* @access public
* @see MDB2::parseDSN
*/
function &connect($dsn, $options = false)
static function connect($dsn, $options = false)
{
$db =& MDB2::factory($dsn, $options);
$db = MDB2::factory($dsn, $options);
if (PEAR::isError($db)) {
return $db;
}
@ -455,24 +431,13 @@ class MDB2
}
// }}}
// {{{ function &singleton($dsn = null, $options = false)
// {{{ function singleton($dsn = null, $options = false)
/**
* Returns a MDB2 connection with the requested DSN.
* A new MDB2 connection object is only created if no object with the
* requested DSN exists yet.
*
* IMPORTANT: In order for MDB2 to work properly it is necessary that
* you make sure that you work with a reference of the original
* object instead of a copy (this is a PHP4 quirk).
*
* For example:
* $db =& MDB2::singleton($dsn);
* ^^
* And not:
* $db = MDB2::singleton($dsn);
* ^^
*
* @param mixed 'data source name', see the MDB2::parseDSN
* method for a description of the dsn format.
* Can also be specified as an array of the
@ -486,7 +451,7 @@ class MDB2
* @access public
* @see MDB2::parseDSN
*/
function &singleton($dsn = null, $options = false)
static function singleton($dsn = null, $options = false)
{
if ($dsn) {
$dsninfo = MDB2::parseDSN($dsn);
@ -502,10 +467,9 @@ class MDB2
}
}
} elseif (is_array($GLOBALS['_MDB2_databases']) && reset($GLOBALS['_MDB2_databases'])) {
$db =& $GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])];
return $db;
return $GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])];
}
$db =& MDB2::factory($dsn, $options);
$db = MDB2::factory($dsn, $options);
return $db;
}
@ -521,7 +485,7 @@ class MDB2
* @param array $arr2
* @return boolean
*/
function areEquals($arr1, $arr2)
static function areEquals($arr1, $arr2)
{
if (count($arr1) != count($arr2)) {
return false;
@ -540,13 +504,13 @@ class MDB2
/**
* load a file (like 'Date')
*
* @param string name of the file in the MDB2 directory (without '.php')
* @param string $file name of the file in the MDB2 directory (without '.php')
*
* @return string name of the file that was included
* @return string name of the file that was included
*
* @access public
*/
function loadFile($file)
static function loadFile($file)
{
$file_name = 'MDB2'.DIRECTORY_SEPARATOR.$file.'.php';
if (!MDB2::fileExists($file_name)) {
@ -630,17 +594,16 @@ class MDB2
*
* @access public
*/
function isError($data, $code = null)
static function isError($data, $code = null)
{
if (is_a($data, 'MDB2_Error')) {
if ($data instanceof MDB2_Error) {
if (null === $code) {
return true;
} elseif (is_string($code)) {
}
if (is_string($code)) {
return $data->getMessage() === $code;
} else {
$code = (array)$code;
return in_array($data->getCode(), $code);
}
return in_array($data->getCode(), (array)$code);
}
return false;
}
@ -654,12 +617,11 @@ class MDB2
* @param mixed value to test
*
* @return bool whether $value is a MDB2 connection
*
* @access public
*/
function isConnection($value)
{
return is_a($value, 'MDB2_Driver_Common');
return ($value instanceof MDB2_Driver_Common);
}
// }}}
@ -668,15 +630,15 @@ class MDB2
/**
* Tell whether a value is a MDB2 result
*
* @param mixed value to test
* @param mixed $value value to test
*
* @return bool whether $value is a MDB2 result
* @return bool whether $value is a MDB2 result
*
* @access public
* @access public
*/
function isResult($value)
{
return is_a($value, 'MDB2_Result');
return ($value instanceof MDB2_Result);
}
// }}}
@ -685,15 +647,15 @@ class MDB2
/**
* Tell whether a value is a MDB2 result implementing the common interface
*
* @param mixed value to test
* @param mixed $value value to test
*
* @return bool whether $value is a MDB2 result implementing the common interface
* @return bool whether $value is a MDB2 result implementing the common interface
*
* @access public
*/
function isResultCommon($value)
static function isResultCommon($value)
{
return is_a($value, 'MDB2_Result_Common');
return ($value instanceof MDB2_Result_Common);
}
// }}}
@ -710,7 +672,7 @@ class MDB2
*/
function isStatement($value)
{
return is_a($value, 'MDB2_Statement_Common');
return ($value instanceof MDB2_Statement_Common);
}
// }}}
@ -829,7 +791,7 @@ class MDB2
* @access public
* @author Tomas V.V.Cox <cox@idecnet.com>
*/
function parseDSN($dsn)
static function parseDSN($dsn)
{
$parsed = $GLOBALS['_MDB2_dsninfo_default'];
@ -961,7 +923,7 @@ class MDB2
*
* @access public
*/
function fileExists($file)
static function fileExists($file)
{
// safe_mode does notwork with is_readable()
if (!@ini_get('safe_mode')) {
@ -1006,7 +968,7 @@ class MDB2_Error extends PEAR_Error
* @param int what error level to use for $mode & PEAR_ERROR_TRIGGER
* @param mixed additional debug info, such as the last query
*/
function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN,
function __construct($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN,
$level = E_USER_NOTICE, $debuginfo = null, $dummy = null)
{
if (null === $code) {
@ -1355,18 +1317,6 @@ class MDB2_Driver_Common extends PEAR
$this->db_index = $db_index;
}
// }}}
// {{{ function MDB2_Driver_Common()
/**
* PHP 4 Constructor
*/
function MDB2_Driver_Common()
{
$this->destructor_registered = false;
$this->__construct();
}
// }}}
// {{{ destructor: function __destruct()
@ -1501,10 +1451,10 @@ class MDB2_Driver_Common extends PEAR
}
}
$err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
$err = PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
if ($err->getMode() !== PEAR_ERROR_RETURN
&& isset($this->nested_transaction_counter) && !$this->has_transaction_error) {
$this->has_transaction_error =& $err;
$this->has_transaction_error = $err;
}
return $err;
}
@ -1885,7 +1835,7 @@ class MDB2_Driver_Common extends PEAR
}
// }}}
// {{{ function &loadModule($module, $property = null, $phptype_specific = null)
// {{{ function loadModule($module, $property = null, $phptype_specific = null)
/**
* loads a module
@ -1901,7 +1851,7 @@ class MDB2_Driver_Common extends PEAR
*
* @access public
*/
function &loadModule($module, $property = null, $phptype_specific = null)
function loadModule($module, $property = null, $phptype_specific = null)
{
if (!$property) {
$property = strtolower($module);
@ -1942,12 +1892,12 @@ class MDB2_Driver_Common extends PEAR
}
if (!MDB2::classExists($class_name)) {
$err =& $this->raiseError(MDB2_ERROR_LOADMODULE, null, null,
$err = $this->raiseError(MDB2_ERROR_LOADMODULE, null, null,
"unable to load module '$module' into property '$property'", __FUNCTION__);
return $err;
}
$this->{$property} = new $class_name($this->db_index);
$this->modules[$module] =& $this->{$property};
$this->modules[$module] = $this->{$property};
if ($version) {
// this will be used in the connect method to determine if the module
// needs to be loaded with a different version if the server
@ -1979,7 +1929,7 @@ class MDB2_Driver_Common extends PEAR
$module = $this->options['modules'][$match[1]];
$method = strtolower($match[2]).$match[3];
if (!isset($this->modules[$module]) || !is_object($this->modules[$module])) {
$result =& $this->loadModule($module);
$result = $this->loadModule($module);
if (PEAR::isError($result)) {
return $result;
}
@ -2439,7 +2389,7 @@ class MDB2_Driver_Common extends PEAR
*
* @access public
*/
function &standaloneQuery($query, $types = null, $is_manip = false)
function standaloneQuery($query, $types = null, $is_manip = false)
{
$offset = $this->offset;
$limit = $this->limit;
@ -2451,7 +2401,7 @@ class MDB2_Driver_Common extends PEAR
return $connection;
}
$result =& $this->_doQuery($query, $is_manip, $connection, false);
$result = $this->_doQuery($query, $is_manip, $connection, false);
if (PEAR::isError($result)) {
return $result;
}
@ -2460,7 +2410,7 @@ class MDB2_Driver_Common extends PEAR
$affected_rows = $this->_affectedRows($connection, $result);
return $affected_rows;
}
$result =& $this->_wrapResult($result, $types, true, false, $limit, $offset);
$result = $this->_wrapResult($result, $types, true, false, $limit, $offset);
return $result;
}
@ -2498,7 +2448,7 @@ class MDB2_Driver_Common extends PEAR
*
* @access protected
*/
function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
@ -2508,7 +2458,7 @@ class MDB2_Driver_Common extends PEAR
}
$query = $result;
}
$err =& $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
$err = $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
'method not implemented', __FUNCTION__);
return $err;
}
@ -2544,7 +2494,7 @@ class MDB2_Driver_Common extends PEAR
*
* @access public
*/
function &exec($query)
function exec($query)
{
$offset = $this->offset;
$limit = $this->limit;
@ -2556,7 +2506,7 @@ class MDB2_Driver_Common extends PEAR
return $connection;
}
$result =& $this->_doQuery($query, true, $connection, $this->database_name);
$result = $this->_doQuery($query, true, $connection, $this->database_name);
if (PEAR::isError($result)) {
return $result;
}
@ -2581,7 +2531,7 @@ class MDB2_Driver_Common extends PEAR
*
* @access public
*/
function &query($query, $types = null, $result_class = true, $result_wrap_class = false)
function query($query, $types = null, $result_class = true, $result_wrap_class = false)
{
$offset = $this->offset;
$limit = $this->limit;
@ -2593,17 +2543,17 @@ class MDB2_Driver_Common extends PEAR
return $connection;
}
$result =& $this->_doQuery($query, false, $connection, $this->database_name);
$result = $this->_doQuery($query, false, $connection, $this->database_name);
if (PEAR::isError($result)) {
return $result;
}
$result =& $this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset);
$result = $this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset);
return $result;
}
// }}}
// {{{ function &_wrapResult($result_resource, $types = array(), $result_class = true, $result_wrap_class = false, $limit = null, $offset = null)
// {{{ function _wrapResult($result_resource, $types = array(), $result_class = true, $result_wrap_class = false, $limit = null, $offset = null)
/**
* wrap a result set into the correct class
@ -2620,7 +2570,7 @@ class MDB2_Driver_Common extends PEAR
*
* @access protected
*/
function &_wrapResult($result_resource, $types = array(), $result_class = true,
function _wrapResult($result_resource, $types = array(), $result_class = true,
$result_wrap_class = false, $limit = null, $offset = null)
{
if ($types === true) {
@ -2647,13 +2597,13 @@ class MDB2_Driver_Common extends PEAR
if ($result_class) {
$class_name = sprintf($result_class, $this->phptype);
if (!MDB2::classExists($class_name)) {
$err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
$err = $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'result class does not exist '.$class_name, __FUNCTION__);
return $err;
}
$result = new $class_name($this, $result_resource, $limit, $offset);
if (!MDB2::isResultCommon($result)) {
$err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
$err = $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'result class is not extended from MDB2_Result_Common', __FUNCTION__);
return $err;
}
@ -2670,7 +2620,7 @@ class MDB2_Driver_Common extends PEAR
}
if ($result_wrap_class) {
if (!MDB2::classExists($result_wrap_class)) {
$err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
$err = $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'result wrap class does not exist '.$result_wrap_class, __FUNCTION__);
return $err;
}
@ -2881,7 +2831,7 @@ class MDB2_Driver_Common extends PEAR
$condition = ' WHERE '.implode(' AND ', $condition);
$query = 'DELETE FROM ' . $this->quoteIdentifier($table, true) . $condition;
$result =& $this->_doQuery($query, true, $connection);
$result = $this->_doQuery($query, true, $connection);
if (!PEAR::isError($result)) {
$affected_rows = $this->_affectedRows($connection, $result);
$insert = '';
@ -2890,7 +2840,7 @@ class MDB2_Driver_Common extends PEAR
}
$values = implode(', ', $values);
$query = 'INSERT INTO '. $this->quoteIdentifier($table, true) . "($insert) VALUES ($values)";
$result =& $this->_doQuery($query, true, $connection);
$result = $this->_doQuery($query, true, $connection);
if (!PEAR::isError($result)) {
$affected_rows += $this->_affectedRows($connection, $result);;
}
@ -2937,7 +2887,7 @@ class MDB2_Driver_Common extends PEAR
* @access public
* @see bindParam, execute
*/
function &prepare($query, $types = null, $result_types = null, $lobs = array())
function prepare($query, $types = null, $result_types = null, $lobs = array())
{
$is_manip = ($result_types === MDB2_PREPARE_MANIP);
$offset = $this->offset;
@ -3000,7 +2950,7 @@ class MDB2_Driver_Common extends PEAR
$regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
$parameter = preg_replace($regexp, '\\1', $query);
if ($parameter === '') {
$err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
$err = $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
'named parameter name must match "bindname_format" option', __FUNCTION__);
return $err;
}
@ -3045,7 +2995,8 @@ class MDB2_Driver_Common extends PEAR
*/
function _skipDelimitedStrings($query, $position, $p_position)
{
$ignores = $this->string_quoting;
$ignores = array();
$ignores[] = $this->string_quoting;
$ignores[] = $this->identifier_quoting;
$ignores = array_merge($ignores, $this->sql_comments);
@ -3058,7 +3009,7 @@ class MDB2_Driver_Common extends PEAR
if ($ignore['end'] === "\n") {
$end_quote = strlen($query) - 1;
} else {
$err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
$err = $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
'query with an unterminated text string specified', __FUNCTION__);
return $err;
}
@ -3443,30 +3394,19 @@ class MDB2_Result_Common extends MDB2_Result
var $column_names;
// }}}
// {{{ constructor: function __construct(&$db, &$result, $limit = 0, $offset = 0)
// {{{ constructor: function __construct($db, &$result, $limit = 0, $offset = 0)
/**
* Constructor
*/
function __construct(&$db, &$result, $limit = 0, $offset = 0)
function __construct($db, &$result, $limit = 0, $offset = 0)
{
$this->db =& $db;
$this->result =& $result;
$this->db = $db;
$this->result = $result;
$this->offset = $offset;
$this->limit = max(0, $limit - 1);
}
// }}}
// {{{ function MDB2_Result_Common(&$db, &$result, $limit = 0, $offset = 0)
/**
* PHP 4 Constructor
*/
function MDB2_Result_Common(&$db, &$result, $limit = 0, $offset = 0)
{
$this->__construct($db, $result, $limit, $offset);
}
// }}}
// {{{ function setResultTypes($types)
@ -3543,9 +3483,9 @@ class MDB2_Result_Common extends MDB2_Result
*
* @access public
*/
function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
{
$err =& $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
$err = $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
'method not implemented', __FUNCTION__);
return $err;
}
@ -3925,19 +3865,6 @@ class MDB2_Row
}
}
// }}}
// {{{ function MDB2_Row(&$row)
/**
* PHP 4 Constructor
*
* @param resource row data as array
*/
function MDB2_Row(&$row)
{
$this->__construct($row);
}
// }}}
}
@ -3966,15 +3893,15 @@ class MDB2_Statement_Common
var $is_manip;
// }}}
// {{{ constructor: function __construct(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
// {{{ constructor: function __construct($db, $statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
/**
* Constructor
*/
function __construct(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
function __construct($db, $statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
{
$this->db =& $db;
$this->statement =& $statement;
$this->db = $db;
$this->statement = $statement;
$this->positions = $positions;
$this->query = $query;
$this->types = (array)$types;
@ -3984,17 +3911,6 @@ class MDB2_Statement_Common
$this->offset = $offset;
}
// }}}
// {{{ function MDB2_Statement_Common(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
/**
* PHP 4 Constructor
*/
function MDB2_Statement_Common(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null)
{
$this->__construct($db, $statement, $positions, $query, $types, $result_types, $is_manip, $limit, $offset);
}
// }}}
// {{{ function bindValue($parameter, &$value, $type = null)
@ -4141,7 +4057,7 @@ class MDB2_Statement_Common
* a MDB2 error on failure
* @access public
*/
function &execute($values = null, $result_class = true, $result_wrap_class = false)
function execute($values = null, $result_class = true, $result_wrap_class = false)
{
if (null === $this->positions) {
return $this->db->raiseError(MDB2_ERROR, null, null,
@ -4156,12 +4072,12 @@ class MDB2_Statement_Common
'Binding Values failed with message: ' . $err->getMessage(), __FUNCTION__);
}
}
$result =& $this->_execute($result_class, $result_wrap_class);
$result = $this->_execute($result_class, $result_wrap_class);
return $result;
}
// }}}
// {{{ function &_execute($result_class = true, $result_wrap_class = false)
// {{{ function _execute($result_class = true, $result_wrap_class = false)
/**
* Execute a prepared query statement helper method.
@ -4173,7 +4089,7 @@ class MDB2_Statement_Common
* a MDB2 error on failure
* @access private
*/
function &_execute($result_class = true, $result_wrap_class = false)
function _execute($result_class = true, $result_wrap_class = false)
{
$this->last_query = $this->query;
$query = '';
@ -4204,7 +4120,7 @@ class MDB2_Statement_Common
if ($this->is_manip) {
$result = $this->db->exec($query);
} else {
$result =& $this->db->query($query, $this->result_types, $result_class, $result_wrap_class);
$result = $this->db->query($query, $this->result_types, $result_class, $result_wrap_class);
}
return $result;
}
@ -4277,18 +4193,7 @@ class MDB2_Module_Common
}
// }}}
// {{{ function MDB2_Module_Common($db_index)
/**
* PHP 4 Constructor
*/
function MDB2_Module_Common($db_index)
{
$this->__construct($db_index);
}
// }}}
// {{{ function &getDBInstance()
// {{{ function getDBInstance()
/**
* Get the instance of MDB2 associated with the module instance
@ -4297,12 +4202,12 @@ class MDB2_Module_Common
*
* @access public
*/
function &getDBInstance()
function getDBInstance()
{
if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) {
$result =& $GLOBALS['_MDB2_databases'][$this->db_index];
$result = $GLOBALS['_MDB2_databases'][$this->db_index];
} else {
$result =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
$result = MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'could not find MDB2 instance');
}
return $result;

@ -44,7 +44,7 @@
// | Daniel Convissor <danielc@php.net> |
// +----------------------------------------------------------------------+
//
// $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mssql.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Datatype/Common.php';
@ -136,7 +136,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common
*/
function getTypeDeclaration($field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -215,7 +215,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common
*/
function _getIntegerDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -269,7 +269,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common
*/
function _getCLOBDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -305,7 +305,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common
*/
function _getBLOBDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -355,7 +355,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common
*/
function matchPattern($pattern, $operator = null, $field = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -476,7 +476,7 @@ class MDB2_Driver_Datatype_mssql extends MDB2_Driver_Datatype_Common
$length = null;
break;
default:
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: mysql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Datatype/Common.php';
@ -116,7 +116,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
*/
function getTypeDeclaration($field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -219,7 +219,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
*/
function _getIntegerDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -236,6 +236,9 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
$notnull = empty($field['notnull']) ? '' : ' NOT NULL';
$unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
if (empty($default) && empty($notnull)) {
$default = ' DEFAULT NULL';
}
$name = $db->quoteIdentifier($name, true);
return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc;
}
@ -308,7 +311,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
*/
function _getDecimalDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -346,7 +349,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
*/
function matchPattern($pattern, $operator = null, $field = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -537,7 +540,7 @@ class MDB2_Driver_Datatype_mysql extends MDB2_Driver_Datatype_Common
$length = null;
break;
default:
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: mysqli.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mysqli.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Datatype/Common.php';
@ -116,7 +116,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common
*/
function getTypeDeclaration($field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -219,7 +219,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common
*/
function _getIntegerDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -236,6 +236,9 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common
$notnull = empty($field['notnull']) ? '' : ' NOT NULL';
$unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
if (empty($default) && empty($notnull)) {
$default = ' DEFAULT NULL';
}
$name = $db->quoteIdentifier($name, true);
return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc;
}
@ -308,7 +311,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common
*/
function _getDecimalDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -346,7 +349,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common
*/
function matchPattern($pattern, $operator = null, $field = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -537,7 +540,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common
$length = null;
break;
default:
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -565,7 +568,7 @@ class MDB2_Driver_Datatype_mysqli extends MDB2_Driver_Datatype_Common
*/
function mapPrepareDatatype($type)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -42,7 +42,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
//
// $Id: pgsql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $
require_once 'MDB2/Driver/Datatype/Common.php';
@ -117,7 +117,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function getTypeDeclaration($field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -198,7 +198,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function _getIntegerDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -219,6 +219,9 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
}
$notnull = empty($field['notnull']) ? '' : ' NOT NULL';
if (empty($default) && empty($notnull)) {
$default = ' DEFAULT NULL';
}
$name = $db->quoteIdentifier($name, true);
return $name.' '.$this->getTypeDeclaration($field).$default.$notnull;
}
@ -239,7 +242,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function _quoteCLOB($value, $quote, $escape_wildcards)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -271,7 +274,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
if (!$quote) {
return $value;
}
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -333,7 +336,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function matchPattern($pattern, $operator = null, $field = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -388,7 +391,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function patternEscapeString()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -514,7 +517,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
$length = null;
break;
default:
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -541,7 +544,7 @@ class MDB2_Driver_Datatype_pgsql extends MDB2_Driver_Datatype_Common
*/
function mapPrepareDatatype($type)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Datatype/Common.php';
@ -101,7 +101,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
*/
function getTypeDeclaration($field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -199,7 +199,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
*/
function _getIntegerDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -216,6 +216,9 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
$notnull = empty($field['notnull']) ? '' : ' NOT NULL';
$unsigned = empty($field['unsigned']) ? '' : ' UNSIGNED';
if (empty($default) && empty($notnull)) {
$default = ' DEFAULT NULL';
}
$name = $db->quoteIdentifier($name, true);
return $name.' '.$this->getTypeDeclaration($field).$unsigned.$default.$notnull.$autoinc;
}
@ -237,7 +240,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
*/
function matchPattern($pattern, $operator = null, $field = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -394,7 +397,7 @@ class MDB2_Driver_Datatype_sqlite extends MDB2_Driver_Datatype_Common
$length = null;
break;
default:
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -132,7 +132,7 @@ class MDB2_Driver_Datatype_sqlsrv extends MDB2_Driver_Datatype_Common
*/
function getTypeDeclaration($field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -211,7 +211,7 @@ class MDB2_Driver_Datatype_sqlsrv extends MDB2_Driver_Datatype_Common
*/
function _getIntegerDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -265,7 +265,7 @@ class MDB2_Driver_Datatype_sqlsrv extends MDB2_Driver_Datatype_Common
*/
function _getCLOBDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -301,7 +301,7 @@ class MDB2_Driver_Datatype_sqlsrv extends MDB2_Driver_Datatype_Common
*/
function _getBLOBDeclaration($name, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -431,7 +431,7 @@ class MDB2_Driver_Datatype_sqlsrv extends MDB2_Driver_Datatype_Common
$length = null;
break;
default:
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -42,7 +42,7 @@
// | Author: Frank M. Kromann <frank@kromann.info> |
// +----------------------------------------------------------------------+
//
// $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mssql.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Function/Common.php';
@ -71,9 +71,9 @@ class MDB2_Driver_Function_mssql extends MDB2_Driver_Function_Common
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
* @access public
*/
function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: mysql.php 253106 2008-02-17 18:54:08Z quipo $
// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Function/Common.php';
@ -71,9 +71,9 @@ class MDB2_Driver_Function_mysql extends MDB2_Driver_Function_Common
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
* @access public
*/
function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: mysqli.php 253106 2008-02-17 18:54:08Z quipo $
// $Id: mysqli.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Function/Common.php';
@ -71,9 +71,9 @@ class MDB2_Driver_Function_mysqli extends MDB2_Driver_Function_Common
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
* @access public
*/
function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -84,7 +84,7 @@ class MDB2_Driver_Function_mysqli extends MDB2_Driver_Function_Common
}
$query = 'CALL '.$name;
$query .= $params ? '('.implode(', ', $params).')' : '()';
$result =& $db->query($query, $types, $result_class, $result_wrap_class);
$result = $db->query($query, $types, $result_class, $result_wrap_class);
if (!$multi_query) {
$db->setOption('multi_query', false);
}

@ -42,7 +42,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
//
// $Id: pgsql.php 268669 2008-11-09 19:46:50Z quipo $
// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $
require_once 'MDB2/Driver/Function/Common.php';
@ -69,9 +69,9 @@ class MDB2_Driver_Function_pgsql extends MDB2_Driver_Function_Common
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
* @access public
*/
function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Function/Common.php';
@ -147,12 +147,12 @@ class MDB2_Driver_Function_sqlite extends MDB2_Driver_Function_Common
*/
function replace($str, $from_str, $to_str)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
$error =& $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
$error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
'method not implemented', __FUNCTION__);
return $error;
}

@ -67,9 +67,9 @@ class MDB2_Driver_Function_sqlsrv extends MDB2_Driver_Function_Common
* @return mixed a result handle or MDB2_OK on success, a MDB2 error on failure
* @access public
*/
function &executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
function executeStoredProc($name, $params = null, $types = null, $result_class = true, $result_wrap_class = false)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -44,7 +44,7 @@
// | Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
// $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mssql.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Manager/Common.php';
@ -74,7 +74,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function createDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -106,7 +106,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function alterDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -138,7 +138,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function dropDatabase($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -245,7 +245,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function truncateTable($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -275,7 +275,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function vacuum($table = null, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -385,7 +385,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function alterTable($name, $changes, $check)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -546,7 +546,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function _dropConflictingIndices($table, $fields)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -592,7 +592,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function _dropConflictingConstraints($table, $fields)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -647,7 +647,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function _getTableFieldDefaultConstraint($table, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -673,7 +673,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function listTables()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
@ -710,7 +710,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function listTableFields($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -742,7 +742,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function listTableIndexes($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -790,7 +790,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function listDatabases()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -816,7 +816,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function listUsers()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -842,7 +842,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function listFunctions()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -883,7 +883,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function listTableTriggers($table = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -924,7 +924,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function listViews()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -967,7 +967,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function dropIndex($table, $name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -990,7 +990,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function listTableConstraints($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1033,7 +1033,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function createSequence($seq_name, $start = 1)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1079,7 +1079,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function dropSequence($seq_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1099,7 +1099,7 @@ class MDB2_Driver_Manager_mssql extends MDB2_Driver_Manager_Common
*/
function listSequences()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: mysql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Manager/Common.php';
@ -71,7 +71,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function createDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -101,7 +101,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function alterDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -128,7 +128,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function dropDatabase($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -204,7 +204,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function createTable($name, $fields, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -285,7 +285,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function dropTable($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -321,7 +321,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function truncateTable($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -349,7 +349,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function vacuum($table = null, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -474,7 +474,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function alterTable($name, $changes, $check)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -575,7 +575,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listDatabases()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -601,7 +601,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listUsers()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -620,7 +620,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listFunctions()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -653,7 +653,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listTableTriggers($table = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -685,7 +685,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listTables($database = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -725,7 +725,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listViews($database = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -759,7 +759,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listTableFields($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -815,7 +815,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function createIndex($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -848,7 +848,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function dropIndex($table, $name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -870,7 +870,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listTableIndexes($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -934,7 +934,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function createConstraint($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1008,7 +1008,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function dropConstraint($table, $name, $primary = false)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1058,7 +1058,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function _createFKTriggers($table, $foreign_keys)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1204,7 +1204,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function _dropFKTriggers($table, $fkname, $referenced_table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1238,7 +1238,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listTableConstraints($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1313,7 +1313,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function createSequence($seq_name, $start = 1, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1386,7 +1386,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function dropSequence($seq_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1407,7 +1407,7 @@ class MDB2_Driver_Manager_mysql extends MDB2_Driver_Manager_Common
*/
function listSequences($database = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: mysqli.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mysqli.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Manager/Common.php';
@ -71,7 +71,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function createDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -101,7 +101,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function alterDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -128,7 +128,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function dropDatabase($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -204,7 +204,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function createTable($name, $fields, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -285,7 +285,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function dropTable($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -321,7 +321,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function truncateTable($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -349,7 +349,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function vacuum($table = null, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -474,7 +474,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function alterTable($name, $changes, $check)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -575,7 +575,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function listDatabases()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -601,7 +601,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function listUsers()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -620,7 +620,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function listFunctions()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -653,7 +653,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function listTableTriggers($table = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -685,7 +685,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function listTables($database = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -725,7 +725,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function listViews($database = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -759,7 +759,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function listTableFields($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -815,7 +815,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function createIndex($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -848,7 +848,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function dropIndex($table, $name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -870,7 +870,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function listTableIndexes($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -934,7 +934,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function createConstraint($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1008,7 +1008,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function dropConstraint($table, $name, $primary = false)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1058,7 +1058,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function _createFKTriggers($table, $foreign_keys)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1204,7 +1204,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function _dropFKTriggers($table, $fkname, $referenced_table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1238,7 +1238,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function listTableConstraints($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1313,7 +1313,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function createSequence($seq_name, $start = 1, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1386,7 +1386,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function dropSequence($seq_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1407,7 +1407,7 @@ class MDB2_Driver_Manager_mysqli extends MDB2_Driver_Manager_Common
*/
function listSequences($database = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -42,7 +42,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
//
// $Id: pgsql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $
require_once 'MDB2/Driver/Manager/Common.php';
@ -68,7 +68,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function createDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -95,7 +95,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function alterDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -122,7 +122,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function dropDatabase($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -181,7 +181,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function truncateTable($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -209,7 +209,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function vacuum($table = null, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -326,7 +326,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function alterTable($name, $changes, $check)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -441,7 +441,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listDatabases()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -474,7 +474,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listUsers()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -501,7 +501,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listViews()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -532,7 +532,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listTableViews($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -560,7 +560,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listFunctions()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -599,7 +599,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listTableTriggers($table = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -633,7 +633,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listTables()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -680,7 +680,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listTableFields($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -716,7 +716,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listTableIndexes($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -769,7 +769,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function dropConstraint($table, $name, $primary = false)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -817,7 +817,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listTableConstraints($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -882,7 +882,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function createSequence($seq_name, $start = 1)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -904,7 +904,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function dropSequence($seq_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -924,7 +924,7 @@ class MDB2_Driver_Manager_pgsql extends MDB2_Driver_Manager_Common
*/
function listSequences()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -43,7 +43,7 @@
// | Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
// $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Manager/Common.php';
@ -71,7 +71,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function createDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -107,7 +107,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function dropDatabase($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -174,7 +174,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function _getCreateTableQuery($name, $fields, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -236,7 +236,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
}
// create triggers to enforce FOREIGN KEY constraints
if (!empty($options['foreign_keys'])) {
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -384,7 +384,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function dropTable($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -427,7 +427,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function vacuum($table = null, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -534,7 +534,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function alterTable($name, $changes, $check, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -687,7 +687,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
$query = 'INSERT INTO '.$db->quoteIdentifier($name_new, true);
$query.= '('.implode(', ', array_slice(array_keys($fields), 0, count($select_fields))).')';
$query.=' VALUES (?'.str_repeat(', ?', (count($select_fields) - 1)).')';
$stmt =& $db->prepare($query, null, MDB2_PREPARE_MANIP);
$stmt = $db->prepare($query, null, MDB2_PREPARE_MANIP);
if (PEAR::isError($stmt)) {
return $stmt;
}
@ -712,7 +712,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listDatabases()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -732,7 +732,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listUsers()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -752,7 +752,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listViews()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -780,7 +780,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTableViews($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -816,7 +816,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTables()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -850,7 +850,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTableFields($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -898,7 +898,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTableTriggers($table = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -958,7 +958,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function createIndex($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -998,7 +998,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function dropIndex($table, $name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1019,7 +1019,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTableIndexes($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1080,7 +1080,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function createConstraint($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1133,7 +1133,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
return $this->alterTable($table, array(), false, array('primary' => null));
}
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1170,7 +1170,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function _dropFKTriggers($table, $fkname, $referenced_table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1204,7 +1204,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listTableConstraints($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1274,7 +1274,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function createSequence($seq_name, $start = 1)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1315,7 +1315,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function dropSequence($seq_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1335,7 +1335,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
*/
function listSequences()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -71,7 +71,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function createDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -103,7 +103,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function alterDatabase($name, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -135,7 +135,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function dropDatabase($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -156,7 +156,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function dropTable($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -262,7 +262,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function truncateTable($name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -292,7 +292,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function vacuum($table = null, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -402,7 +402,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function alterTable($name, $changes, $check)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -563,7 +563,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function _dropConflictingIndices($table, $fields)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -609,7 +609,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function _dropConflictingConstraints($table, $fields)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -664,7 +664,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function _getTableFieldDefaultConstraint($table, $field)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -690,7 +690,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function listTables()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
@ -727,7 +727,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function listTableFields($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -759,7 +759,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function listTableIndexes($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -807,7 +807,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function listDatabases()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -833,7 +833,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function listUsers()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -859,7 +859,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function listFunctions()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -900,7 +900,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function listTableTriggers($table = null)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -941,7 +941,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function listViews()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -984,7 +984,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function dropIndex($table, $name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1007,7 +1007,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function listTableConstraints($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1052,7 +1052,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function _getCreateTableQuery($name, $fields, $options = array())
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1097,7 +1097,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function createSequence($seq_name, $start = 1)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1143,7 +1143,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function dropSequence($seq_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1163,7 +1163,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function listSequences()
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1217,7 +1217,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function getTableStatus($table)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1239,7 +1239,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
function checkTable($tableName)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -1345,7 +1345,7 @@ class MDB2_Driver_Manager_sqlsrv extends MDB2_Driver_Manager_Common
*/
function createConstraint($table, $name, $definition)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -42,7 +42,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
//
// $Id: pgsql.php 216444 2006-07-15 13:07:15Z lsmith $
// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $
require_once 'MDB2/Driver/Native/Common.php';
@ -67,7 +67,7 @@ class MDB2_Driver_Native_pgsql extends MDB2_Driver_Native_Common
*/
function deleteOID($OID)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -43,7 +43,7 @@
// | Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
// $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mssql.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Reverse/Common.php';
@ -70,7 +70,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common
*/
function getTableFieldDefinition($table_name, $field_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -187,7 +187,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common
*/
function getTableIndexDefinition($table_name, $index_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -271,7 +271,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common
*/
function getTableConstraintDefinition($table_name, $constraint_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -406,7 +406,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common
*/
function getTriggerDefinition($trigger)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -486,7 +486,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common
return parent::tableInfo($result, $mode);
}
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -564,7 +564,7 @@ class MDB2_Driver_Reverse_mssql extends MDB2_Driver_Reverse_Common
*/
function _mssql_field_flags($table, $column)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: mysql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Reverse/Common.php';
@ -69,7 +69,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
*/
function getTableFieldDefinition($table_name, $field_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -117,9 +117,17 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
$default = '';
}
}
$definition[0] = array(
'notnull' => $notnull,
'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type'])
);
$autoincrement = false;
if (!empty($column['extra']) && $column['extra'] == 'auto_increment') {
$autoincrement = true;
if (!empty($column['extra'])) {
if ($column['extra'] == 'auto_increment') {
$autoincrement = true;
} else {
$definition[0]['extra'] = $column['extra'];
}
}
$collate = null;
if (!empty($column['collation'])) {
@ -127,10 +135,6 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
$charset = preg_replace('/(.+?)(_.+)?/', '$1', $collate);
}
$definition[0] = array(
'notnull' => $notnull,
'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type'])
);
if (null !== $length) {
$definition[0]['length'] = $length;
}
@ -181,7 +185,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
*/
function getTableIndexDefinition($table_name, $index_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -256,7 +260,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
*/
function getTableConstraintDefinition($table_name, $constraint_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -356,10 +360,16 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
*/
function _getTableFKConstraintDefinition($table, $constraint_name, $definition)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
//Use INFORMATION_SCHEMA instead?
//SELECT *
// FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
// WHERE CONSTRAINT_SCHEMA = '$dbname'
// AND TABLE_NAME = '$table'
// AND CONSTRAINT_NAME = '$constraint_name';
$query = 'SHOW CREATE TABLE '. $db->escape($table);
$constraint = $db->queryOne($query, 'text', 1);
if (!PEAR::isError($constraint) && !empty($constraint)) {
@ -372,10 +382,10 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
}
$constraint_name_original = $constraint_name;
$constraint_name = $db->getIndexName($constraint_name);
$pattern = '/\bCONSTRAINT\s+'.$constraint_name.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^ ]+) \(([^\)]+)\)/i';
$pattern = '/\bCONSTRAINT\s+'.$constraint_name.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^\s]+) \(([^\)]+)\)(?: ON DELETE ([^\s]+))?(?: ON UPDATE ([^\s]+))?/i';
if (!preg_match($pattern, str_replace('`', '', $constraint), $matches)) {
//fallback to original constraint name
$pattern = '/\bCONSTRAINT\s+'.$constraint_name_original.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^ ]+) \(([^\)]+)\)/i';
$pattern = '/\bCONSTRAINT\s+'.$constraint_name_original.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^\s]+) \(([^\)]+)\)(?: ON DELETE ([^\s]+))?(?: ON UPDATE ([^\s]+))?/i';
}
if (preg_match($pattern, str_replace('`', '', $constraint), $matches)) {
$definition['foreign'] = true;
@ -397,8 +407,8 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
'position' => $colpos++
);
}
$definition['onupdate'] = 'NO ACTION';
$definition['ondelete'] = 'NO ACTION';
$definition['ondelete'] = empty($matches[4]) ? 'RESTRICT' : strtoupper($matches[4]);
$definition['onupdate'] = empty($matches[5]) ? 'RESTRICT' : strtoupper($matches[5]);
$definition['match'] = 'SIMPLE';
return $definition;
}
@ -424,7 +434,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
*/
function getTriggerDefinition($trigger)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -476,7 +486,7 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
return parent::tableInfo($result, $mode);
}
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -506,11 +516,11 @@ class MDB2_Driver_Reverse_mysql extends MDB2_Driver_Reverse_Common
$db->loadModule('Datatype', null, true);
for ($i = 0; $i < $count; $i++) {
$res[$i] = array(
'table' => $case_func(@mysql_field_table($resource, $i)),
'name' => $case_func(@mysql_field_name($resource, $i)),
'type' => @mysql_field_type($resource, $i),
'length' => @mysql_field_len($resource, $i),
'flags' => @mysql_field_flags($resource, $i),
'table' => $case_func(@mysql_field_table($resource, $i)),
'name' => $case_func(@mysql_field_name($resource, $i)),
'type' => @mysql_field_type($resource, $i),
'length' => @mysql_field_len($resource, $i),
'flags' => @mysql_field_flags($resource, $i),
);
if ($res[$i]['type'] == 'string') {
$res[$i]['type'] = 'char';

@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: mysqli.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mysqli.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Reverse/Common.php';
@ -123,7 +123,7 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
*/
function getTableFieldDefinition($table_name, $field_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -171,9 +171,17 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
$default = '';
}
}
$definition[0] = array(
'notnull' => $notnull,
'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type'])
);
$autoincrement = false;
if (!empty($column['extra']) && $column['extra'] == 'auto_increment') {
$autoincrement = true;
if (!empty($column['extra'])) {
if ($column['extra'] == 'auto_increment') {
$autoincrement = true;
} else {
$definition[0]['extra'] = $column['extra'];
}
}
$collate = null;
if (!empty($column['collation'])) {
@ -181,10 +189,6 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
$charset = preg_replace('/(.+?)(_.+)?/', '$1', $collate);
}
$definition[0] = array(
'notnull' => $notnull,
'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type'])
);
if (null !== $length) {
$definition[0]['length'] = $length;
}
@ -235,7 +239,7 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
*/
function getTableIndexDefinition($table_name, $index_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -310,7 +314,7 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
*/
function getTableConstraintDefinition($table_name, $constraint_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -410,10 +414,16 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
*/
function _getTableFKConstraintDefinition($table, $constraint_name, $definition)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
//Use INFORMATION_SCHEMA instead?
//SELECT *
// FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS
// WHERE CONSTRAINT_SCHEMA = '$dbname'
// AND TABLE_NAME = '$table'
// AND CONSTRAINT_NAME = '$constraint_name';
$query = 'SHOW CREATE TABLE '. $db->escape($table);
$constraint = $db->queryOne($query, 'text', 1);
if (!PEAR::isError($constraint) && !empty($constraint)) {
@ -426,10 +436,10 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
}
$constraint_name_original = $constraint_name;
$constraint_name = $db->getIndexName($constraint_name);
$pattern = '/\bCONSTRAINT\s+'.$constraint_name.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^ ]+) \(([^\)]+)\)/i';
$pattern = '/\bCONSTRAINT\s+'.$constraint_name.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^\s]+) \(([^\)]+)\)(?: ON DELETE ([^\s]+))?(?: ON UPDATE ([^\s]+))?/i';
if (!preg_match($pattern, str_replace('`', '', $constraint), $matches)) {
//fallback to original constraint name
$pattern = '/\bCONSTRAINT\s+'.$constraint_name_original.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^ ]+) \(([^\)]+)\)/i';
$pattern = '/\bCONSTRAINT\s+'.$constraint_name_original.'\s+FOREIGN KEY\s+\(([^\)]+)\) \bREFERENCES\b ([^\s]+) \(([^\)]+)\)(?: ON DELETE ([^\s]+))?(?: ON UPDATE ([^\s]+))?/i';
}
if (preg_match($pattern, str_replace('`', '', $constraint), $matches)) {
$definition['foreign'] = true;
@ -451,8 +461,8 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
'position' => $colpos++
);
}
$definition['onupdate'] = 'NO ACTION';
$definition['ondelete'] = 'NO ACTION';
$definition['ondelete'] = empty($matches[4]) ? 'RESTRICT' : strtoupper($matches[4]);
$definition['onupdate'] = empty($matches[5]) ? 'RESTRICT' : strtoupper($matches[5]);
$definition['match'] = 'SIMPLE';
return $definition;
}
@ -478,7 +488,7 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
*/
function getTriggerDefinition($trigger)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -530,7 +540,7 @@ class MDB2_Driver_Reverse_mysqli extends MDB2_Driver_Reverse_Common
return parent::tableInfo($result, $mode);
}
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -43,7 +43,7 @@
// | Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
// $Id: pgsql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $
require_once 'MDB2/Driver/Reverse/Common.php';
@ -69,7 +69,7 @@ class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common
*/
function getTableFieldDefinition($table_name, $field_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -199,7 +199,7 @@ class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common
*/
function getTableIndexDefinition($table_name, $index_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -257,7 +257,7 @@ class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common
*/
function getTableConstraintDefinition($table_name, $constraint_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -444,7 +444,7 @@ class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common
*/
function getTriggerDefinition($trigger)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -518,7 +518,7 @@ class MDB2_Driver_Reverse_pgsql extends MDB2_Driver_Reverse_Common
return parent::tableInfo($result, $mode);
}
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -43,7 +43,7 @@
// | Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
// $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Reverse/Common.php';
@ -78,7 +78,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
*/
function _getTableColumns($sql)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -156,7 +156,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
*/
function getTableFieldDefinition($table_name, $field_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -258,7 +258,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
*/
function getTableIndexDefinition($table_name, $index_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -341,7 +341,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
*/
function getTableConstraintDefinition($table_name, $constraint_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -532,7 +532,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
*/
function getTriggerDefinition($trigger)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -596,7 +596,7 @@ class MDB2_Driver_Reverse_sqlite extends MDB2_Driver_Reverse_Common
return parent::tableInfo($result, $mode);
}
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -67,7 +67,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common
*/
function getTableFieldDefinition($table_name, $field_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -184,7 +184,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common
*/
function getTableIndexDefinition($table_name, $index_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -268,7 +268,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common
*/
function getTableConstraintDefinition($table_name, $constraint_name)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -403,7 +403,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common
*/
function getTriggerDefinition($trigger)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -483,7 +483,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common
return parent::tableInfo($result, $mode);
}
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}
@ -564,7 +564,7 @@ class MDB2_Driver_Reverse_sqlsrv extends MDB2_Driver_Reverse_Common
*/
function _mssql_field_flags($table, $column)
{
$db =& $this->getDBInstance();
$db = $this->getDBInstance();
if (PEAR::isError($db)) {
return $db;
}

@ -43,7 +43,7 @@
// | Author: Frank M. Kromann <frank@kromann.info> |
// +----------------------------------------------------------------------+
//
// $Id: mssql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mssql.php 295587 2010-02-28 17:16:38Z quipo $
//
// {{{ Class MDB2_Driver_mssql
/**
@ -531,7 +531,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common
// }}}
// {{{ standaloneQuery()
/**
/**
* execute a query as DBA
*
* @param string $query the SQL query
@ -541,7 +541,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common
* @return mixed MDB2_OK on success, a MDB2 error on failure
* @access public
*/
function &standaloneQuery($query, $types = null, $is_manip = false)
function standaloneQuery($query, $types = null, $is_manip = false)
{
$user = $this->options['DBA_username']? $this->options['DBA_username'] : $this->dsn['username'];
$pass = $this->options['DBA_password']? $this->options['DBA_password'] : $this->dsn['password'];
@ -555,7 +555,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common
$this->offset = $this->limit = 0;
$query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
$result =& $this->_doQuery($query, $is_manip, $connection, $this->database_name);
$result = $this->_doQuery($query, $is_manip, $connection, $this->database_name);
if (!PEAR::isError($result)) {
$result = $this->_affectedRows($connection, $result);
}
@ -576,7 +576,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common
* @return result or error object
* @access protected
*/
function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
@ -614,7 +614,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common
$result = @mssql_query($query, $connection);
if (!$result) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Could not execute statement', __FUNCTION__);
return $err;
}
@ -728,7 +728,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common
function _checkSequence($seq_name)
{
$query = "SELECT * FROM $seq_name";
$tableExists =& $this->_doQuery($query, true);
$tableExists = $this->_doQuery($query, true);
if (PEAR::isError($tableExists)) {
if ($tableExists->getCode() == MDB2_ERROR_NOSUCHTABLE) {
return false;
@ -768,7 +768,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common
} else {
$query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (0)";
}
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
$this->popExpect();
$this->popErrorHandling();
if (PEAR::isError($result)) {
@ -802,7 +802,7 @@ class MDB2_Driver_mssql extends MDB2_Driver_Common
$value = $this->lastInsertID($sequence_name);
if (is_numeric($value)) {
$query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
$this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
}
@ -895,11 +895,10 @@ class MDB2_Result_mssql extends MDB2_Result_Common
* @return int data array on success, a MDB2 error on failure
* @access public
*/
function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
{
if (!$this->_skipLimitOffset()) {
$null = null;
return $null;
return null;
}
if (null !== $rownum) {
$seek = $this->seek($rownum);
@ -922,12 +921,11 @@ class MDB2_Result_mssql extends MDB2_Result_Common
}
if (!$row) {
if (false === $this->result) {
$err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
$err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
'resultset has already been freed', __FUNCTION__);
return $err;
}
$null = null;
return $null;
return null;
}
$mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
$rtrim = false;

@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: mysql.php 292659 2009-12-26 17:31:01Z quipo $
// $Id: mysql.php 295587 2010-02-28 17:16:38Z quipo $
//
/**
@ -338,7 +338,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
register_shutdown_function('MDB2_closeOpenTransactions');
}
$query = $this->start_transaction ? 'START TRANSACTION' : 'SET AUTOCOMMIT = 0';
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -385,13 +385,13 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
'transactions are not supported', __FUNCTION__);
}
$result =& $this->_doQuery('COMMIT', true);
$result = $this->_doQuery('COMMIT', true);
if (PEAR::isError($result)) {
return $result;
}
if (!$this->start_transaction) {
$query = 'SET AUTOCOMMIT = 1';
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -431,13 +431,13 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
}
$query = 'ROLLBACK';
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
if (!$this->start_transaction) {
$query = 'SET AUTOCOMMIT = 1';
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -457,12 +457,16 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
* READ COMMITTED (prevents dirty reads)
* REPEATABLE READ (prevents nonrepeatable reads)
* SERIALIZABLE (prevents phantom reads)
* @param array some transaction options:
* 'wait' => 'WAIT' | 'NO WAIT'
* 'rw' => 'READ WRITE' | 'READ ONLY'
*
* @return mixed MDB2_OK on success, a MDB2 error on failure
*
* @access public
* @since 2.1.1
*/
function setTransactionIsolation($isolation)
function setTransactionIsolation($isolation, $options = array())
{
$this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
if (!$this->supports('transactions')) {
@ -626,7 +630,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$client_info = mysql_get_client_info();
if (function_exists('mysql_set_charset') && version_compare($client_info, '5.0.6')) {
if (!$result = mysql_set_charset($charset, $connection)) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Could not set client character set', __FUNCTION__);
return $err;
}
@ -709,7 +713,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
// }}}
// {{{ standaloneQuery()
/**
/**
* execute a query as DBA
*
* @param string $query the SQL query
@ -719,7 +723,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
* @return mixed MDB2_OK on success, a MDB2 error on failure
* @access public
*/
function &standaloneQuery($query, $types = null, $is_manip = false)
function standaloneQuery($query, $types = null, $is_manip = false)
{
$user = $this->options['DBA_username']? $this->options['DBA_username'] : $this->dsn['username'];
$pass = $this->options['DBA_password']? $this->options['DBA_password'] : $this->dsn['password'];
@ -733,7 +737,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$this->offset = $this->limit = 0;
$query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
$result =& $this->_doQuery($query, $is_manip, $connection, $this->database_name);
$result = $this->_doQuery($query, $is_manip, $connection, $this->database_name);
if (!PEAR::isError($result)) {
$result = $this->_affectedRows($connection, $result);
}
@ -754,7 +758,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
* @return result or error object
* @access protected
*/
function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
@ -794,7 +798,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
? 'mysql_query' : 'mysql_unbuffered_query';
$result = @$function($query, $connection);
if (!$result && 0 !== mysql_errno($connection)) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Could not execute statement', __FUNCTION__);
return $err;
}
@ -1032,7 +1036,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
* @access public
* @see bindParam, execute
*/
function &prepare($query, $types = null, $result_types = null, $lobs = array())
function prepare($query, $types = null, $result_types = null, $lobs = array())
{
// connect to get server capabilities (http://pear.php.net/bugs/16147)
$connection = $this->getConnection();
@ -1043,8 +1047,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
if ($this->options['emulate_prepared']
|| $this->supported['prepared_statements'] !== true
) {
$obj =& parent::prepare($query, $types, $result_types, $lobs);
return $obj;
return parent::prepare($query, $types, $result_types, $lobs);
}
$is_manip = ($result_types === MDB2_PREPARE_MANIP);
$offset = $this->offset;
@ -1104,7 +1107,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
$parameter = preg_replace($regexp, '\\1', $query);
if ($parameter === '') {
$err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
$err = $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
'named parameter name must match "bindname_format" option', __FUNCTION__);
return $err;
}
@ -1123,7 +1126,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$statement_name = sprintf($this->options['statement_format'], $this->phptype, $prep_statement_counter++ . sha1(microtime() + mt_rand()));
$statement_name = substr(strtolower($statement_name), 0, $this->options['max_identifiers_length']);
$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)) {
return $statement;
}
@ -1243,7 +1246,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$table = $this->quoteIdentifier($table, true);
$query = "REPLACE INTO $table ($query) VALUES ($values)";
$result =& $this->_doQuery($query, true, $connection);
$result = $this->_doQuery($query, true, $connection);
if (PEAR::isError($result)) {
return $result;
}
@ -1271,7 +1274,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)";
$this->pushErrorHandling(PEAR_ERROR_RETURN);
$this->expectError(MDB2_ERROR_NOSUCHTABLE);
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
$this->popExpect();
$this->popErrorHandling();
if (PEAR::isError($result)) {
@ -1290,7 +1293,7 @@ class MDB2_Driver_mysql extends MDB2_Driver_Common
$value = $this->lastInsertID();
if (is_numeric($value)) {
$query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
$this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
}
@ -1355,7 +1358,7 @@ class MDB2_Result_mysql extends MDB2_Result_Common
* @return int data array on success, a MDB2 error on failure
* @access public
*/
function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
{
if (!is_null($rownum)) {
$seek = $this->seek($rownum);
@ -1379,12 +1382,11 @@ class MDB2_Result_mysql extends MDB2_Result_Common
if (!$row) {
if ($this->result === false) {
$err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
$err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
'resultset has already been freed', __FUNCTION__);
return $err;
}
$null = null;
return $null;
return null;
}
$mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
$rtrim = false;
@ -1597,10 +1599,10 @@ class MDB2_Statement_mysql extends MDB2_Statement_Common
* a MDB2 error on failure
* @access private
*/
function &_execute($result_class = true, $result_wrap_class = false)
function _execute($result_class = true, $result_wrap_class = false)
{
if (is_null($this->statement)) {
$result =& parent::_execute($result_class, $result_wrap_class);
$result = parent::_execute($result_class, $result_wrap_class);
return $result;
}
$this->db->last_query = $this->query;
@ -1668,7 +1670,7 @@ class MDB2_Statement_mysql extends MDB2_Statement_Common
return $affected_rows;
}
$result =& $this->db->_wrapResult($result, $this->result_types,
$result = $this->db->_wrapResult($result, $this->result_types,
$result_class, $result_wrap_class, $this->limit, $this->offset);
$this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
return $result;

@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: mysqli.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: mysqli.php 295587 2010-02-28 17:16:38Z quipo $
//
/**
@ -336,7 +336,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
return MDB2_OK; //nothing to do
}
$query = $this->start_transaction ? 'START TRANSACTION' : 'SET AUTOCOMMIT = 0';
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -383,13 +383,13 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
'transactions are not supported', __FUNCTION__);
}
$result =& $this->_doQuery('COMMIT', true);
$result = $this->_doQuery('COMMIT', true);
if (PEAR::isError($result)) {
return $result;
}
if (!$this->start_transaction) {
$query = 'SET AUTOCOMMIT = 1';
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -429,13 +429,13 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
}
$query = 'ROLLBACK';
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
if (!$this->start_transaction) {
$query = 'SET AUTOCOMMIT = 1';
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -455,12 +455,16 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
* READ COMMITTED (prevents dirty reads)
* REPEATABLE READ (prevents nonrepeatable reads)
* SERIALIZABLE (prevents phantom reads)
* @param array some transaction options:
* 'wait' => 'WAIT' | 'NO WAIT'
* 'rw' => 'READ WRITE' | 'READ ONLY'
*
* @return mixed MDB2_OK on success, a MDB2 error on failure
*
* @access public
* @since 2.1.1
*/
function setTransactionIsolation($isolation)
function setTransactionIsolation($isolation, $options = array())
{
$this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
if (!$this->supports('transactions')) {
@ -613,7 +617,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
return $this->_doQuery($query, true, $connection);
}
if (!$result = mysqli_set_charset($connection, $charset)) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Could not set client character set', __FUNCTION__);
return $err;
}
@ -699,7 +703,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
* @return mixed MDB2_OK on success, a MDB2 error on failure
* @access public
*/
function &standaloneQuery($query, $types = null, $is_manip = false)
function standaloneQuery($query, $types = null, $is_manip = false)
{
$user = $this->options['DBA_username']? $this->options['DBA_username'] : $this->dsn['username'];
$pass = $this->options['DBA_password']? $this->options['DBA_password'] : $this->dsn['password'];
@ -713,7 +717,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
$this->offset = $this->limit = 0;
$query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
$result =& $this->_doQuery($query, $is_manip, $connection, $this->database_name);
$result = $this->_doQuery($query, $is_manip, $connection, $this->database_name);
if (!PEAR::isError($result)) {
$result = $this->_affectedRows($connection, $result);
}
@ -734,7 +738,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
* @return result or error object
* @access protected
*/
function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
@ -778,7 +782,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
}
if (!$result && 0 !== mysqli_errno($connection)) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Could not execute statement', __FUNCTION__);
return $err;
}
@ -786,12 +790,12 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
if ($this->options['multi_query']) {
if ($this->options['result_buffering']) {
if (!($result = @mysqli_store_result($connection))) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Could not get the first result from a multi query', __FUNCTION__);
return $err;
}
} elseif (!($result = @mysqli_use_result($connection))) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Could not get the first result from a multi query', __FUNCTION__);
return $err;
}
@ -1030,7 +1034,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
* @access public
* @see bindParam, execute
*/
function &prepare($query, $types = null, $result_types = null, $lobs = array())
function prepare($query, $types = null, $result_types = null, $lobs = array())
{
// connect to get server capabilities (http://pear.php.net/bugs/16147)
$connection = $this->getConnection();
@ -1041,8 +1045,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
if ($this->options['emulate_prepared']
|| $this->supported['prepared_statements'] !== true
) {
$obj =& parent::prepare($query, $types, $result_types, $lobs);
return $obj;
return parent::prepare($query, $types, $result_types, $lobs);
}
$is_manip = ($result_types === MDB2_PREPARE_MANIP);
$offset = $this->offset;
@ -1102,7 +1105,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
$regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
$parameter = preg_replace($regexp, '\\1', $query);
if ($parameter === '') {
$err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
$err = $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
'named parameter name must match "bindname_format" option', __FUNCTION__);
return $err;
}
@ -1123,7 +1126,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
$statement_name = substr(strtolower($statement_name), 0, $this->options['max_identifiers_length']);
$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)) {
return $statement;
}
@ -1131,7 +1134,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
} else {
$statement = @mysqli_prepare($connection, $query);
if (!$statement) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Unable to create prepared statement handle', __FUNCTION__);
return $err;
}
@ -1252,7 +1255,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
$table = $this->quoteIdentifier($table, true);
$query = "REPLACE INTO $table ($query) VALUES ($values)";
$result =& $this->_doQuery($query, true, $connection);
$result = $this->_doQuery($query, true, $connection);
if (PEAR::isError($result)) {
return $result;
}
@ -1280,7 +1283,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
$query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)";
$this->pushErrorHandling(PEAR_ERROR_RETURN);
$this->expectError(MDB2_ERROR_NOSUCHTABLE);
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
$this->popExpect();
$this->popErrorHandling();
if (PEAR::isError($result)) {
@ -1299,7 +1302,7 @@ class MDB2_Driver_mysqli extends MDB2_Driver_Common
$value = $this->lastInsertID();
if (is_numeric($value)) {
$query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
$this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
}
@ -1364,7 +1367,7 @@ class MDB2_Result_mysqli extends MDB2_Result_Common
* @return int data array on success, a MDB2 error on failure
* @access public
*/
function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
{
if (null !== $rownum) {
$seek = $this->seek($rownum);
@ -1392,8 +1395,7 @@ class MDB2_Result_mysqli extends MDB2_Result_Common
'resultset has already been freed', __FUNCTION__);
return $err;
}
$null = null;
return $null;
return null;
}
$mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
$rtrim = false;
@ -1667,10 +1669,10 @@ class MDB2_Statement_mysqli extends MDB2_Statement_Common
* a MDB2 error on failure
* @access private
*/
function &_execute($result_class = true, $result_wrap_class = false)
function _execute($result_class = true, $result_wrap_class = false)
{
if (null === $this->statement) {
$result =& parent::_execute($result_class, $result_wrap_class);
$result = parent::_execute($result_class, $result_wrap_class);
return $result;
}
$this->db->last_query = $this->query;
@ -1689,6 +1691,7 @@ class MDB2_Statement_mysqli extends MDB2_Statement_Common
$query = 'EXECUTE '.$this->statement;
}
if (!empty($this->positions)) {
$paramReferences = array();
$parameters = array(0 => $this->statement, 1 => '');
$lobs = array();
$i = 0;
@ -1730,15 +1733,18 @@ class MDB2_Statement_mysqli extends MDB2_Statement_Common
}
} else {
if (is_resource($value) || $type == 'clob' || $type == 'blob') {
$parameters[] = null;
$paramReferences[$i] = null;
// mysqli_stmt_bind_param() requires parameters to be passed by reference
$parameters[] =& $paramReferences[$i];
$parameters[1].= 'b';
$lobs[$i] = $parameter;
} else {
$quoted = $this->db->quote($value, $type, false);
if (PEAR::isError($quoted)) {
return $quoted;
$paramReferences[$i] = $this->db->quote($value, $type, false);
if (PEAR::isError($paramReferences[$i])) {
return $paramReferences[$i];
}
$parameters[] = $quoted;
// mysqli_stmt_bind_param() requires parameters to be passed by reference
$parameters[] =& $paramReferences[$i];
$parameters[1].= $this->db->datatype->mapPrepareDatatype($type);
}
++$i;
@ -1748,9 +1754,9 @@ class MDB2_Statement_mysqli extends MDB2_Statement_Common
if (!is_object($this->statement)) {
$query.= ' USING @'.implode(', @', array_values($this->positions));
} else {
$result = @call_user_func_array('mysqli_stmt_bind_param', $parameters);
$result = call_user_func_array('mysqli_stmt_bind_param', $parameters);
if (false === $result) {
$err =& $this->db->raiseError(null, null, null,
$err = $this->db->raiseError(null, null, null,
'Unable to bind parameters', __FUNCTION__);
return $err;
}
@ -1794,11 +1800,14 @@ class MDB2_Statement_mysqli extends MDB2_Statement_Common
return $affected_rows;
}
$result =& $this->db->_wrapResult($result, $this->result_types,
$result = $this->db->_wrapResult($result, $this->result_types,
$result_class, $result_wrap_class, $this->limit, $this->offset);
} else {
if (!@mysqli_stmt_execute($this->statement)) {
$err =& $this->db->raiseError(null, null, null,
//echo '<pre>'; var_dump($this->statement, mysqli_stmt_error($this->statement));exit;
if (!mysqli_stmt_execute($this->statement)) {
echo '<pre>'; var_dump($this->statement, mysqli_stmt_error($this->statement));exit;
$err = $this->db->raiseError(null, null, null,
'Unable to execute statement', __FUNCTION__);
return $err;
}
@ -1812,7 +1821,7 @@ class MDB2_Statement_mysqli extends MDB2_Statement_Common
@mysqli_stmt_store_result($this->statement);
}
$result =& $this->db->_wrapResult($this->statement, $this->result_types,
$result = $this->db->_wrapResult($this->statement, $this->result_types,
$result_class, $result_wrap_class, $this->limit, $this->offset);
}

@ -43,7 +43,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
//
// $Id: pgsql.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: pgsql.php 295587 2010-02-28 17:16:38Z quipo $
/**
* MDB2 PostGreSQL driver
@ -251,7 +251,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
$this->destructor_registered = true;
register_shutdown_function('MDB2_closeOpenTransactions');
}
$result =& $this->_doQuery('BEGIN', true);
$result = $this->_doQuery('BEGIN', true);
if (PEAR::isError($result)) {
return $result;
}
@ -285,7 +285,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
return $this->_doQuery($query, true);
}
$result =& $this->_doQuery('COMMIT', true);
$result = $this->_doQuery('COMMIT', true);
if (PEAR::isError($result)) {
return $result;
}
@ -320,7 +320,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
}
$query = 'ROLLBACK';
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -339,12 +339,16 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
* READ COMMITTED (prevents dirty reads)
* REPEATABLE READ (prevents nonrepeatable reads)
* SERIALIZABLE (prevents phantom reads)
* @param array some transaction options:
* 'wait' => 'WAIT' | 'NO WAIT'
* 'rw' => 'READ WRITE' | 'READ ONLY'
*
* @return mixed MDB2_OK on success, a MDB2 error on failure
*
* @access public
* @since 2.1.1
*/
function setTransactionIsolation($isolation)
function setTransactionIsolation($isolation, $options = array())
{
$this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
switch ($isolation) {
@ -619,7 +623,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
// }}}
// {{{ standaloneQuery()
/**
/**
* execute a query as DBA
*
* @param string $query the SQL query
@ -629,7 +633,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
* @return mixed MDB2_OK on success, a MDB2 error on failure
* @access public
*/
function &standaloneQuery($query, $types = null, $is_manip = false)
function standaloneQuery($query, $types = null, $is_manip = false)
{
$user = $this->options['DBA_username']? $this->options['DBA_username'] : $this->dsn['username'];
$pass = $this->options['DBA_password']? $this->options['DBA_password'] : $this->dsn['password'];
@ -643,7 +647,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
$this->offset = $this->limit = 0;
$query = $this->_modifyQuery($query, $is_manip, $limit, $offset);
$result =& $this->_doQuery($query, $is_manip, $connection, $this->database_name);
$result = $this->_doQuery($query, $is_manip, $connection, $this->database_name);
if (!PEAR::isError($result)) {
if ($is_manip) {
$result = $this->_affectedRows($connection, $result);
@ -668,7 +672,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
* @return result or error object
* @access protected
*/
function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
@ -693,12 +697,12 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
$function = $this->options['multi_query'] ? 'pg_send_query' : 'pg_query';
$result = @$function($connection, $query);
if (!$result) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Could not execute statement', __FUNCTION__);
return $err;
} elseif ($this->options['multi_query']) {
if (!($result = @pg_get_result($connection))) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Could not get the first result from a multi query', __FUNCTION__);
return $err;
}
@ -865,11 +869,10 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
* @access public
* @see bindParam, execute
*/
function &prepare($query, $types = null, $result_types = null, $lobs = array())
function prepare($query, $types = null, $result_types = null, $lobs = array())
{
if ($this->options['emulate_prepared']) {
$obj =& parent::prepare($query, $types, $result_types, $lobs);
return $obj;
return parent::prepare($query, $types, $result_types, $lobs);
}
$is_manip = ($result_types === MDB2_PREPARE_MANIP);
$offset = $this->offset;
@ -940,7 +943,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
$regexp = '/^.{'.($position+1).'}('.$this->options['bindname_format'].').*$/s';
$param = preg_replace($regexp, '\\1', $query);
if ($param === '') {
$err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
$err = $this->raiseError(MDB2_ERROR_SYNTAX, null, null,
'named parameter name must match "bindname_format" option', __FUNCTION__);
return $err;
}
@ -985,7 +988,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
if (false === $pgtypes) {
$result = @pg_prepare($connection, $statement_name, $query);
if (!$result) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Unable to create prepared statement handle', __FUNCTION__);
return $err;
}
@ -995,7 +998,7 @@ class MDB2_Driver_pgsql extends MDB2_Driver_Common
$types_string = ' ('.implode(', ', $pgtypes).') ';
}
$query = 'PREPARE '.$statement_name.$types_string.' AS '.$query;
$statement =& $this->_doQuery($query, true, $connection);
$statement = $this->_doQuery($query, true, $connection);
if (PEAR::isError($statement)) {
return $statement;
}
@ -1164,7 +1167,7 @@ class MDB2_Result_pgsql extends MDB2_Result_Common
* @return int data array on success, a MDB2 error on failure
* @access public
*/
function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
{
if (null !== $rownum) {
$seek = $this->seek($rownum);
@ -1187,12 +1190,11 @@ class MDB2_Result_pgsql extends MDB2_Result_Common
}
if (!$row) {
if (false === $this->result) {
$err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
$err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
'resultset has already been freed', __FUNCTION__);
return $err;
}
$null = null;
return $null;
return null;
}
$mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
$rtrim = false;
@ -1427,11 +1429,10 @@ class MDB2_Statement_pgsql extends MDB2_Statement_Common
* a MDB2 error on failure
* @access private
*/
function &_execute($result_class = true, $result_wrap_class = false)
function _execute($result_class = true, $result_wrap_class = false)
{
if (null === $this->statement) {
$result =& parent::_execute($result_class, $result_wrap_class);
return $result;
return parent::_execute($result_class, $result_wrap_class);
}
$this->db->last_query = $this->query;
$this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'pre', 'parameters' => $this->values));
@ -1492,7 +1493,7 @@ class MDB2_Statement_pgsql extends MDB2_Statement_Common
if (!$query) {
$result = @pg_execute($connection, $this->statement, $parameters);
if (!$result) {
$err =& $this->db->raiseError(null, null, null,
$err = $this->db->raiseError(null, null, null,
'Unable to execute statement', __FUNCTION__);
return $err;
}
@ -1508,7 +1509,7 @@ class MDB2_Statement_pgsql extends MDB2_Statement_Common
return $affected_rows;
}
$result =& $this->db->_wrapResult($result, $this->result_types,
$result = $this->db->_wrapResult($result, $this->result_types,
$result_class, $result_wrap_class, $this->limit, $this->offset);
$this->db->debug($this->query, 'execute', array('is_manip' => $this->is_manip, 'when' => 'post', 'result' => $result));
return $result;

@ -43,7 +43,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: sqlite.php 292715 2009-12-28 14:06:34Z quipo $
// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $
//
/**
@ -206,7 +206,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
register_shutdown_function('MDB2_closeOpenTransactions');
}
$query = 'BEGIN TRANSACTION '.$this->options['base_transaction_name'];
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -241,7 +241,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
}
$query = 'COMMIT TRANSACTION '.$this->options['base_transaction_name'];
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -276,7 +276,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
}
$query = 'ROLLBACK TRANSACTION '.$this->options['base_transaction_name'];
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
return $result;
}
@ -295,12 +295,16 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
* READ COMMITTED (prevents dirty reads)
* REPEATABLE READ (prevents nonrepeatable reads)
* SERIALIZABLE (prevents phantom reads)
* @param array some transaction options:
* 'wait' => 'WAIT' | 'NO WAIT'
* 'rw' => 'READ WRITE' | 'READ ONLY'
*
* @return mixed MDB2_OK on success, a MDB2 error on failure
*
* @access public
* @since 2.1.1
*/
function setTransactionIsolation($isolation)
function setTransactionIsolation($isolation, $options = array())
{
$this->debug('Setting transaction isolation level', __FUNCTION__, array('is_manip' => true));
switch ($isolation) {
@ -500,7 +504,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
* @return result or error object
* @access protected
*/
function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
@ -539,7 +543,11 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
$this->_lasterror = $php_errormsg;
if (!$result) {
$err =& $this->raiseError(null, null, null,
$code = null;
if (0 === strpos($this->_lasterror, 'no such table')) {
$code = MDB2_ERROR_NOSUCHTABLE;
}
$err = $this->raiseError($code, null, null,
'Could not execute statement', __FUNCTION__);
return $err;
}
@ -754,7 +762,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
$table = $this->quoteIdentifier($table, true);
$query = "REPLACE INTO $table ($query) VALUES ($values)";
$result =& $this->_doQuery($query, true, $connection);
$result = $this->_doQuery($query, true, $connection);
if (PEAR::isError($result)) {
return $result;
}
@ -782,7 +790,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
$query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (NULL)";
$this->pushErrorHandling(PEAR_ERROR_RETURN);
$this->expectError(MDB2_ERROR_NOSUCHTABLE);
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
$this->popExpect();
$this->popErrorHandling();
if (PEAR::isError($result)) {
@ -801,7 +809,7 @@ class MDB2_Driver_sqlite extends MDB2_Driver_Common
$value = $this->lastInsertID();
if (is_numeric($value)) {
$query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
$this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
}
@ -874,7 +882,7 @@ class MDB2_Result_sqlite extends MDB2_Result_Common
* @return int data array on success, a MDB2 error on failure
* @access public
*/
function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
{
if (null !== $rownum) {
$seek = $this->seek($rownum);
@ -897,12 +905,11 @@ class MDB2_Result_sqlite extends MDB2_Result_Common
}
if (!$row) {
if (false === $this->result) {
$err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
$err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
'resultset has already been freed', __FUNCTION__);
return $err;
}
$null = null;
return $null;
return null;
}
$mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
$rtrim = false;

@ -479,7 +479,7 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common
$query = $this->_modifyQuery($query, $is_manip, $this->limit, $this->offset);
$this->offset = $this->limit = 0;
$result =& $this->_doQuery($query, $is_manip, $connection);
$result = $this->_doQuery($query, $is_manip, $connection);
if (!PEAR::isError($result)) {
$result = $this->_affectedRows($connection, $result);
}
@ -500,7 +500,7 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common
* @return result or error object
* @access protected
*/
function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null)
function _doQuery($query, $is_manip = false, $connection = null, $database_name = null)
{
$this->last_query = $query;
$result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre'));
@ -539,7 +539,7 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common
$query = preg_replace('/DATE_FORMAT\(([\w|.]*)\, \'\%Y\-\%m\-\%d %H\:00\:00\'\)/i','CONVERT(varchar(13),$1,120)+\':00:00\'',$query);
$result = @sqlsrv_query($connection,$query);
if (!$result) {
$err =& $this->raiseError(null, null, null,
$err = $this->raiseError(null, null, null,
'Could not execute statement', __FUNCTION__);
return $err;
}
@ -689,7 +689,7 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common
} else {
$query = "INSERT INTO $sequence_name ($seqcol_name) VALUES (0)";
}
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
$this->popExpect();
$this->popErrorHandling();
if (PEAR::isError($result)) {
@ -723,7 +723,7 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common
$value = $this->lastInsertID($sequence_name);
if (is_numeric($value)) {
$query = "DELETE FROM $sequence_name WHERE $seqcol_name < $value";
$result =& $this->_doQuery($query, true);
$result = $this->_doQuery($query, true);
if (PEAR::isError($result)) {
$this->warnings[] = 'nextID: could not delete previous sequence table values from '.$seq_name;
}
@ -764,15 +764,15 @@ class MDB2_Driver_sqlsrv extends MDB2_Driver_Common
*/
class MDB2_Result_sqlsrv extends MDB2_Result_Common
{
// {{{ constructor: function __construct(&$db, &$result, $limit = 0, $offset = 0)
// {{{ constructor: function __construct($db, $result, $limit = 0, $offset = 0)
/**
* Constructor
*/
function __construct(&$db, &$result, $limit = 0, $offset = 0)
function __construct($db, $result, $limit = 0, $offset = 0)
{
$this->db =& $db;
$this->result =& $result;
$this->db = $db;
$this->result = $result;
$this->offset = $offset;
$this->limit = max(0, $limit - 1);
$this->cursor = 0;
@ -787,11 +787,12 @@ class MDB2_Result_sqlsrv extends MDB2_Result_Common
continue;
}
foreach ($row as $k => $v) {
if (is_object($v) && method_exists($v, 'format')) {//DateTime Object
$row[$k] = $v->format("Y-m-d H:i:s");
if (is_object($v) && method_exists($v, 'format')) {
//DateTime Object
$row[$k] = $v->format('Y-m-d H:i:s');
}
}
$this->rows[] = $row;//read results into memory, cursors are not supported
$this->rows[] = $row; //read results into memory, cursors are not supported
}
}
$this->rowcnt = count($this->rows);
@ -848,14 +849,13 @@ class MDB2_Result_sqlsrv extends MDB2_Result_Common
* @return int data array on success, a MDB2 error on failure
* @access public
*/
function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null)
{
if (!$this->result) {
return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, 'no valid statement given', __FUNCTION__);
}
if (($this->limit && $this->rownum >= $this->limit) || ($this->cursor >= $this->rowcnt || $this->rowcnt == 0)) {
$null = null;
return $null;
return null;
}
if (null !== $rownum) {
$seek = $this->seek($rownum);
@ -911,12 +911,11 @@ class MDB2_Result_sqlsrv extends MDB2_Result_Common
}
if (!$row) {
if (false === $this->result) {
$err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
$err = $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
'resultset has already been freed', __FUNCTION__);
return $err;
}
$null = null;
return $null;
return null;
}
$mode = $this->db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL;
$rtrim = false;
@ -1162,4 +1161,4 @@ class MDB2_Statement_sqlsrv extends MDB2_Statement_Common
// }}}
?>
?>

@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
// $Id: Iterator.php 212543 2006-05-06 14:03:41Z lsmith $
// $Id: Iterator.php 295586 2010-02-28 17:04:17Z quipo $
/**
* PHP5 Iterator
@ -112,7 +112,7 @@ class MDB2_Iterator implements Iterator
*/
public function current()
{
if (is_null($this->row)) {
if (null === $this->row) {
$row = $this->result->fetchRow($this->fetchmode);
if (PEAR::isError($row)) {
$row = false;

Loading…
Cancel
Save