Ignore:
Timestamp:
2009/03/06 20:21:51 (15 years ago)
Author:
Seasoft
Message:

・PEAR::DB を Ver.1.7.14RC1(2007-11-27)ベースに更改。
・不適切な文字列比較を修正。

 http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=1808&forum=9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/module/DB/mysql.php

    r15532 r17877  
    1919 * @author     Stig Bakken <ssb@php.net> 
    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$ 
     
    4040 * @author     Stig Bakken <ssb@php.net> 
    4141 * @author     Daniel Convissor <danielc@php.net> 
    42  * @copyright  1997-2005 The PHP Group 
     42 * @copyright  1997-2007 The PHP Group 
    4343 * @license    http://www.php.net/license/3_0.txt  PHP License 3.0 
    44  * @version    Release: @package_version@ 
     44 * @version    Release: 1.7.14RC1 
    4545 * @link       http://pear.php.net/package/DB 
    4646 */ 
     
    112112        1216 => DB_ERROR_CONSTRAINT, 
    113113        1217 => DB_ERROR_CONSTRAINT, 
     114        1356 => DB_ERROR_DIVZERO, 
     115        1451 => DB_ERROR_CONSTRAINT, 
     116        1452 => DB_ERROR_CONSTRAINT, 
    114117    ); 
    115118 
     
    237240                                                      $params); 
    238241        } else { 
    239             ini_set('track_errors', 1); 
     242            @ini_set('track_errors', 1); 
    240243            $this->connection = @call_user_func_array($connect_function, 
    241244                                                      $params); 
    242             ini_set('track_errors', $ini); 
     245            @ini_set('track_errors', $ini); 
    243246        } 
    244247 
     
    298301    function simpleQuery($query) 
    299302    { 
    300         $ismanip = DB::isManip($query); 
     303        $ismanip = $this->_checkManip($query); 
    301304        $this->last_query = $query; 
    302305        $query = $this->modifyQuery($query); 
     
    420423    function freeResult($result) 
    421424    { 
    422         return @mysql_free_result($result); 
     425        return is_resource($result) ? mysql_free_result($result) : false; 
    423426    } 
    424427 
     
    556559    function affectedRows() 
    557560    { 
    558         if (DB::isManip($this->last_query)) { 
     561        if ($this->_last_query_manip) { 
    559562            return @mysql_affected_rows($this->connection); 
    560563        } else { 
     
    753756    /** 
    754757     * Quotes a string so it can be safely used as a table or column name 
    755      * 
    756      * MySQL can't handle the backtick character (<kbd>`</kbd>) in 
    757      * table or column names. 
     758     * (WARNING: using names that require this is a REALLY BAD IDEA) 
     759     * 
     760     * WARNING:  Older versions of MySQL can't handle the backtick 
     761     * character (<kbd>`</kbd>) in table or column names. 
    758762     * 
    759763     * @param string $str  identifier name to be quoted 
     
    766770    function quoteIdentifier($str) 
    767771    { 
    768         return '`' . $str . '`'; 
     772        return '`' . str_replace('`', '``', $str) . '`'; 
    769773    } 
    770774 
     
    853857    function modifyLimitQuery($query, $from, $count, $params = array()) 
    854858    { 
    855         if (DB::isManip($query)) { 
     859        if (DB::isManip($query) || $this->_next_query_manip) { 
    856860            return $query . " LIMIT $count"; 
    857861        } else { 
     
    929933    { 
    930934        if (is_string($result)) { 
     935            // Fix for bug #11580. 
     936            if ($this->_db) { 
     937                if (!@mysql_select_db($this->_db, $this->connection)) { 
     938                    return $this->mysqlRaiseError(DB_ERROR_NODBSELECTED); 
     939                } 
     940            } 
     941             
    931942            /* 
    932943             * Probably received a table name. 
    933944             * Create a result resource identifier. 
    934945             */ 
    935             $id = @mysql_list_fields($this->dsn['database'], 
    936                                      $result, $this->connection); 
     946            $id = @mysql_query("SELECT * FROM $result LIMIT 0", 
     947                               $this->connection); 
    937948            $got_string = true; 
    938949        } elseif (isset($result->result)) { 
Note: See TracChangeset for help on using the changeset viewer.