Ignore:
Timestamp:
2013/08/02 13:22:57 (13 years ago)
Author:
Seasoft
Message:

#2322 (セッションのGC処理がエラーとなる)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/data/module/MDB2.php

    r20764 r23022  
    4444// +----------------------------------------------------------------------+ 
    4545// 
    46 // $Id: MDB2.php,v 1.335 2008/11/29 14:57:01 afz Exp $ 
     46// $Id: MDB2.php 328183 2012-10-29 15:10:42Z danielc $ 
    4747// 
    4848 
     
    268268class MDB2 
    269269{ 
    270     // {{{ function setOptions(&$db, $options) 
     270    // {{{ function setOptions($db, $options) 
    271271 
    272272    /** 
     
    280280     * @access  public 
    281281     */ 
    282     function setOptions(&$db, $options) 
     282    static function setOptions($db, $options) 
    283283    { 
    284284        if (is_array($options)) { 
    285285            foreach ($options as $option => $value) { 
    286286                $test = $db->setOption($option, $value); 
    287                 if (PEAR::isError($test)) { 
     287                if (MDB2::isError($test)) { 
    288288                    return $test; 
    289289                } 
     
    305305     * @access  public 
    306306     */ 
    307     function classExists($classname) 
    308     { 
    309         if (version_compare(phpversion(), "5.0", ">=")) { 
    310             return class_exists($classname, false); 
    311         } 
    312         return class_exists($classname); 
     307    static function classExists($classname) 
     308    { 
     309        return class_exists($classname, false); 
    313310    } 
    314311 
     
    326323     * @access  public 
    327324     */ 
    328     function loadClass($class_name, $debug) 
     325    static function loadClass($class_name, $debug) 
    329326    { 
    330327        if (!MDB2::classExists($class_name)) { 
     
    341338                    $msg = "unable to load class '$class_name' from file '$file_name'"; 
    342339                } 
    343                 $err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg); 
     340                $err = MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg); 
    344341                return $err; 
    345342            } 
     343            if (!MDB2::classExists($class_name)) { 
     344                $msg = "unable to load class '$class_name' from file '$file_name'"; 
     345                $err = MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, $msg); 
     346                return $err; 
     347            } 
    346348        } 
    347349        return MDB2_OK; 
     
    349351 
    350352    // }}} 
    351     // {{{ function &factory($dsn, $options = false) 
     353    // {{{ function factory($dsn, $options = false) 
    352354 
    353355    /** 
    354356     * Create a new MDB2 object for the specified database type 
    355      * 
    356      * IMPORTANT: In order for MDB2 to work properly it is necessary that 
    357      * you make sure that you work with a reference of the original 
    358      * object instead of a copy (this is a PHP4 quirk). 
    359      * 
    360      * For example: 
    361      *     $db =& MDB2::factory($dsn); 
    362      *          ^^ 
    363      * And not: 
    364      *     $db = MDB2::factory($dsn); 
    365357     * 
    366358     * @param   mixed   'data source name', see the MDB2::parseDSN 
     
    375367     * @access  public 
    376368     */ 
    377     function &factory($dsn, $options = false) 
     369    static function factory($dsn, $options = false) 
    378370    { 
    379371        $dsninfo = MDB2::parseDSN($dsn); 
    380372        if (empty($dsninfo['phptype'])) { 
    381             $err =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, 
     373            $err = MDB2::raiseError(MDB2_ERROR_NOT_FOUND, 
    382374                null, null, 'no RDBMS driver specified'); 
    383375            return $err; 
     
    387379        $debug = (!empty($options['debug'])); 
    388380        $err = MDB2::loadClass($class_name, $debug); 
    389         if (PEAR::isError($err)) { 
     381        if (MDB2::isError($err)) { 
    390382            return $err; 
    391383        } 
    392384 
    393         $db =& new $class_name(); 
     385        $db = new $class_name(); 
    394386        $db->setDSN($dsninfo); 
    395387        $err = MDB2::setOptions($db, $options); 
    396         if (PEAR::isError($err)) { 
     388        if (MDB2::isError($err)) { 
    397389            return $err; 
    398390        } 
     
    402394 
    403395    // }}} 
    404     // {{{ function &connect($dsn, $options = false) 
     396    // {{{ function connect($dsn, $options = false) 
    405397 
    406398    /** 
    407399     * Create a new MDB2_Driver_* connection object and connect to the specified 
    408400     * database 
    409      * 
    410      * IMPORTANT: In order for MDB2 to work properly it is necessary that 
    411      * you make sure that you work with a reference of the original 
    412      * object instead of a copy (this is a PHP4 quirk). 
    413      * 
    414      * For example: 
    415      *     $db =& MDB2::connect($dsn); 
    416      *          ^^ 
    417      * And not: 
    418      *     $db = MDB2::connect($dsn); 
    419      *          ^^ 
    420401     * 
    421402     * @param mixed $dsn     'data source name', see the MDB2::parseDSN 
     
    432413     * @see     MDB2::parseDSN 
    433414     */ 
    434     function &connect($dsn, $options = false) 
    435     { 
    436         $db =& MDB2::factory($dsn, $options); 
    437         if (PEAR::isError($db)) { 
     415    static function connect($dsn, $options = false) 
     416    { 
     417        $db = MDB2::factory($dsn, $options); 
     418        if (MDB2::isError($db)) { 
    438419            return $db; 
    439420        } 
    440421 
    441422        $err = $db->connect(); 
    442         if (PEAR::isError($err)) { 
     423        if (MDB2::isError($err)) { 
    443424            $dsn = $db->getDSN('string', 'xxx'); 
    444425            $db->disconnect(); 
     
    451432 
    452433    // }}} 
    453     // {{{ function &singleton($dsn = null, $options = false) 
     434    // {{{ function singleton($dsn = null, $options = false) 
    454435 
    455436    /** 
     
    457438     * A new MDB2 connection object is only created if no object with the 
    458439     * requested DSN exists yet. 
    459      * 
    460      * IMPORTANT: In order for MDB2 to work properly it is necessary that 
    461      * you make sure that you work with a reference of the original 
    462      * object instead of a copy (this is a PHP4 quirk). 
    463      * 
    464      * For example: 
    465      *     $db =& MDB2::singleton($dsn); 
    466      *          ^^ 
    467      * And not: 
    468      *     $db = MDB2::singleton($dsn); 
    469      *          ^^ 
    470440     * 
    471441     * @param   mixed   'data source name', see the MDB2::parseDSN 
     
    482452     * @see     MDB2::parseDSN 
    483453     */ 
    484     function &singleton($dsn = null, $options = false) 
     454    static function singleton($dsn = null, $options = false) 
    485455    { 
    486456        if ($dsn) { 
     
    498468            } 
    499469        } elseif (is_array($GLOBALS['_MDB2_databases']) && reset($GLOBALS['_MDB2_databases'])) { 
    500             $db =& $GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])]; 
    501             return $db; 
    502         } 
    503         $db =& MDB2::factory($dsn, $options); 
     470            return $GLOBALS['_MDB2_databases'][key($GLOBALS['_MDB2_databases'])]; 
     471        } 
     472        $db = MDB2::factory($dsn, $options); 
    504473        return $db; 
    505474    } 
     
    517486     * @return boolean 
    518487     */ 
    519     function areEquals($arr1, $arr2) 
     488    static function areEquals($arr1, $arr2) 
    520489    { 
    521490        if (count($arr1) != count($arr2)) { 
     
    536505     * load a file (like 'Date') 
    537506     * 
    538      * @param   string name of the file in the MDB2 directory (without '.php') 
    539      * 
    540      * @return  string name of the file that was included 
    541      * 
    542      * @access  public 
    543      */ 
    544     function loadFile($file) 
     507     * @param string $file name of the file in the MDB2 directory (without '.php') 
     508     * 
     509     * @return string name of the file that was included 
     510     * 
     511     * @access  public 
     512     */ 
     513    static function loadFile($file) 
    545514    { 
    546515        $file_name = 'MDB2'.DIRECTORY_SEPARATOR.$file.'.php'; 
     
    566535     * @access  public 
    567536     */ 
    568     function apiVersion() 
    569     { 
    570         return '2.5.0b2'; 
     537    static function apiVersion() 
     538    { 
     539        return '2.5.0b5'; 
    571540    } 
    572541 
     
    598567     * @see     PEAR_Error 
    599568     */ 
    600     function &raiseError($code = null, 
     569    public static function &raiseError($code = null, 
    601570                         $mode = null, 
    602571                         $options = null, 
     
    606575                         $dummy3 = false) 
    607576    { 
    608         $err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); 
     577        $pear = new PEAR; 
     578        $err =& $pear->raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); 
    609579        return $err; 
    610580    } 
     
    626596     * @access  public 
    627597     */ 
    628     function isError($data, $code = null) 
    629     { 
    630         if (is_a($data, 'MDB2_Error')) { 
    631             if (is_null($code)) { 
     598    static function isError($data, $code = null) 
     599    { 
     600        if ($data instanceof MDB2_Error) { 
     601            if (null === $code) { 
    632602                return true; 
    633             } elseif (is_string($code)) { 
     603            } 
     604            if (is_string($code)) { 
    634605                return $data->getMessage() === $code; 
    635             } else { 
    636                 $code = (array)$code; 
    637                 return in_array($data->getCode(), $code); 
    638             } 
     606            } 
     607            return in_array($data->getCode(), (array)$code); 
    639608        } 
    640609        return false; 
     
    650619     * 
    651620     * @return  bool    whether $value is a MDB2 connection 
    652      * 
    653      * @access  public 
    654      */ 
    655     function isConnection($value) 
    656     { 
    657         return is_a($value, 'MDB2_Driver_Common'); 
     621     * @access  public 
     622     */ 
     623    static function isConnection($value) 
     624    { 
     625        return ($value instanceof MDB2_Driver_Common); 
    658626    } 
    659627 
     
    664632     * Tell whether a value is a MDB2 result 
    665633     * 
     634     * @param mixed $value value to test 
     635     * 
     636     * @return bool whether $value is a MDB2 result 
     637     * 
     638     * @access public 
     639     */ 
     640    static function isResult($value) 
     641    { 
     642        return ($value instanceof MDB2_Result); 
     643    } 
     644 
     645    // }}} 
     646    // {{{ function isResultCommon($value) 
     647 
     648    /** 
     649     * Tell whether a value is a MDB2 result implementing the common interface 
     650     * 
     651     * @param mixed $value value to test 
     652     * 
     653     * @return bool whether $value is a MDB2 result implementing the common interface 
     654     * 
     655     * @access  public 
     656     */ 
     657    static function isResultCommon($value) 
     658    { 
     659        return ($value instanceof MDB2_Result_Common); 
     660    } 
     661 
     662    // }}} 
     663    // {{{ function isStatement($value) 
     664 
     665    /** 
     666     * Tell whether a value is a MDB2 statement interface 
     667     * 
    666668     * @param   mixed   value to test 
    667669     * 
    668      * @return  bool    whether $value is a MDB2 result 
    669      * 
    670      * @access  public 
    671      */ 
    672     function isResult($value) 
    673     { 
    674         return is_a($value, 'MDB2_Result'); 
    675     } 
    676  
    677     // }}} 
    678     // {{{ function isResultCommon($value) 
    679  
    680     /** 
    681      * Tell whether a value is a MDB2 result implementing the common interface 
    682      * 
    683      * @param   mixed   value to test 
    684      * 
    685      * @return  bool    whether $value is a MDB2 result implementing the common interface 
    686      * 
    687      * @access  public 
    688      */ 
    689     function isResultCommon($value) 
    690     { 
    691         return is_a($value, 'MDB2_Result_Common'); 
    692     } 
    693  
    694     // }}} 
    695     // {{{ function isStatement($value) 
    696  
    697     /** 
    698      * Tell whether a value is a MDB2 statement interface 
    699      * 
    700      * @param   mixed   value to test 
    701      * 
    702670     * @return  bool    whether $value is a MDB2 statement interface 
    703671     * 
    704672     * @access  public 
    705673     */ 
    706     function isStatement($value) 
    707     { 
    708         return is_a($value, 'MDB2_Statement_Common'); 
     674    static function isStatement($value) 
     675    { 
     676        return ($value instanceof MDB2_Statement_Common); 
    709677    } 
    710678 
     
    724692     * @access  public 
    725693     */ 
    726     function errorMessage($value = null) 
     694    static function errorMessage($value = null) 
    727695    { 
    728696        static $errorMessages; 
     
    773741        } 
    774742 
    775         if (is_null($value)) { 
     743        if (null === $value) { 
    776744            return $errorMessages; 
    777745        } 
    778746 
    779         if (PEAR::isError($value)) { 
     747        if (MDB2::isError($value)) { 
    780748            $value = $value->getCode(); 
    781749        } 
     
    825793     * @author  Tomas V.V.Cox <[email protected]> 
    826794     */ 
    827     function parseDSN($dsn) 
     795    static function parseDSN($dsn) 
    828796    { 
    829797        $parsed = $GLOBALS['_MDB2_dsninfo_default']; 
     
    894862                //e.g. "scott/tiger@//mymachine:1521/oracle" 
    895863                $proto_opts = $dsn; 
    896                 $dsn = substr($proto_opts, strrpos($proto_opts, '/') + 1); 
     864                $pos = strrpos($proto_opts, '/'); 
     865                $dsn = substr($proto_opts, $pos + 1); 
     866                $proto_opts = substr($proto_opts, 0, $pos); 
    897867            } elseif (strpos($dsn, '/') !== false) { 
    898868                list($proto_opts, $dsn) = explode('/', $dsn, 2); 
     
    920890            // /database 
    921891            if (($pos = strpos($dsn, '?')) === false) { 
    922                 $parsed['database'] = $dsn; 
     892                $parsed['database'] = rawurldecode($dsn); 
    923893            // /database?param1=value1&param2=value2 
    924894            } else { 
    925                 $parsed['database'] = substr($dsn, 0, $pos); 
     895                $parsed['database'] = rawurldecode(substr($dsn, 0, $pos)); 
    926896                $dsn = substr($dsn, $pos + 1); 
    927897                if (strpos($dsn, '&') !== false) { 
     
    932902                foreach ($opts as $opt) { 
    933903                    list($key, $value) = explode('=', $opt); 
    934                     if (!isset($parsed[$key])) { 
     904                    if (!array_key_exists($key, $parsed) || false === $parsed[$key]) { 
    935905                        // don't allow params overwrite 
    936906                        $parsed[$key] = rawurldecode($value); 
     
    955925     * @access  public 
    956926     */ 
    957     function fileExists($file) 
     927    static function fileExists($file) 
    958928    { 
    959929        // safe_mode does notwork with is_readable() 
     
    1000970     * @param   mixed   additional debug info, such as the last query 
    1001971     */ 
    1002     function MDB2_Error($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, 
     972    function __construct($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, 
    1003973              $level = E_USER_NOTICE, $debuginfo = null, $dummy = null) 
    1004974    { 
    1005         if (is_null($code)) { 
     975        if (null === $code) { 
    1006976            $code = MDB2_ERROR; 
    1007977        } 
     
    1023993 * @author      Lukas Smith <[email protected]> 
    1024994 */ 
    1025 class MDB2_Driver_Common extends PEAR 
     995class MDB2_Driver_Common 
    1026996{ 
    1027997    // {{{ Variables (Properties) 
    1028998 
    1029999    /** 
     1000     * @var MDB2_Driver_Datatype_Common 
     1001     */ 
     1002    public $datatype; 
     1003 
     1004    /** 
     1005     * @var MDB2_Extended 
     1006     */ 
     1007    public $extended; 
     1008 
     1009    /** 
     1010     * @var MDB2_Driver_Function_Common 
     1011     */ 
     1012    public $function; 
     1013 
     1014    /** 
     1015     * @var MDB2_Driver_Manager_Common 
     1016     */ 
     1017    public $manager; 
     1018 
     1019    /** 
     1020     * @var MDB2_Driver_Native_Commonn 
     1021     */ 
     1022    public $native; 
     1023 
     1024    /** 
     1025     * @var MDB2_Driver_Reverse_Common 
     1026     */ 
     1027    public $reverse; 
     1028 
     1029    /** 
    10301030     * index of the MDB2 object within the $GLOBALS['_MDB2_databases'] array 
    10311031     * @var     int 
    10321032     * @access  public 
    10331033     */ 
    1034     var $db_index = 0; 
     1034    public $db_index = 0; 
    10351035 
    10361036    /** 
     
    10391039     * @access  protected 
    10401040     */ 
    1041     var $dsn = array(); 
     1041    public $dsn = array(); 
    10421042 
    10431043    /** 
     
    10461046     * @access  protected 
    10471047     */ 
    1048     var $connected_dsn = array(); 
     1048    public $connected_dsn = array(); 
    10491049 
    10501050    /** 
     
    10531053     * @access  protected 
    10541054     */ 
    1055     var $connection = 0; 
     1055    public $connection = 0; 
    10561056 
    10571057    /** 
     
    10601060     * @access  protected 
    10611061     */ 
    1062     var $opened_persistent; 
     1062    public $opened_persistent; 
    10631063 
    10641064    /** 
    10651065     * the name of the database for the next query 
    10661066     * @var     string 
    1067      * @access  protected 
    1068      */ 
    1069     var $database_name = ''; 
     1067     * @access  public 
     1068     */ 
     1069    public $database_name = ''; 
    10701070 
    10711071    /** 
     
    10741074     * @access  protected 
    10751075     */ 
    1076     var $connected_database_name = ''; 
     1076    public $connected_database_name = ''; 
    10771077 
    10781078    /** 
     
    10811081     * @access  protected 
    10821082     */ 
    1083     var $connected_server_info = ''; 
     1083    public $connected_server_info = ''; 
    10841084 
    10851085    /** 
     
    10881088     * @access  public 
    10891089     */ 
    1090     var $supported = array( 
     1090    public $supported = array( 
    10911091        'sequences' => false, 
    10921092        'indexes' => false, 
     
    11131113    /** 
    11141114     * Array of supported options that can be passed to the MDB2 instance. 
    1115      *  
     1115     * 
    11161116     * The options can be set during object creation, using 
    1117      * MDB2::connect(), MDB2::factory() or MDB2::singleton(). The options can  
    1118      * also be set after the object is created, using MDB2::setOptions() or  
     1117     * MDB2::connect(), MDB2::factory() or MDB2::singleton(). The options can 
     1118     * also be set after the object is created, using MDB2::setOptions() or 
    11191119     * MDB2_Driver_Common::setOption(). 
    11201120     * The list of available option includes: 
     
    11621162     * @see     MDB2_Driver_Common::setOption() 
    11631163     */ 
    1164     var $options = array( 
     1164    public $options = array( 
    11651165        'ssl' => false, 
    11661166        'field_case' => CASE_LOWER, 
     
    12091209     * string array 
    12101210     * @var     string 
    1211      * @access  protected 
    1212      */ 
    1213     var $string_quoting = array('start' => "'", 'end' => "'", 'escape' => false, 'escape_pattern' => false); 
     1211     * @access  public 
     1212     */ 
     1213    public $string_quoting = array( 
     1214        'start'  => "'", 
     1215        'end'    => "'", 
     1216        'escape' => false, 
     1217        'escape_pattern' => false, 
     1218    ); 
    12141219 
    12151220    /** 
    12161221     * identifier quoting 
    12171222     * @var     array 
    1218      * @access  protected 
    1219      */ 
    1220     var $identifier_quoting = array('start' => '"', 'end' => '"', 'escape' => '"'); 
     1223     * @access  public 
     1224     */ 
     1225    public $identifier_quoting = array( 
     1226        'start'  => '"', 
     1227        'end'    => '"', 
     1228        'escape' => '"', 
     1229    ); 
    12211230 
    12221231    /** 
     
    12251234     * @access  protected 
    12261235     */ 
    1227     var $sql_comments = array( 
     1236    public $sql_comments = array( 
    12281237        array('start' => '--', 'end' => "\n", 'escape' => false), 
    12291238        array('start' => '/*', 'end' => '*/', 'escape' => false), 
     
    12351244     * @access  protected 
    12361245     */ 
    1237     var $wildcards = array('%', '_'); 
     1246    protected $wildcards = array('%', '_'); 
    12381247 
    12391248    /** 
     
    12421251     * @access  protected 
    12431252     */ 
    1244     var $as_keyword = ' AS '; 
     1253    public $as_keyword = ' AS '; 
    12451254 
    12461255    /** 
     
    12491258     * @access  protected 
    12501259     */ 
    1251     var $warnings = array(); 
     1260    public $warnings = array(); 
    12521261 
    12531262    /** 
     
    12561265     * @access  public 
    12571266     */ 
    1258     var $debug_output = ''; 
     1267    public $debug_output = ''; 
    12591268 
    12601269    /** 
     
    12631272     * @access  protected 
    12641273     */ 
    1265     var $in_transaction = false; 
     1274    public $in_transaction = false; 
    12661275 
    12671276    /** 
     
    12701279     * @access  protected 
    12711280     */ 
    1272     var $nested_transaction_counter = null; 
     1281    public $nested_transaction_counter = null; 
    12731282 
    12741283    /** 
     
    12771286     * @access  protected 
    12781287     */ 
    1279     var $has_transaction_error = false; 
     1288    protected $has_transaction_error = false; 
    12801289 
    12811290    /** 
    12821291     * result offset used in the next query 
    12831292     * @var     int 
    1284      * @access  protected 
    1285      */ 
    1286     var $offset = 0; 
     1293     * @access  public 
     1294     */ 
     1295    public $offset = 0; 
    12871296 
    12881297    /** 
    12891298     * result limit used in the next query 
    12901299     * @var     int 
    1291      * @access  protected 
    1292      */ 
    1293     var $limit = 0; 
     1300     * @access  public 
     1301     */ 
     1302    public $limit = 0; 
    12941303 
    12951304    /** 
     
    12981307     * @access  public 
    12991308     */ 
    1300     var $phptype; 
     1309    public $phptype; 
    13011310 
    13021311    /** 
     
    13051314     * @access  public 
    13061315     */ 
    1307     var $dbsyntax; 
     1316    public $dbsyntax; 
    13081317 
    13091318    /** 
     
    13121321     * @access  public 
    13131322     */ 
    1314     var $last_query; 
     1323    public $last_query; 
    13151324 
    13161325    /** 
    13171326     * the default fetchmode used 
    13181327     * @var     int 
    1319      * @access  protected 
    1320      */ 
    1321     var $fetchmode = MDB2_FETCHMODE_ORDERED; 
     1328     * @access  public 
     1329     */ 
     1330    public $fetchmode = MDB2_FETCHMODE_ORDERED; 
    13221331 
    13231332    /** 
     
    13261335     * @access  protected 
    13271336     */ 
    1328     var $modules = array(); 
     1337    protected $modules = array(); 
    13291338 
    13301339    /** 
     
    13331342     * @access  protected 
    13341343     */ 
    1335     var $destructor_registered = true; 
     1344    protected $destructor_registered = true; 
     1345 
     1346    /** 
     1347     * @var PEAR  
     1348     */ 
     1349    protected $pear; 
    13361350 
    13371351    // }}} 
     
    13471361        $GLOBALS['_MDB2_databases'][$db_index] = &$this; 
    13481362        $this->db_index = $db_index; 
    1349     } 
    1350  
    1351     // }}} 
    1352     // {{{ function MDB2_Driver_Common() 
    1353  
    1354     /** 
    1355      * PHP 4 Constructor 
    1356      */ 
    1357     function MDB2_Driver_Common() 
    1358     { 
    1359         $this->destructor_registered = false; 
    1360         $this->__construct(); 
     1363        $this->pear = new PEAR; 
    13611364    } 
    13621365 
     
    14341437     * without the message string. 
    14351438     * 
    1436      * @param mixed  $code     integer error code, or a PEAR error object (all  
     1439     * @param mixed  $code     integer error code, or a PEAR error object (all 
    14371440     *                         other parameters are ignored if this parameter is 
    14381441     *                         an object 
     
    14641467        $userinfo = "[Error message: $userinfo]\n"; 
    14651468        // The error is yet a MDB2 error object 
    1466         if (PEAR::isError($code)) { 
     1469        if (MDB2::isError($code)) { 
    14671470            // because we use the static PEAR::raiseError, our global 
    14681471            // handler should be used if it is set 
    1469             if (is_null($mode) && !empty($this->_default_error_mode)) { 
     1472            if ((null === $mode) && !empty($this->_default_error_mode)) { 
    14701473                $mode    = $this->_default_error_mode; 
    14711474                $options = $this->_default_error_options; 
    14721475            } 
    1473             if (is_null($userinfo)) { 
     1476            if (null === $userinfo) { 
    14741477                $userinfo = $code->getUserinfo(); 
    14751478            } 
     
    14841487            $native_errno = $native_msg = null; 
    14851488            list($code, $native_errno, $native_msg) = $this->errorInfo($code); 
    1486             if (!is_null($native_errno) && $native_errno !== '') { 
     1489            if ((null !== $native_errno) && $native_errno !== '') { 
    14871490                $userinfo.= "[Native code: $native_errno]\n"; 
    14881491            } 
    1489             if (!is_null($native_msg) && $native_msg !== '') { 
     1492            if ((null !== $native_msg) && $native_msg !== '') { 
    14901493                $userinfo.= "[Native message: ". strip_tags($native_msg) ."]\n"; 
    14911494            } 
    1492             if (!is_null($method)) { 
     1495            if (null !== $method) { 
    14931496                $userinfo = $method.': '.$userinfo; 
    14941497            } 
    14951498        } 
    14961499 
    1497         $err =& PEAR::raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); 
     1500        $err = $this->pear->raiseError(null, $code, $mode, $options, $userinfo, 'MDB2_Error', true); 
    14981501        if ($err->getMode() !== PEAR_ERROR_RETURN 
    14991502            && isset($this->nested_transaction_counter) && !$this->has_transaction_error) { 
    1500             $this->has_transaction_error =& $err; 
     1503            $this->has_transaction_error = $err; 
    15011504        } 
    15021505        return $err; 
     
    17911794    { 
    17921795        $result = $this->connect(); 
    1793         if (PEAR::isError($result)) { 
     1796        if (MDB2::isError($result)) { 
    17941797            return $result; 
    17951798        } 
     
    18791882 
    18801883    // }}} 
    1881     // {{{ function &loadModule($module, $property = null, $phptype_specific = null) 
     1884    // {{{ function loadModule($module, $property = null, $phptype_specific = null) 
    18821885 
    18831886    /** 
     
    18951898     * @access  public 
    18961899     */ 
    1897     function &loadModule($module, $property = null, $phptype_specific = null) 
     1900    function loadModule($module, $property = null, $phptype_specific = null) 
    18981901    { 
    18991902        if (!$property) { 
     
    19171920 
    19181921            $err = MDB2::loadClass($class_name, $this->getOption('debug')); 
    1919             if (PEAR::isError($err)) { 
     1922            if (MDB2::isError($err)) { 
    19201923                return $err; 
    19211924            } 
     
    19281931                        $class_name = $class_name_new; 
    19291932                        $err = MDB2::loadClass($class_name, $this->getOption('debug')); 
    1930                         if (PEAR::isError($err)) { 
     1933                        if (MDB2::isError($err)) { 
    19311934                            return $err; 
    19321935                        } 
     
    19361939 
    19371940            if (!MDB2::classExists($class_name)) { 
    1938                 $err =& $this->raiseError(MDB2_ERROR_LOADMODULE, null, null, 
     1941                $err = $this->raiseError(MDB2_ERROR_LOADMODULE, null, null, 
    19391942                    "unable to load module '$module' into property '$property'", __FUNCTION__); 
    19401943                return $err; 
    19411944            } 
    19421945            $this->{$property} = new $class_name($this->db_index); 
    1943             $this->modules[$module] =& $this->{$property}; 
     1946            $this->modules[$module] = $this->{$property}; 
    19441947            if ($version) { 
    19451948                // this will be used in the connect method to determine if the module 
     
    19731976            $method = strtolower($match[2]).$match[3]; 
    19741977            if (!isset($this->modules[$module]) || !is_object($this->modules[$module])) { 
    1975                 $result =& $this->loadModule($module); 
    1976                 if (PEAR::isError($result)) { 
     1978                $result = $this->loadModule($module); 
     1979                if (MDB2::isError($result)) { 
    19771980                    return $result; 
    19781981                } 
     
    19881991            } 
    19891992        } 
    1990         if (!is_null($module)) { 
     1993        if (null !== $module) { 
    19911994            return call_user_func_array(array(&$this->modules[$module], $method), $params); 
    19921995        } 
    1993         trigger_error(sprintf('Call to undefined function: %s::%s().', get_class($this), $method), E_USER_ERROR); 
     1996 
     1997        $class = get_class($this); 
     1998        $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); 
     1999        $loc = 'in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line']; 
     2000        if ($method == 'isError') { 
     2001            trigger_error("Deprecated: $class::isError() is deprecated, use MDB2::isError() $loc", E_USER_DEPRECATED); 
     2002            if (!array_key_exists(0, $params)) { 
     2003                trigger_error("Missing argument 1 for $class::$method, called $loc", E_USER_ERROR); 
     2004            } 
     2005            return MDB2::isError($params[0]); 
     2006        } 
     2007        trigger_error("Call to undefined function: $class::$method() $loc.", E_USER_ERROR); 
     2008    } 
     2009 
     2010    // }}} 
     2011    // {{{ function __callStatic($method, $params) 
     2012 
     2013    /** 
     2014     * Calls a module method using the __callStatic magic method 
     2015     * 
     2016     * @param   string  Method name. 
     2017     * @param   array   Arguments. 
     2018     * 
     2019     * @return  mixed   Returned value. 
     2020     */ 
     2021    public static function __callStatic($method, $params) 
     2022    { 
     2023        $class = get_called_class(); 
     2024        $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); 
     2025        $loc = 'in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line']; 
     2026        if ($method == 'isError') { 
     2027            trigger_error("Deprecated: $class::isError() is deprecated, use MDB2::isError() $loc", E_USER_DEPRECATED); 
     2028            if (!array_key_exists(0, $params)) { 
     2029                trigger_error("Missing argument 1 for $class::$method, called $loc", E_USER_ERROR); 
     2030            } 
     2031            return MDB2::isError($params[0]); 
     2032        } 
     2033        trigger_error("Call to undefined function: $class::$method() $loc.", E_USER_ERROR); 
    19942034    } 
    19952035 
     
    21512191                if ($force_rollback || $this->has_transaction_error) { 
    21522192                    $result = $this->rollback($savepoint); 
    2153                     if (!PEAR::isError($result)) { 
     2193                    if (!MDB2::isError($result)) { 
    21542194                        $result = false; 
    21552195                        $this->has_transaction_error = false; 
     
    21722212            if ($force_rollback || $this->has_transaction_error) { 
    21732213                $result = $this->rollback(); 
    2174                 if (!PEAR::isError($result)) { 
     2214                if (!MDB2::isError($result)) { 
    21752215                    $result = false; 
    21762216                } 
     
    21982238    function failNestedTransaction($error = null, $immediately = false) 
    21992239    { 
    2200         if (is_null($error)) { 
     2240        if (null !== $error) { 
    22012241            $error = $this->has_transaction_error ? $this->has_transaction_error : true; 
    22022242        } elseif (!$error) { 
     
    24332473     * @access  public 
    24342474     */ 
    2435     function &standaloneQuery($query, $types = null, $is_manip = false) 
     2475    function standaloneQuery($query, $types = null, $is_manip = false) 
    24362476    { 
    24372477        $offset = $this->offset; 
     
    24412481 
    24422482        $connection = $this->getConnection(); 
    2443         if (PEAR::isError($connection)) { 
     2483        if (MDB2::isError($connection)) { 
    24442484            return $connection; 
    24452485        } 
    24462486 
    2447         $result =& $this->_doQuery($query, $is_manip, $connection, false); 
    2448         if (PEAR::isError($result)) { 
     2487        $result = $this->_doQuery($query, $is_manip, $connection, false); 
     2488        if (MDB2::isError($result)) { 
    24492489            return $result; 
    24502490        } 
     
    24542494            return $affected_rows; 
    24552495        } 
    2456         $result =& $this->_wrapResult($result, $types, true, false, $limit, $offset); 
     2496        $result = $this->_wrapResult($result, $types, true, true, $limit, $offset); 
    24572497        return $result; 
    24582498    } 
     
    24922532     * @access  protected 
    24932533     */ 
    2494     function &_doQuery($query, $is_manip = false, $connection = null, $database_name = null) 
     2534    function _doQuery($query, $is_manip = false, $connection = null, $database_name = null) 
    24952535    { 
    24962536        $this->last_query = $query; 
    24972537        $result = $this->debug($query, 'query', array('is_manip' => $is_manip, 'when' => 'pre')); 
    24982538        if ($result) { 
    2499             if (PEAR::isError($result)) { 
     2539            if (MDB2::isError($result)) { 
    25002540                return $result; 
    25012541            } 
    25022542            $query = $result; 
    25032543        } 
    2504         $err =& $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     2544        $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    25052545            'method not implemented', __FUNCTION__); 
    25062546        return $err; 
     
    25222562    function _affectedRows($connection, $result = null) 
    25232563    { 
    2524         return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     2564        return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    25252565            'method not implemented', __FUNCTION__); 
    25262566    } 
     
    25382578     * @access  public 
    25392579     */ 
    2540     function &exec($query) 
     2580    function exec($query) 
    25412581    { 
    25422582        $offset = $this->offset; 
     
    25462586 
    25472587        $connection = $this->getConnection(); 
    2548         if (PEAR::isError($connection)) { 
     2588        if (MDB2::isError($connection)) { 
    25492589            return $connection; 
    25502590        } 
    25512591 
    2552         $result =& $this->_doQuery($query, true, $connection, $this->database_name); 
    2553         if (PEAR::isError($result)) { 
     2592        $result = $this->_doQuery($query, true, $connection, $this->database_name); 
     2593        if (MDB2::isError($result)) { 
    25542594            return $result; 
    25552595        } 
     
    25752615     * @access  public 
    25762616     */ 
    2577     function &query($query, $types = null, $result_class = true, $result_wrap_class = false) 
     2617    function query($query, $types = null, $result_class = true, $result_wrap_class = true) 
    25782618    { 
    25792619        $offset = $this->offset; 
     
    25832623 
    25842624        $connection = $this->getConnection(); 
    2585         if (PEAR::isError($connection)) { 
     2625        if (MDB2::isError($connection)) { 
    25862626            return $connection; 
    25872627        } 
    25882628 
    2589         $result =& $this->_doQuery($query, false, $connection, $this->database_name); 
    2590         if (PEAR::isError($result)) { 
     2629        $result = $this->_doQuery($query, false, $connection, $this->database_name); 
     2630        if (MDB2::isError($result)) { 
    25912631            return $result; 
    25922632        } 
    25932633 
    2594         $result =& $this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset); 
     2634        $result = $this->_wrapResult($result, $types, $result_class, $result_wrap_class, $limit, $offset); 
    25952635        return $result; 
    25962636    } 
    25972637 
    25982638    // }}} 
    2599     // {{{ function &_wrapResult($result, $types = array(), $result_class = true, $result_wrap_class = false, $limit = null, $offset = null) 
     2639    // {{{ function _wrapResult($result_resource, $types = array(), $result_class = true, $result_wrap_class = false, $limit = null, $offset = null) 
    26002640 
    26012641    /** 
     
    26142654     * @access  protected 
    26152655     */ 
    2616     function &_wrapResult($result, $types = array(), $result_class = true, 
    2617         $result_wrap_class = false, $limit = null, $offset = null) 
     2656    function _wrapResult($result_resource, $types = array(), $result_class = true, 
     2657        $result_wrap_class = true, $limit = null, $offset = null) 
    26182658    { 
    26192659        if ($types === true) { 
    26202660            if ($this->supports('result_introspection')) { 
    26212661                $this->loadModule('Reverse', null, true); 
    2622                 $tableInfo = $this->reverse->tableInfo($result); 
    2623                 if (PEAR::isError($tableInfo)) { 
     2662                $tableInfo = $this->reverse->tableInfo($result_resource); 
     2663                if (MDB2::isError($tableInfo)) { 
    26242664                    return $tableInfo; 
    26252665                } 
    26262666                $types = array(); 
     2667                $types_assoc = array(); 
    26272668                foreach ($tableInfo as $field) { 
    26282669                    $types[] = $field['mdb2type']; 
     2670                    $types_assoc[$field['name']] = $field['mdb2type']; 
    26292671                } 
    26302672            } else { 
     
    26412683            $class_name = sprintf($result_class, $this->phptype); 
    26422684            if (!MDB2::classExists($class_name)) { 
    2643                 $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
     2685                $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
    26442686                    'result class does not exist '.$class_name, __FUNCTION__); 
    26452687                return $err; 
    26462688            } 
    2647             $result =& new $class_name($this, $result, $limit, $offset); 
     2689            $result = new $class_name($this, $result_resource, $limit, $offset); 
    26482690            if (!MDB2::isResultCommon($result)) { 
    2649                 $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
     2691                $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
    26502692                    'result class is not extended from MDB2_Result_Common', __FUNCTION__); 
    26512693                return $err; 
    26522694            } 
     2695 
    26532696            if (!empty($types)) { 
    26542697                $err = $result->setResultTypes($types); 
    2655                 if (PEAR::isError($err)) { 
     2698                if (MDB2::isError($err)) { 
    26562699                    $result->free(); 
    26572700                    return $err; 
    26582701                } 
    26592702            } 
    2660         } 
    2661         if ($result_wrap_class === true) { 
    2662             $result_wrap_class = $this->options['result_wrap_class']; 
    2663         } 
    2664         if ($result_wrap_class) { 
    2665             if (!MDB2::classExists($result_wrap_class)) { 
    2666                 $err =& $this->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
    2667                     'result wrap class does not exist '.$result_wrap_class, __FUNCTION__); 
    2668                 return $err; 
    2669             } 
    2670             $result = new $result_wrap_class($result, $this->fetchmode); 
    2671         } 
    2672         return $result; 
     2703            if (!empty($types_assoc)) { 
     2704                $err = $result->setResultTypes($types_assoc); 
     2705                if (MDB2::isError($err)) { 
     2706                    $result->free(); 
     2707                    return $err; 
     2708                } 
     2709            } 
     2710 
     2711            if ($result_wrap_class === true) { 
     2712                $result_wrap_class = $this->options['result_wrap_class']; 
     2713            } 
     2714            if ($result_wrap_class) { 
     2715                if (!MDB2::classExists($result_wrap_class)) { 
     2716                    $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
     2717                        'result wrap class does not exist '.$result_wrap_class, __FUNCTION__); 
     2718                    return $err; 
     2719                } 
     2720                $result = new $result_wrap_class($result, $this->fetchmode); 
     2721            } 
     2722 
     2723            return $result; 
     2724        } 
     2725 
     2726        return $result_resource; 
    26732727    } 
    26742728 
     
    26872741    function getServerVersion($native = false) 
    26882742    { 
    2689         return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     2743        return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    26902744            'method not implemented', __FUNCTION__); 
    26912745    } 
     
    27072761    { 
    27082762        if (!$this->supports('limit_queries')) { 
    2709             return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     2763            return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    27102764                'limit is not supported by this driver', __FUNCTION__); 
    27112765        } 
    27122766        $limit = (int)$limit; 
    27132767        if ($limit < 0) { 
    2714             return $this->raiseError(MDB2_ERROR_SYNTAX, null, null, 
     2768            return MDB2_Driver_Common::raiseError(MDB2_ERROR_SYNTAX, null, null, 
    27152769                'it was not specified a valid selected range row limit', __FUNCTION__); 
    27162770        } 
    27172771        $this->limit = $limit; 
    2718         if (!is_null($offset)) { 
     2772        if (null !== $offset) { 
    27192773            $offset = (int)$offset; 
    27202774            if ($offset < 0) { 
    2721                 return $this->raiseError(MDB2_ERROR_SYNTAX, null, null, 
     2775                return MDB2_Driver_Common::raiseError(MDB2_ERROR_SYNTAX, null, null, 
    27222776                    'it was not specified a valid first selected range row', __FUNCTION__); 
    27232777            } 
     
    27492803 
    27502804        if (!$this->supports('sub_selects')) { 
    2751             return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     2805            return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    27522806                'method not implemented', __FUNCTION__); 
    27532807        } 
    27542808 
    27552809        $col = $this->queryCol($query, $type); 
    2756         if (PEAR::isError($col)) { 
     2810        if (MDB2::isError($col)) { 
    27572811            return $col; 
    27582812        } 
     
    28352889    { 
    28362890        if (!$this->supports('replace')) { 
    2837             return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     2891            return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    28382892                'replace query is not supported', __FUNCTION__); 
    28392893        } 
     
    28512905            if (isset($fields[$name]['key']) && $fields[$name]['key']) { 
    28522906                if ($value === 'NULL') { 
    2853                     return $this->raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null, 
     2907                    return MDB2_Driver_Common::raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null, 
    28542908                        'key value '.$name.' may not be NULL', __FUNCTION__); 
    28552909                } 
     
    28582912        } 
    28592913        if (empty($condition)) { 
    2860             return $this->raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null, 
     2914            return MDB2_Driver_Common::raiseError(MDB2_ERROR_CANNOT_REPLACE, null, null, 
    28612915                'not specified which fields are keys', __FUNCTION__); 
    28622916        } 
     
    28642918        $result = null; 
    28652919        $in_transaction = $this->in_transaction; 
    2866         if (!$in_transaction && PEAR::isError($result = $this->beginTransaction())) { 
     2920        if (!$in_transaction && MDB2::isError($result = $this->beginTransaction())) { 
    28672921            return $result; 
    28682922        } 
    28692923 
    28702924        $connection = $this->getConnection(); 
    2871         if (PEAR::isError($connection)) { 
     2925        if (MDB2::isError($connection)) { 
    28722926            return $connection; 
    28732927        } 
     
    28752929        $condition = ' WHERE '.implode(' AND ', $condition); 
    28762930        $query = 'DELETE FROM ' . $this->quoteIdentifier($table, true) . $condition; 
    2877         $result =& $this->_doQuery($query, true, $connection); 
    2878         if (!PEAR::isError($result)) { 
     2931        $result = $this->_doQuery($query, true, $connection); 
     2932        if (!MDB2::isError($result)) { 
    28792933            $affected_rows = $this->_affectedRows($connection, $result); 
    28802934            $insert = ''; 
     
    28842938            $values = implode(', ', $values); 
    28852939            $query = 'INSERT INTO '. $this->quoteIdentifier($table, true) . "($insert) VALUES ($values)"; 
    2886             $result =& $this->_doQuery($query, true, $connection); 
    2887             if (!PEAR::isError($result)) { 
     2940            $result = $this->_doQuery($query, true, $connection); 
     2941            if (!MDB2::isError($result)) { 
    28882942                $affected_rows += $this->_affectedRows($connection, $result);; 
    28892943            } 
     
    28912945 
    28922946        if (!$in_transaction) { 
    2893             if (PEAR::isError($result)) { 
     2947            if (MDB2::isError($result)) { 
    28942948                $this->rollback(); 
    28952949            } else { 
     
    28982952        } 
    28992953 
    2900         if (PEAR::isError($result)) { 
     2954        if (MDB2::isError($result)) { 
    29012955            return $result; 
    29022956        } 
     
    29252979     * @param   mixed   key (field) value (parameter) pair for all lob placeholders 
    29262980     * 
    2927      * @return  mixed   resource handle for the prepared query on success,  
     2981     * @return  mixed   resource handle for the prepared query on success, 
    29282982     *                  a MDB2 error on failure 
    29292983     * 
     
    29312985     * @see     bindParam, execute 
    29322986     */ 
    2933     function &prepare($query, $types = null, $result_types = null, $lobs = array()) 
     2987    function prepare($query, $types = null, $result_types = null, $lobs = array()) 
    29342988    { 
    29352989        $is_manip = ($result_types === MDB2_PREPARE_MANIP); 
     
    29392993        $result = $this->debug($query, __FUNCTION__, array('is_manip' => $is_manip, 'when' => 'pre')); 
    29402994        if ($result) { 
    2941             if (PEAR::isError($result)) { 
     2995            if (MDB2::isError($result)) { 
    29422996                return $result; 
    29432997            } 
     
    29613015                break; 
    29623016            } 
    2963             if (is_null($placeholder_type)) { 
     3017            if (null === $placeholder_type) { 
    29643018                $placeholder_type_guess = $query[$p_position]; 
    29653019            } 
    29663020 
    29673021            $new_pos = $this->_skipDelimitedStrings($query, $position, $p_position); 
    2968             if (PEAR::isError($new_pos)) { 
     3022            if (MDB2::isError($new_pos)) { 
    29693023                return $new_pos; 
    29703024            } 
     
    29753029 
    29763030            if ($query[$position] == $placeholder_type_guess) { 
    2977                 if (is_null($placeholder_type)) { 
     3031                if (null === $placeholder_type) { 
    29783032                    $placeholder_type = $query[$p_position]; 
    29793033                    $question = $colon = $placeholder_type; 
     
    29943048                    $parameter = preg_replace($regexp, '\\1', $query); 
    29953049                    if ($parameter === '') { 
    2996                         $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null, 
     3050                        $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_SYNTAX, null, null, 
    29973051                            'named parameter name must match "bindname_format" option', __FUNCTION__); 
    29983052                        return $err; 
     
    30213075    // }}} 
    30223076    // {{{ function _skipDelimitedStrings($query, $position, $p_position) 
    3023      
     3077 
    30243078    /** 
    30253079     * Utility method, used by prepare() to avoid replacing placeholders within delimited strings. 
     
    30393093    function _skipDelimitedStrings($query, $position, $p_position) 
    30403094    { 
    3041         $ignores = $this->string_quoting; 
     3095        $ignores = array(); 
     3096        $ignores[] = $this->string_quoting; 
    30423097        $ignores[] = $this->identifier_quoting; 
    30433098        $ignores = array_merge($ignores, $this->sql_comments); 
    3044          
     3099 
    30453100        foreach ($ignores as $ignore) { 
    30463101            if (!empty($ignore['start'])) { 
     
    30523107                                $end_quote = strlen($query) - 1; 
    30533108                            } else { 
    3054                                 $err =& $this->raiseError(MDB2_ERROR_SYNTAX, null, null, 
     3109                                $err = MDB2_Driver_Common::raiseError(MDB2_ERROR_SYNTAX, null, null, 
    30553110                                    'query with an unterminated text string specified', __FUNCTION__); 
    30563111                                return $err; 
     
    30713126        return $position; 
    30723127    } 
    3073      
     3128 
    30743129    // }}} 
    30753130    // {{{ function quote($value, $type = null, $quote = true) 
     
    30923147    { 
    30933148        $result = $this->loadModule('Datatype', null, true); 
    3094         if (PEAR::isError($result)) { 
     3149        if (MDB2::isError($result)) { 
    30953150            return $result; 
    30963151        } 
     
    31183173    { 
    31193174        $result = $this->loadModule('Datatype', null, true); 
    3120         if (PEAR::isError($result)) { 
     3175        if (MDB2::isError($result)) { 
    31213176            return $result; 
    31223177        } 
     
    31403195    { 
    31413196        $result = $this->loadModule('Datatype', null, true); 
    3142         if (PEAR::isError($result)) { 
     3197        if (MDB2::isError($result)) { 
    31433198            return $result; 
    31443199        } 
     
    31663221            return $this->supported[$feature]; 
    31673222        } 
    3168         return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     3223        return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    31693224            "unknown support feature $feature", __FUNCTION__); 
    31703225    } 
     
    32213276    function nextID($seq_name, $ondemand = true) 
    32223277    { 
    3223         return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     3278        return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    32243279            'method not implemented', __FUNCTION__); 
    32253280    } 
     
    32413296    function lastInsertID($table = null, $field = null) 
    32423297    { 
    3243         return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     3298        return MDB2_Driver_Common::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    32443299            'method not implemented', __FUNCTION__); 
    32453300    } 
     
    33963451 
    33973452    // }}} 
     3453    // {{{ function delExpect($error_code) 
     3454 
     3455    /** 
     3456     * This method deletes all occurences of the specified element from 
     3457     * the expected error codes stack. 
     3458     * 
     3459     * @param  mixed $error_code error code that should be deleted 
     3460     * @return mixed list of error codes that were deleted or error 
     3461     * 
     3462     * @uses PEAR::delExpect() 
     3463     */ 
     3464    public function delExpect($error_code) 
     3465    { 
     3466        return $this->pear->delExpect($error_code); 
     3467    } 
     3468 
     3469    // }}} 
     3470    // {{{ function expectError($code) 
     3471 
     3472    /** 
     3473     * This method is used to tell which errors you expect to get. 
     3474     * Expected errors are always returned with error mode 
     3475     * PEAR_ERROR_RETURN.  Expected error codes are stored in a stack, 
     3476     * and this method pushes a new element onto it.  The list of 
     3477     * expected errors are in effect until they are popped off the 
     3478     * stack with the popExpect() method. 
     3479     * 
     3480     * Note that this method can not be called statically 
     3481     * 
     3482     * @param mixed $code a single error code or an array of error codes to expect 
     3483     * 
     3484     * @return int     the new depth of the "expected errors" stack 
     3485     * 
     3486     * @uses PEAR::expectError() 
     3487     */ 
     3488    public function expectError($code = '*') 
     3489    { 
     3490        return $this->pear->expectError($code); 
     3491    } 
     3492 
     3493    // }}} 
     3494    // {{{ function getStaticProperty($class, $var) 
     3495 
     3496    /** 
     3497     * If you have a class that's mostly/entirely static, and you need static 
     3498     * properties, you can use this method to simulate them. Eg. in your method(s) 
     3499     * do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); 
     3500     * You MUST use a reference, or they will not persist! 
     3501     * 
     3502     * @param  string $class  The calling classname, to prevent clashes 
     3503     * @param  string $var    The variable to retrieve. 
     3504     * @return mixed   A reference to the variable. If not set it will be 
     3505     *                 auto initialised to NULL. 
     3506     * 
     3507     * @uses PEAR::getStaticProperty() 
     3508     */ 
     3509    public function &getStaticProperty($class, $var) 
     3510    { 
     3511        $tmp =& $this->pear->getStaticProperty($class, $var); 
     3512        return $tmp; 
     3513    } 
     3514 
     3515    // }}} 
     3516    // {{{ function popErrorHandling() 
     3517 
     3518    /** 
     3519     * Pop the last error handler used 
     3520     * 
     3521     * @return bool Always true 
     3522     * 
     3523     * @see PEAR::pushErrorHandling 
     3524     * @uses PEAR::popErrorHandling() 
     3525     */ 
     3526    public function popErrorHandling() 
     3527    { 
     3528        return $this->pear->popErrorHandling(); 
     3529    } 
     3530 
     3531    // }}} 
     3532    // {{{ function popExpect() 
     3533 
     3534    /** 
     3535     * This method pops one element off the expected error codes 
     3536     * stack. 
     3537     * 
     3538     * @return array   the list of error codes that were popped 
     3539     * 
     3540     * @uses PEAR::popExpect() 
     3541     */ 
     3542    public function popExpect() 
     3543    { 
     3544        return $this->pear->popExpect(); 
     3545    } 
     3546 
     3547    // }}} 
     3548    // {{{ function pushErrorHandling($mode, $options = null) 
     3549 
     3550    /** 
     3551     * Push a new error handler on top of the error handler options stack. With this 
     3552     * you can easily override the actual error handler for some code and restore 
     3553     * it later with popErrorHandling. 
     3554     * 
     3555     * @param mixed $mode (same as setErrorHandling) 
     3556     * @param mixed $options (same as setErrorHandling) 
     3557     * 
     3558     * @return bool Always true 
     3559     * 
     3560     * @see PEAR::setErrorHandling 
     3561     * @uses PEAR::pushErrorHandling() 
     3562     */ 
     3563    public function pushErrorHandling($mode, $options = null) 
     3564    { 
     3565        return $this->pear->pushErrorHandling($mode, $options); 
     3566    } 
     3567 
     3568    // }}} 
     3569    // {{{ function registerShutdownFunc($func, $args = array()) 
     3570 
     3571    /** 
     3572     * Use this function to register a shutdown method for static 
     3573     * classes. 
     3574     * 
     3575     * @param  mixed $func  The function name (or array of class/method) to call 
     3576     * @param  mixed $args  The arguments to pass to the function 
     3577     * @return void 
     3578     * 
     3579     * @uses PEAR::registerShutdownFunc() 
     3580     */ 
     3581    public function registerShutdownFunc($func, $args = array()) 
     3582    { 
     3583        return $this->pear->registerShutdownFunc($func, $args); 
     3584    } 
     3585 
     3586    // }}} 
     3587    // {{{ function setErrorHandling($mode = null, $options = null) 
     3588 
     3589    /** 
     3590     * Sets how errors generated by this object should be handled. 
     3591     * Can be invoked both in objects and statically.  If called 
     3592     * statically, setErrorHandling sets the default behaviour for all 
     3593     * PEAR objects.  If called in an object, setErrorHandling sets 
     3594     * the default behaviour for that object. 
     3595     * 
     3596     * @param int $mode 
     3597     *        One of PEAR_ERROR_RETURN, PEAR_ERROR_PRINT, 
     3598     *        PEAR_ERROR_TRIGGER, PEAR_ERROR_DIE, 
     3599     *        PEAR_ERROR_CALLBACK or PEAR_ERROR_EXCEPTION. 
     3600     * 
     3601     * @param mixed $options 
     3602     *        When $mode is PEAR_ERROR_TRIGGER, this is the error level (one 
     3603     *        of E_USER_NOTICE, E_USER_WARNING or E_USER_ERROR). 
     3604     * 
     3605     *        When $mode is PEAR_ERROR_CALLBACK, this parameter is expected 
     3606     *        to be the callback function or method.  A callback 
     3607     *        function is a string with the name of the function, a 
     3608     *        callback method is an array of two elements: the element 
     3609     *        at index 0 is the object, and the element at index 1 is 
     3610     *        the name of the method to call in the object. 
     3611     * 
     3612     *        When $mode is PEAR_ERROR_PRINT or PEAR_ERROR_DIE, this is 
     3613     *        a printf format string used when printing the error 
     3614     *        message. 
     3615     * 
     3616     * @access public 
     3617     * @return void 
     3618     * @see PEAR_ERROR_RETURN 
     3619     * @see PEAR_ERROR_PRINT 
     3620     * @see PEAR_ERROR_TRIGGER 
     3621     * @see PEAR_ERROR_DIE 
     3622     * @see PEAR_ERROR_CALLBACK 
     3623     * @see PEAR_ERROR_EXCEPTION 
     3624     * 
     3625     * @since PHP 4.0.5 
     3626     * @uses PEAR::setErrorHandling($mode, $options) 
     3627     */ 
     3628    public function setErrorHandling($mode = null, $options = null) 
     3629    { 
     3630        return $this->pear->setErrorHandling($mode, $options); 
     3631    } 
     3632 
     3633    /** 
     3634     * @uses PEAR::staticPopErrorHandling()  
     3635     */ 
     3636    public function staticPopErrorHandling() 
     3637    { 
     3638        return $this->pear->staticPopErrorHandling(); 
     3639    } 
     3640 
     3641    // }}} 
     3642    // {{{ function staticPushErrorHandling($mode, $options = null) 
     3643 
     3644    /** 
     3645     * @uses PEAR::staticPushErrorHandling($mode, $options) 
     3646     */ 
     3647    public function staticPushErrorHandling($mode, $options = null) 
     3648    { 
     3649        return $this->pear->staticPushErrorHandling($mode, $options); 
     3650    } 
     3651 
     3652    // }}} 
     3653    // {{{ function &throwError($message = null, $code = null, $userinfo = null) 
     3654 
     3655    /** 
     3656     * Simpler form of raiseError with fewer options.  In most cases 
     3657     * message, code and userinfo are enough. 
     3658     * 
     3659     * @param mixed $message a text error message or a PEAR error object 
     3660     * 
     3661     * @param int $code      a numeric error code (it is up to your class 
     3662     *                  to define these if you want to use codes) 
     3663     * 
     3664     * @param string $userinfo If you need to pass along for example debug 
     3665     *                  information, this parameter is meant for that. 
     3666     * 
     3667     * @return object   a PEAR error object 
     3668     * @see PEAR::raiseError 
     3669     * @uses PEAR::&throwError() 
     3670     */ 
     3671    public function &throwError($message = null, $code = null, $userinfo = null) 
     3672    { 
     3673        $tmp =& $this->pear->throwError($message, $code, $userinfo); 
     3674        return $tmp; 
     3675    } 
     3676 
     3677    // }}} 
    33983678} 
    33993679 
     
    34263706    // {{{ Variables (Properties) 
    34273707 
    3428     var $db; 
    3429     var $result; 
    3430     var $rownum = -1; 
    3431     var $types = array(); 
    3432     var $values = array(); 
    3433     var $offset; 
    3434     var $offset_count = 0; 
    3435     var $limit; 
    3436     var $column_names; 
    3437  
    3438     // }}} 
    3439     // {{{ constructor: function __construct(&$db, &$result, $limit = 0, $offset = 0) 
     3708    public $db; 
     3709    public $result; 
     3710    public $rownum = -1; 
     3711    public $types = array(); 
     3712    public $types_assoc = array(); 
     3713    public $values = array(); 
     3714    public $offset; 
     3715    public $offset_count = 0; 
     3716    public $limit; 
     3717    public $column_names; 
     3718 
     3719    // }}} 
     3720    // {{{ constructor: function __construct($db, &$result, $limit = 0, $offset = 0) 
    34403721 
    34413722    /** 
    34423723     * Constructor 
    34433724     */ 
    3444     function __construct(&$db, &$result, $limit = 0, $offset = 0) 
    3445     { 
    3446         $this->db =& $db; 
    3447         $this->result =& $result; 
     3725    function __construct($db, &$result, $limit = 0, $offset = 0) 
     3726    { 
     3727        $this->db = $db; 
     3728        $this->result = $result; 
    34483729        $this->offset = $offset; 
    34493730        $this->limit = max(0, $limit - 1); 
    3450     } 
    3451  
    3452     // }}} 
    3453     // {{{ function MDB2_Result_Common(&$db, &$result, $limit = 0, $offset = 0) 
    3454  
    3455     /** 
    3456      * PHP 4 Constructor 
    3457      */ 
    3458     function MDB2_Result_Common(&$db, &$result, $limit = 0, $offset = 0) 
    3459     { 
    3460         $this->__construct($db, $result, $limit, $offset); 
    34613731    } 
    34623732 
     
    34883758    { 
    34893759        $load = $this->db->loadModule('Datatype', null, true); 
    3490         if (PEAR::isError($load)) { 
     3760        if (MDB2::isError($load)) { 
    34913761            return $load; 
    34923762        } 
    34933763        $types = $this->db->datatype->checkResultTypes($types); 
    3494         if (PEAR::isError($types)) { 
     3764        if (MDB2::isError($types)) { 
    34953765            return $types; 
    34963766        } 
    3497         $this->types = $types; 
     3767        foreach ($types as $key => $value) { 
     3768            if (is_numeric($key)) { 
     3769                $this->types[$key] = $value; 
     3770            } else { 
     3771                $this->types_assoc[$key] = $value; 
     3772            } 
     3773        } 
    34983774        return MDB2_OK; 
    34993775    } 
     
    35153791        $target_rownum = $rownum - 1; 
    35163792        if ($this->rownum > $target_rownum) { 
    3517             return $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     3793            return MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    35183794                'seeking to previous rows not implemented', __FUNCTION__); 
    35193795        } 
     
    35373813     * @access  public 
    35383814     */ 
    3539     function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) 
    3540     { 
    3541         $err =& $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     3815    function fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) 
     3816    { 
     3817        $err = MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    35423818            'method not implemented', __FUNCTION__); 
    35433819        return $err; 
     
    35603836        $fetchmode = is_numeric($colnum) ? MDB2_FETCHMODE_ORDERED : MDB2_FETCHMODE_ASSOC; 
    35613837        $row = $this->fetchRow($fetchmode, $rownum); 
    3562         if (!is_array($row) || PEAR::isError($row)) { 
     3838        if (!is_array($row) || MDB2::isError($row)) { 
    35633839            return $row; 
    35643840        } 
    35653841        if (!array_key_exists($colnum, $row)) { 
    3566             return $this->db->raiseError(MDB2_ERROR_TRUNCATED, null, null, 
     3842            return MDB2::raiseError(MDB2_ERROR_TRUNCATED, null, null, 
    35673843                'column is not defined in the result set: '.$colnum, __FUNCTION__); 
    35683844        } 
     
    35883864        if (is_array($row)) { 
    35893865            if (!array_key_exists($colnum, $row)) { 
    3590                 return $this->db->raiseError(MDB2_ERROR_TRUNCATED, null, null, 
     3866                return MDB2::raiseError(MDB2_ERROR_TRUNCATED, null, null, 
    35913867                    'column is not defined in the result set: '.$colnum, __FUNCTION__); 
    35923868            } 
     
    35953871            } while (is_array($row = $this->fetchRow($fetchmode))); 
    35963872        } 
    3597         if (PEAR::isError($row)) { 
     3873        if (MDB2::isError($row)) { 
    35983874            return $row; 
    35993875        } 
     
    36323908        $all = array(); 
    36333909        $row = $this->fetchRow($fetchmode); 
    3634         if (PEAR::isError($row)) { 
     3910        if (MDB2::isError($row)) { 
    36353911            return $row; 
    36363912        } elseif (!$row) { 
     
    36393915 
    36403916        $shift_array = $rekey ? false : null; 
    3641         if (!is_null($shift_array)) { 
     3917        if (null !== $shift_array) { 
    36423918            if (is_object($row)) { 
    36433919                $colnum = count(get_object_vars($row)); 
     
    36463922            } 
    36473923            if ($colnum < 2) { 
    3648                 return $this->db->raiseError(MDB2_ERROR_TRUNCATED, null, null, 
     3924                return MDB2::raiseError(MDB2_ERROR_TRUNCATED, null, null, 
    36493925                    'rekey feature requires atleast 2 column', __FUNCTION__); 
    36503926            } 
     
    36593935                    unset($row->{$key}); 
    36603936                } else { 
    3661                     if ($fetchmode & MDB2_FETCHMODE_ASSOC) { 
     3937                    if (   $fetchmode == MDB2_FETCHMODE_ASSOC 
     3938                        || $fetchmode == MDB2_FETCHMODE_OBJECT 
     3939                    ) { 
    36623940                        $key = reset($row); 
    36633941                        unset($row[key($row)]); 
     
    36753953                } 
    36763954            } while (($row = $this->fetchRow($fetchmode))); 
    3677         } elseif ($fetchmode & MDB2_FETCHMODE_FLIPPED) { 
     3955        } elseif ($fetchmode == MDB2_FETCHMODE_FLIPPED) { 
    36783956            do { 
    36793957                foreach ($row as $key => $val) { 
     
    37153993    function numRows() 
    37163994    { 
    3717         return $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     3995        return MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    37183996            'method not implemented', __FUNCTION__); 
    37193997    } 
     
    37314009    function nextResult() 
    37324010    { 
    3733         return $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     4011        return MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    37344012            'method not implemented', __FUNCTION__); 
    37354013    } 
     
    37554033        if (!isset($this->column_names)) { 
    37564034            $result = $this->_getColumnNames(); 
    3757             if (PEAR::isError($result)) { 
     4035            if (MDB2::isError($result)) { 
    37584036                return $result; 
    37594037            } 
     
    37814059    function _getColumnNames() 
    37824060    { 
    3783         return $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     4061        return MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    37844062            'method not implemented', __FUNCTION__); 
    37854063    } 
     
    37984076    function numCols() 
    37994077    { 
    3800         return $this->db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
     4078        return MDB2::raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 
    38014079            'method not implemented', __FUNCTION__); 
    38024080    } 
     
    38454123        } 
    38464124        $this->values[$column] =& $value; 
    3847         if (!is_null($type)) { 
     4125        if (null !== $type) { 
    38484126            $this->types[$column] = $type; 
    38494127        } 
     
    39204198 
    39214199    // }}} 
    3922     // {{{ function MDB2_Row(&$row) 
    3923  
    3924     /** 
    3925      * PHP 4 Constructor 
    3926      * 
    3927      * @param   resource    row data as array 
    3928      */ 
    3929     function MDB2_Row(&$row) 
    3930     { 
    3931         $this->__construct($row); 
    3932     } 
    3933  
    3934     // }}} 
    39354200} 
    39364201 
     
    39604225 
    39614226    // }}} 
    3962     // {{{ constructor: function __construct(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null) 
     4227    // {{{ constructor: function __construct($db, $statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null) 
    39634228 
    39644229    /** 
    39654230     * Constructor 
    39664231     */ 
    3967     function __construct(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null) 
    3968     { 
    3969         $this->db =& $db; 
    3970         $this->statement =& $statement; 
     4232    function __construct($db, $statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null) 
     4233    { 
     4234        $this->db = $db; 
     4235        $this->statement = $statement; 
    39714236        $this->positions = $positions; 
    39724237        $this->query = $query; 
     
    39794244 
    39804245    // }}} 
    3981     // {{{ function MDB2_Statement_Common(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null) 
    3982  
    3983     /** 
    3984      * PHP 4 Constructor 
    3985      */ 
    3986     function MDB2_Statement_Common(&$db, &$statement, $positions, $query, $types, $result_types, $is_manip = false, $limit = null, $offset = null) 
    3987     { 
    3988         $this->__construct($db, $statement, $positions, $query, $types, $result_types, $is_manip, $limit, $offset); 
    3989     } 
    3990  
    3991     // }}} 
    39924246    // {{{ function bindValue($parameter, &$value, $type = null) 
    39934247 
     
    40084262    { 
    40094263        if (!is_numeric($parameter)) { 
    4010             $parameter = preg_replace('/^:(.*)$/', '\\1', $parameter); 
     4264            if (strpos($parameter, ':') === 0) { 
     4265                $parameter = substr($parameter, 1); 
     4266            } 
    40114267        } 
    40124268        if (!in_array($parameter, $this->positions)) { 
    4013             return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
     4269            return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
    40144270                'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__); 
    40154271        } 
    40164272        $this->values[$parameter] = $value; 
    4017         if (!is_null($type)) { 
     4273        if (null !== $type) { 
    40184274            $this->types[$parameter] = $type; 
    40194275        } 
     
    40414297        $types = is_array($types) ? array_values($types) : array_fill(0, count($values), null); 
    40424298        $parameters = array_keys($values); 
     4299        $this->db->pushErrorHandling(PEAR_ERROR_RETURN); 
     4300        $this->db->expectError(MDB2_ERROR_NOT_FOUND); 
    40434301        foreach ($parameters as $key => $parameter) { 
    4044             $this->db->pushErrorHandling(PEAR_ERROR_RETURN); 
    4045             $this->db->expectError(MDB2_ERROR_NOT_FOUND); 
    40464302            $err = $this->bindValue($parameter, $values[$parameter], $types[$key]); 
    4047             $this->db->popExpect(); 
    4048             $this->db->popErrorHandling(); 
    4049             if (PEAR::isError($err)) { 
     4303            if (MDB2::isError($err)) { 
    40504304                if ($err->getCode() == MDB2_ERROR_NOT_FOUND) { 
    40514305                    //ignore (extra value for missing placeholder) 
    40524306                    continue; 
    40534307                } 
     4308                $this->db->popExpect(); 
     4309                $this->db->popErrorHandling(); 
    40544310                return $err; 
    40554311            } 
    40564312        } 
     4313        $this->db->popExpect(); 
     4314        $this->db->popErrorHandling(); 
    40574315        return MDB2_OK; 
    40584316    } 
     
    40774335    { 
    40784336        if (!is_numeric($parameter)) { 
    4079             $parameter = preg_replace('/^:(.*)$/', '\\1', $parameter); 
     4337            if (strpos($parameter, ':') === 0) { 
     4338                $parameter = substr($parameter, 1); 
     4339            } 
    40804340        } 
    40814341        if (!in_array($parameter, $this->positions)) { 
    4082             return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
     4342            return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
    40834343                'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__); 
    40844344        } 
    40854345        $this->values[$parameter] =& $value; 
    4086         if (!is_null($type)) { 
     4346        if (null !== $type) { 
    40874347            $this->types[$parameter] = $type; 
    40884348        } 
     
    41124372        foreach ($parameters as $key => $parameter) { 
    41134373            $err = $this->bindParam($parameter, $values[$parameter], $types[$key]); 
    4114             if (PEAR::isError($err)) { 
     4374            if (MDB2::isError($err)) { 
    41154375                return $err; 
    41164376            } 
     
    41354395     * @access public 
    41364396     */ 
    4137     function &execute($values = null, $result_class = true, $result_wrap_class = false) 
    4138     { 
    4139         if (is_null($this->positions)) { 
    4140             return $this->db->raiseError(MDB2_ERROR, null, null, 
     4397    function execute($values = null, $result_class = true, $result_wrap_class = false) 
     4398    { 
     4399        if (null === $this->positions) { 
     4400            return MDB2::raiseError(MDB2_ERROR, null, null, 
    41414401                'Prepared statement has already been freed', __FUNCTION__); 
    41424402        } 
     
    41454405        if (!empty($values)) { 
    41464406            $err = $this->bindValueArray($values); 
    4147             if (PEAR::isError($err)) { 
    4148                 return $this->db->raiseError(MDB2_ERROR, null, null, 
     4407            if (MDB2::isError($err)) { 
     4408                return MDB2::raiseError(MDB2_ERROR, null, null, 
    41494409                                            'Binding Values failed with message: ' . $err->getMessage(), __FUNCTION__); 
    41504410            } 
    41514411        } 
    4152         $result =& $this->_execute($result_class, $result_wrap_class); 
     4412        $result = $this->_execute($result_class, $result_wrap_class); 
    41534413        return $result; 
    41544414    } 
    41554415 
    41564416    // }}} 
    4157     // {{{ function &_execute($result_class = true, $result_wrap_class = false) 
     4417    // {{{ function _execute($result_class = true, $result_wrap_class = false) 
    41584418 
    41594419    /** 
     
    41674427     * @access  private 
    41684428     */ 
    4169     function &_execute($result_class = true, $result_wrap_class = false) 
     4429    function _execute($result_class = true, $result_wrap_class = false) 
    41704430    { 
    41714431        $this->last_query = $this->query; 
     
    41744434        foreach ($this->positions as $current_position => $parameter) { 
    41754435            if (!array_key_exists($parameter, $this->values)) { 
    4176                 return $this->db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
     4436                return MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
    41774437                    'Unable to bind to missing placeholder: '.$parameter, __FUNCTION__); 
    41784438            } 
     
    41844444                $type = !empty($this->types[$parameter]) ? $this->types[$parameter] : null; 
    41854445                $value_quoted = $this->db->quote($value, $type); 
    4186                 if (PEAR::isError($value_quoted)) { 
     4446                if (MDB2::isError($value_quoted)) { 
    41874447                    return $value_quoted; 
    41884448                } 
     
    41984458            $result = $this->db->exec($query); 
    41994459        } else { 
    4200             $result =& $this->db->query($query, $this->result_types, $result_class, $result_wrap_class); 
     4460            $result = $this->db->query($query, $this->result_types, $result_class, $result_wrap_class); 
    42014461        } 
    42024462        return $result; 
     
    42154475    function free() 
    42164476    { 
    4217         if (is_null($this->positions)) { 
    4218             return $this->db->raiseError(MDB2_ERROR, null, null, 
     4477        if (null === $this->positions) { 
     4478            return MDB2::raiseError(MDB2_ERROR, null, null, 
    42194479                'Prepared statement has already been freed', __FUNCTION__); 
    42204480        } 
     
    42574517     * @access  protected 
    42584518     */ 
    4259     var $db_index; 
     4519    protected $db_index; 
    42604520 
    42614521    // }}} 
     
    42714531 
    42724532    // }}} 
    4273     // {{{ function MDB2_Module_Common($db_index) 
    4274  
    4275     /** 
    4276      * PHP 4 Constructor 
    4277      */ 
    4278     function MDB2_Module_Common($db_index) 
    4279     { 
    4280         $this->__construct($db_index); 
    4281     } 
    4282  
    4283     // }}} 
    4284     // {{{ function &getDBInstance() 
     4533    // {{{ function getDBInstance() 
    42854534 
    42864535    /** 
     
    42914540     * @access  public 
    42924541     */ 
    4293     function &getDBInstance() 
     4542    function getDBInstance() 
    42944543    { 
    42954544        if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) { 
    4296             $result =& $GLOBALS['_MDB2_databases'][$this->db_index]; 
     4545            $result = $GLOBALS['_MDB2_databases'][$this->db_index]; 
    42974546        } else { 
    4298             $result =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
     4547            $result = MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 
    42994548                'could not find MDB2 instance'); 
    43004549        } 
Note: See TracChangeset for help on using the changeset viewer.