Ignore:
Timestamp:
2010/03/11 10:35:11 (14 years ago)
Author:
kajiwara
Message:

正式版にナイトリービルド版をマージしてみるテスト

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tmp/version-2_5-test/data/module/DB.php

    r15532 r18609  
    1919 * @author     Tomas V.V.Cox <cox@idecnet.com> 
    2020 * @author     Daniel Convissor <danielc@php.net> 
    21  * @copyright  1997-2005 The PHP Group 
     21 * @copyright  1997-2007 The PHP Group 
    2222 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    2323 * @version    CVS: $Id$ 
     
    2828 * Obtain the PEAR class so it can be extended from 
    2929 */ 
    30  
    3130if(!defined('DB_PHP_DIR')) { 
    3231    $DB_PHP_DIR = realpath(dirname( __FILE__)); 
    3332    define("DB_PHP_DIR", $DB_PHP_DIR);   
    3433} 
    35  
    3634require_once DB_PHP_DIR . '/PEAR.php'; 
     35 
    3736 
    3837// {{{ constants 
     
    430429 * @author     Tomas V.V.Cox <cox@idecnet.com> 
    431430 * @author     Daniel Convissor <danielc@php.net> 
    432  * @copyright  1997-2005 The PHP Group 
     431 * @copyright  1997-2007 The PHP Group 
    433432 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    434  * @version    Release: @package_version@ 
     433 * @version    Release: 1.7.14RC1 
    435434 * @link       http://pear.php.net/package/DB 
    436435 */ 
     
    473472        } 
    474473 
    475         @$obj =& new $classname; 
     474        @$obj = new $classname; 
    476475 
    477476        foreach ($options as $option => $value) { 
     
    550549        } 
    551550 
    552         @$obj =& new $classname; 
     551        @$obj = new $classname; 
    553552 
    554553        foreach ($options as $option => $value) { 
     
    561560        $err = $obj->connect($dsninfo, $obj->getOption('persistent')); 
    562561        if (DB::isError($err)) { 
    563             $err->addUserInfo($dsn); 
     562            if (is_array($dsn)) { 
     563                $err->addUserInfo(DB::getDSNString($dsn, true)); 
     564            } else { 
     565                $err->addUserInfo($dsn); 
     566            } 
    564567            return $err; 
    565568        } 
     
    578581    function apiVersion() 
    579582    { 
    580         return '@package_version@'; 
     583        return '1.7.14RC1'; 
    581584    } 
    582585 
     
    631634        $manips = 'INSERT|UPDATE|DELETE|REPLACE|' 
    632635                . 'CREATE|DROP|' 
    633                 . 'LOAD DATA|SELECT .* INTO|COPY|' 
     636                . 'LOAD DATA|SELECT .* INTO .* FROM|COPY|' 
    634637                . 'ALTER|GRANT|REVOKE|' 
    635638                . 'LOCK|UNLOCK'; 
     
    814817        $parsed['protocol'] = (!empty($proto)) ? $proto : 'tcp'; 
    815818        $proto_opts = rawurldecode($proto_opts); 
     819        if (strpos($proto_opts, ':') !== false) { 
     820            list($proto_opts, $parsed['port']) = explode(':', $proto_opts); 
     821        } 
    816822        if ($parsed['protocol'] == 'tcp') { 
    817             if (strpos($proto_opts, ':') !== false) { 
    818                 list($parsed['hostspec'], 
    819                      $parsed['port']) = explode(':', $proto_opts); 
    820             } else { 
    821                 $parsed['hostspec'] = $proto_opts; 
    822             } 
     823            $parsed['hostspec'] = $proto_opts; 
    823824        } elseif ($parsed['protocol'] == 'unix') { 
    824825            $parsed['socket'] = $proto_opts; 
     
    854855 
    855856    // }}} 
     857    // {{{ getDSNString() 
     858 
     859    /** 
     860     * Returns the given DSN in a string format suitable for output. 
     861     * 
     862     * @param array|string the DSN to parse and format 
     863     * @param boolean true to hide the password, false to include it 
     864     * @return string 
     865     */ 
     866    function getDSNString($dsn, $hidePassword) { 
     867        /* Calling parseDSN will ensure that we have all the array elements 
     868         * defined, and means that we deal with strings and array in the same 
     869         * manner. */ 
     870        $dsnArray = DB::parseDSN($dsn); 
     871         
     872        if ($hidePassword) { 
     873            $dsnArray['password'] = 'PASSWORD'; 
     874        } 
     875 
     876        /* Protocol is special-cased, as using the default "tcp" along with an 
     877         * Oracle TNS connection string fails. */ 
     878        if (is_string($dsn) && strpos($dsn, 'tcp') === false && $dsnArray['protocol'] == 'tcp') { 
     879            $dsnArray['protocol'] = false; 
     880        } 
     881         
     882        // Now we just have to construct the actual string. This is ugly. 
     883        $dsnString = $dsnArray['phptype']; 
     884        if ($dsnArray['dbsyntax']) { 
     885            $dsnString .= '('.$dsnArray['dbsyntax'].')'; 
     886        } 
     887        $dsnString .= '://' 
     888                     .$dsnArray['username'] 
     889                     .':' 
     890                     .$dsnArray['password'] 
     891                     .'@' 
     892                     .$dsnArray['protocol']; 
     893        if ($dsnArray['socket']) { 
     894            $dsnString .= '('.$dsnArray['socket'].')'; 
     895        } 
     896        if ($dsnArray['protocol'] && $dsnArray['hostspec']) { 
     897            $dsnString .= '+'; 
     898        } 
     899        $dsnString .= $dsnArray['hostspec']; 
     900        if ($dsnArray['port']) { 
     901            $dsnString .= ':'.$dsnArray['port']; 
     902        } 
     903        $dsnString .= '/'.$dsnArray['database']; 
     904         
     905        /* Option handling. Unfortunately, parseDSN simply places options into 
     906         * the top-level array, so we'll first get rid of the fields defined by 
     907         * DB and see what's left. */ 
     908        unset($dsnArray['phptype'], 
     909              $dsnArray['dbsyntax'], 
     910              $dsnArray['username'], 
     911              $dsnArray['password'], 
     912              $dsnArray['protocol'], 
     913              $dsnArray['socket'], 
     914              $dsnArray['hostspec'], 
     915              $dsnArray['port'], 
     916              $dsnArray['database'] 
     917        ); 
     918        if (count($dsnArray) > 0) { 
     919            $dsnString .= '?'; 
     920            $i = 0; 
     921            foreach ($dsnArray as $key => $value) { 
     922                if (++$i > 1) { 
     923                    $dsnString .= '&'; 
     924                } 
     925                $dsnString .= $key.'='.$value; 
     926            } 
     927        } 
     928 
     929        return $dsnString; 
     930    } 
     931     
     932    // }}} 
    856933} 
    857934 
     
    866943 * @package    DB 
    867944 * @author     Stig Bakken <ssb@php.net> 
    868  * @copyright  1997-2005 The PHP Group 
     945 * @copyright  1997-2007 The PHP Group 
    869946 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    870  * @version    Release: @package_version@ 
     947 * @version    Release: 1.7.14RC1 
    871948 * @link       http://pear.php.net/package/DB 
    872949 */ 
     
    913990 * @package    DB 
    914991 * @author     Stig Bakken <ssb@php.net> 
    915  * @copyright  1997-2005 The PHP Group 
     992 * @copyright  1997-2007 The PHP Group 
    916993 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    917  * @version    Release: @package_version@ 
     994 * @version    Release: 1.7.14RC1 
    918995 * @link       http://pear.php.net/package/DB 
    919996 */ 
     
    10951172            $object_class = $this->fetchmode_object_class; 
    10961173        } 
    1097         if ($this->limit_from !== null) { 
     1174        if (is_null($rownum) && $this->limit_from !== null) { 
    10981175            if ($this->row_counter === null) { 
    10991176                $this->row_counter = $this->limit_from; 
     
    11271204                    $arr = (object) $arr; 
    11281205                } else { 
    1129                     $arr = &new $object_class($arr); 
     1206                    $arr = new $object_class($arr); 
    11301207                } 
    11311208            } 
     
    11771254            $object_class = $this->fetchmode_object_class; 
    11781255        } 
    1179         if ($this->limit_from !== null) { 
     1256        if (is_null($rownum) && $this->limit_from !== null) { 
    11801257            if ($this->row_counter === null) { 
    11811258                $this->row_counter = $this->limit_from; 
     
    12591336                $i++; 
    12601337            } 
    1261             return $i; 
     1338            $count = $i; 
    12621339        } else { 
    1263             return $this->dbh->numRows($this->result); 
    1264         } 
     1340            $count = $this->dbh->numRows($this->result); 
     1341        } 
     1342 
     1343        /* fbsql is checked for here because limit queries are implemented 
     1344         * using a TOP() function, which results in fbsql_num_rows still 
     1345         * returning the total number of rows that would have been returned, 
     1346         * rather than the real number. As a result, we'll just do the limit 
     1347         * calculations for fbsql in the same way as a database with emulated 
     1348         * limits. Unfortunately, we can't just do this in DB_fbsql::numRows() 
     1349         * because that only gets the result resource, rather than the full 
     1350         * DB_Result object. */ 
     1351        if (($this->dbh->features['limit'] === 'emulate' 
     1352             && $this->limit_from !== null) 
     1353            || $this->dbh->phptype == 'fbsql') { 
     1354            $limit_count = is_null($this->limit_count) ? $count : $this->limit_count; 
     1355            if ($count < $this->limit_from) { 
     1356                $count = 0; 
     1357            } elseif ($count < ($this->limit_from + $limit_count)) { 
     1358                $count -= $this->limit_from; 
     1359            } else { 
     1360                $count = $limit_count; 
     1361            } 
     1362        } 
     1363 
     1364        return $count; 
    12651365    } 
    12661366 
     
    13551455 * @package    DB 
    13561456 * @author     Stig Bakken <ssb@php.net> 
    1357  * @copyright  1997-2005 The PHP Group 
     1457 * @copyright  1997-2007 The PHP Group 
    13581458 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    1359  * @version    Release: @package_version@ 
     1459 * @version    Release: 1.7.14RC1 
    13601460 * @link       http://pear.php.net/package/DB 
    13611461 * @see        DB_common::setFetchMode() 
Note: See TracChangeset for help on using the changeset viewer.