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

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

File:
1 edited

Legend:

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

    r15532 r18609  
    1818 * @package    DB 
    1919 * @author     Sterling Hughes <[email protected]> 
    20  * @author     Ant?io Carlos Ven?cio J?ior <[email protected]> 
     20 * @author     Antônio Carlos Venâncio Júnior <[email protected]> 
    2121 * @author     Daniel Convissor <[email protected]> 
    22  * @copyright  1997-2005 The PHP Group 
     22 * @copyright  1997-2007 The PHP Group 
    2323 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    2424 * @version    CVS: $Id$ 
     
    4343 * @package    DB 
    4444 * @author     Sterling Hughes <[email protected]> 
    45  * @author     Ant?io Carlos Ven?cio J?ior <[email protected]> 
     45 * @author     Antônio Carlos Venâncio Júnior <[email protected]> 
    4646 * @author     Daniel Convissor <[email protected]> 
    47  * @copyright  1997-2005 The PHP Group 
     47 * @copyright  1997-2007 The PHP Group 
    4848 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    49  * @version    Release: @package_version@ 
     49 * @version    Release: 1.7.14RC1 
    5050 * @link       http://pear.php.net/package/DB 
    5151 */ 
     
    249249    function simpleQuery($query) 
    250250    { 
    251         $ismanip = DB::isManip($query); 
     251        $ismanip = $this->_checkManip($query); 
    252252        $this->last_query = $query; 
    253         if (!@sybase_select_db($this->_db, $this->connection)) { 
     253        if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) { 
    254254            return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED); 
    255255        } 
     
    371371    function freeResult($result) 
    372372    { 
    373         return @sybase_free_result($result); 
     373        return is_resource($result) ? sybase_free_result($result) : false; 
    374374    } 
    375375 
     
    436436    function affectedRows() 
    437437    { 
    438         if (DB::isManip($this->last_query)) { 
     438        if ($this->_last_query_manip) { 
    439439            $result = @sybase_affected_rows($this->connection); 
    440440        } else { 
     
    463463    { 
    464464        $seqname = $this->getSequenceName($seq_name); 
    465         if (!@sybase_select_db($this->_db, $this->connection)) { 
     465        if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) { 
    466466            return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED); 
    467467        } 
     
    480480                } 
    481481            } elseif (!DB::isError($result)) { 
    482                 $result =& $this->query("SELECT @@IDENTITY FROM $seqname"); 
     482                $result = $this->query("SELECT @@IDENTITY FROM $seqname"); 
    483483                $repeat = 0; 
    484484            } else { 
     
    530530 
    531531    // }}} 
     532    // {{{ quoteFloat() 
     533 
     534    /** 
     535     * Formats a float value for use within a query in a locale-independent 
     536     * manner. 
     537     * 
     538     * @param float the float value to be quoted. 
     539     * @return string the quoted string. 
     540     * @see DB_common::quoteSmart() 
     541     * @since Method available since release 1.7.8. 
     542     */ 
     543    function quoteFloat($float) { 
     544        return $this->escapeSimple(str_replace(',', '.', strval(floatval($float)))); 
     545    } 
     546      
     547    // }}} 
    532548    // {{{ autoCommit() 
    533549 
     
    559575    { 
    560576        if ($this->transaction_opcount > 0) { 
    561             if (!@sybase_select_db($this->_db, $this->connection)) { 
     577            if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) { 
    562578                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED); 
    563579            } 
     
    582598    { 
    583599        if ($this->transaction_opcount > 0) { 
    584             if (!@sybase_select_db($this->_db, $this->connection)) { 
     600            if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) { 
    585601                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED); 
    586602            } 
     
    643659    { 
    644660        static $error_regexps; 
     661         
     662        // PHP 5.2+ prepends the function name to $php_errormsg, so we need 
     663        // this hack to work around it, per bug #9599. 
     664        $errormsg = preg_replace('/^sybase[a-z_]+\(\): /', '', $errormsg); 
     665         
    645666        if (!isset($error_regexps)) { 
    646667            $error_regexps = array( 
     
    675696                '/^There are fewer columns in the INSERT statement than values specified/i' 
    676697                    => DB_ERROR_VALUE_COUNT_ON_ROW, 
     698                '/Divide by zero/i' 
     699                    => DB_ERROR_DIVZERO, 
    677700            ); 
    678701        } 
     
    715738             * Create a result resource identifier. 
    716739             */ 
    717             if (!@sybase_select_db($this->_db, $this->connection)) { 
     740            if ($this->_db && !@sybase_select_db($this->_db, $this->connection)) { 
    718741                return $this->sybaseRaiseError(DB_ERROR_NODBSELECTED); 
    719742            } 
     
    812835            $tableName = $table; 
    813836 
    814             // get unique/primary keys 
    815             $res = $this->getAll("sp_helpindex $table", DB_FETCHMODE_ASSOC); 
    816  
    817             if (!isset($res[0]['index_description'])) { 
     837            /* We're running sp_helpindex directly because it doesn't exist in 
     838             * older versions of ASE -- unfortunately, we can't just use 
     839             * DB::isError() because the user may be using callback error 
     840             * handling. */ 
     841            $res = @sybase_query("sp_helpindex $table", $this->connection); 
     842 
     843            if ($res === false || $res === true) { 
     844                // Fake a valid response for BC reasons. 
    818845                return ''; 
    819846            } 
    820847 
    821             foreach ($res as $val) { 
     848            while (($val = sybase_fetch_assoc($res)) !== false) { 
     849                if (!isset($val['index_keys'])) { 
     850                    /* No useful information returned. Break and be done with 
     851                     * it, which preserves the pre-1.7.9 behaviour. */ 
     852                    break; 
     853                } 
     854 
    822855                $keys = explode(', ', trim($val['index_keys'])); 
    823856 
     
    834867                } 
    835868            } 
     869 
     870            sybase_free_result($res); 
    836871 
    837872        } 
Note: See TracChangeset for help on using the changeset viewer.