From 390959bb323679f7611ee1585d8e1f55007c7773 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sun, 22 Apr 2012 13:24:06 -0400
Subject: [PATCH] - Small code improvements

---
 program/lib/MDB2.php |  277 ++++++++++++++++++-------------------------------------
 1 files changed, 91 insertions(+), 186 deletions(-)

diff --git a/program/lib/MDB2.php b/program/lib/MDB2.php
index a5128c9..61486a6 100644
--- a/program/lib/MDB2.php
+++ b/program/lib/MDB2.php
@@ -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 @@
  */
 class MDB2
 {
-    // {{{ function setOptions(&$db, $options)
+    // {{{ function setOptions($db, $options)
 
     /**
      * set option array   in an exiting database object
@@ -279,7 +279,7 @@
      *
      * @access  public
      */
-    function setOptions(&$db, $options)
+    static function setOptions($db, $options)
     {
         if (is_array($options)) {
             foreach ($options as $option => $value) {
@@ -304,12 +304,9 @@
      * @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 @@
      *
      * @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 @@
                 } 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,20 +350,10 @@
     }
 
     // }}}
-    // {{{ 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.
@@ -379,11 +366,11 @@
      *
      * @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,22 +393,11 @@
     }
 
     // }}}
-    // {{{ 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.
@@ -436,9 +412,9 @@
      * @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,23 +431,12 @@
     }
 
     // }}}
-    // {{{ 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.
@@ -486,7 +451,7 @@
      * @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 @@
                 }
             }
         } 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 @@
      * @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 @@
     /**
      * 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 @@
      *
      * @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)) {
-                return $data->getMessage() === $code;
-            } else {
-                $code = (array)$code;
-                return in_array($data->getCode(), $code);
             }
+            if (is_string($code)) {
+                return $data->getMessage() === $code;
+            }
+            return in_array($data->getCode(), (array)$code);
         }
         return false;
     }
@@ -654,12 +617,11 @@
      * @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 @@
     /**
      * 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 @@
     /**
      * 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 @@
      */
     function isStatement($value)
     {
-        return is_a($value, 'MDB2_Statement_Common');
+        return ($value instanceof MDB2_Statement_Common);
     }
 
     // }}}
@@ -829,7 +791,7 @@
      * @access  public
      * @author  Tomas V.V.Cox <cox@idecnet.com>
      */
-    function parseDSN($dsn)
+    static function parseDSN($dsn)
     {
         $parsed = $GLOBALS['_MDB2_dsninfo_default'];
 
@@ -926,10 +888,10 @@
         if ($dsn) {
             // /database
             if (($pos = strpos($dsn, '?')) === false) {
-                $parsed['database'] = $dsn;
+                $parsed['database'] = rawurldecode($dsn);
             // /database?param1=value1&param2=value2
             } else {
-                $parsed['database'] = substr($dsn, 0, $pos);
+                $parsed['database'] = rawurldecode(substr($dsn, 0, $pos));
                 $dsn = substr($dsn, $pos + 1);
                 if (strpos($dsn, '&') !== false) {
                     $opts = explode('&', $dsn);
@@ -961,7 +923,7 @@
      *
      * @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 @@
      * @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) {
@@ -1356,18 +1318,6 @@
     }
 
     // }}}
-    // {{{ function MDB2_Driver_Common()
-
-    /**
-     * PHP 4 Constructor
-     */
-    function MDB2_Driver_Common()
-    {
-        $this->destructor_registered = false;
-        $this->__construct();
-    }
-
-    // }}}
     // {{{ destructor: function __destruct()
 
     /**
@@ -1501,10 +1451,10 @@
             }
         }
 
-        $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 @@
     }
 
     // }}}
-    // {{{ function &loadModule($module, $property = null, $phptype_specific = null)
+    // {{{ function loadModule($module, $property = null, $phptype_specific = null)
 
     /**
      * loads a module
@@ -1901,7 +1851,7 @@
      *
      * @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 @@
             }
 
             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 @@
             $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 @@
      *
      * @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 @@
             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 @@
             $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 @@
      *
      * @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 @@
             }
             $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 @@
      *
      * @access  public
      */
-    function &exec($query)
+    function exec($query)
     {
         $offset = $this->offset;
         $limit = $this->limit;
@@ -2556,7 +2506,7 @@
             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 @@
      *
      * @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 @@
             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 @@
      *
      * @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 @@
         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 @@
         }
         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 @@
 
         $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 @@
             }
             $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 @@
      * @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 @@
                     $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 @@
      */
     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 @@
                             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,28 +3394,17 @@
     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);
     }
 
     // }}}
@@ -3543,9 +3483,9 @@
      *
      * @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;
     }
@@ -3926,19 +3866,6 @@
     }
 
     // }}}
-    // {{{ function MDB2_Row(&$row)
-
-    /**
-     * PHP 4 Constructor
-     *
-     * @param   resource    row data as array
-     */
-    function MDB2_Row(&$row)
-    {
-        $this->__construct($row);
-    }
-
-    // }}}
 }
 
 // }}}
@@ -3966,15 +3893,15 @@
     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;
@@ -3982,17 +3909,6 @@
         $this->limit = $limit;
         $this->is_manip = $is_manip;
         $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);
     }
 
     // }}}
@@ -4141,7 +4057,7 @@
      *               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 @@
                                             '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 @@
      *               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 @@
         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 @@
     }
 
     // }}}
-    // {{{ 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 @@
      *
      * @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;

--
Gitblit v1.9.1