} 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;
}
}
{
$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;
}
*/
function &connect($dsn, $options = false)
{
- $db =& MDB2::factory($dsn, $options);
+ $db =MDB2::factory($dsn, $options);
if (PEAR::isError($db)) {
return $db;
}
}
}
} elseif (is_array($GLOBALS['_MDB2_databases']) && reset($GLOBALS['_MDB2_databases'])) {
- $db =& $GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])];
+ $db =$GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])];
return $db;
}
- $db =& MDB2::factory($dsn, $options);
+ $db =MDB2::factory($dsn, $options);
return $db;
}
* @access private
* @see PEAR_Error
*/
- function &raiseError($code = null,
+ static function raiseError($code = null,
$mode = null,
$options = null,
$userinfo = null,
$dummy2 = null,
$dummy3 = false)
{
- $err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
+ $err =PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true);
return $err;
}
*
* @param mixed MDB2 error code, or string with error message.
* @param int what 'error mode' to operate in
- * @param int what error level to use for $mode & PEAR_ERROR_TRIGGER
+ * @param int what error level to use for $mode raPEAR_ERROR_TRIGGER
* @param mixed additional debug info, such as the last query
*/
function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN,
* @access public
* @see PEAR_Error
*/
- function &raiseError($code = null,
+ static function &raiseError($code = null,
$mode = null,
$options = null,
$userinfo = null,
$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;
}
}
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
return $connection;
}
- $result =& $this->_doQuery($query, $is_manip, $connection, false);
+ $result =$this->_doQuery($query, $is_manip, $connection, false);
if (PEAR::isError($result)) {
return $result;
}
$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;
}
}
$query = $result;
}
- $err =& $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
+ $err =$this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
'method not implemented', __FUNCTION__);
return $err;
}
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;
}
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;
}
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, $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;
}
}
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;
}
$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 = '';
}
$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);;
}
$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;
}
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;
}
*/
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 &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;
}
}
$column = $column_names[$column];
}
- $this->values[$column] =& $value;
+ $this->values[$column] =$value;
if (!is_null($type)) {
$this->types[$column] = $type;
}
*/
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;
return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null,
'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__);
}
- $this->values[$parameter] =& $value;
+ $this->values[$parameter] =$value;
if (!is_null($type)) {
$this->types[$parameter] = $type;
}
'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;
}
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;
}
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;