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/fbsql.php

    r15532 r17877  
    1919 * @author     Frank M. Kromann <frank@frontbase.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$ 
     
    4040 * @author     Frank M. Kromann <frank@frontbase.com> 
    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 * @since      Class functional since Release 1.7.0 
     
    172172                                                      $params); 
    173173        } else { 
    174             ini_set('track_errors', 1); 
     174            @ini_set('track_errors', 1); 
    175175            $this->connection = @call_user_func_array($connect_function, 
    176176                                                      $params); 
    177             ini_set('track_errors', $ini); 
     177            @ini_set('track_errors', $ini); 
    178178        } 
    179179 
     
    230230        // Determine which queries that should return data, and which 
    231231        // should return an error code only. 
    232         if (DB::isManip($query)) { 
     232        if ($this->_checkManip($query)) { 
    233233            return DB_OK; 
    234234        } 
     
    321321    function freeResult($result) 
    322322    { 
    323         return @fbsql_free_result($result); 
     323        return is_resource($result) ? fbsql_free_result($result) : false; 
    324324    } 
    325325 
     
    354354    function commit() 
    355355    { 
    356         @fbsql_commit(); 
     356        @fbsql_commit($this->connection); 
    357357    } 
    358358 
     
    367367    function rollback() 
    368368    { 
    369         @fbsql_rollback(); 
     369        @fbsql_rollback($this->connection); 
    370370    } 
    371371 
     
    432432    function affectedRows() 
    433433    { 
    434         if (DB::isManip($this->last_query)) { 
     434        if ($this->_last_query_manip) { 
    435435            $result = @fbsql_affected_rows($this->connection); 
    436436        } else { 
     
    544544    function modifyLimitQuery($query, $from, $count, $params = array()) 
    545545    { 
    546         if (DB::isManip($query)) { 
     546        if (DB::isManip($query) || $this->_next_query_manip) { 
    547547            return preg_replace('/^([\s(])*SELECT/i', 
    548548                                "\\1SELECT TOP($count)", $query); 
     
    554554 
    555555    // }}} 
    556     // {{{ quoteSmart() 
    557  
    558     /** 
    559      * Formats input so it can be safely used in a query 
    560      * 
    561      * @param mixed $in  the data to be formatted 
    562      * 
    563      * @return mixed  the formatted data.  The format depends on the input's 
    564      *                 PHP type: 
    565      *                 + null = the string <samp>NULL</samp> 
    566      *                 + boolean = string <samp>TRUE</samp> or <samp>FALSE</samp> 
    567      *                 + integer or double = the unquoted number 
    568      *                 + other (including strings and numeric strings) = 
    569      *                   the data escaped according to FrontBase's settings 
    570      *                   then encapsulated between single quotes 
    571      * 
     556    // {{{ quoteBoolean() 
     557 
     558    /** 
     559     * Formats a boolean value for use within a query in a locale-independent 
     560     * manner. 
     561     * 
     562     * @param boolean the boolean value to be quoted. 
     563     * @return string the quoted string. 
    572564     * @see DB_common::quoteSmart() 
    573      * @since Method available since Release 1.6.0 
    574      */ 
    575     function quoteSmart($in) 
    576     { 
    577         if (is_int($in) || is_double($in)) { 
    578             return $in; 
    579         } elseif (is_bool($in)) { 
    580             return $in ? 'TRUE' : 'FALSE'; 
    581         } elseif (is_null($in)) { 
    582             return 'NULL'; 
    583         } else { 
    584             return "'" . $this->escapeSimple($in) . "'"; 
    585         } 
    586     } 
    587  
     565     * @since Method available since release 1.7.8. 
     566     */ 
     567    function quoteBoolean($boolean) { 
     568        return $boolean ? 'TRUE' : 'FALSE'; 
     569    } 
     570      
     571    // }}} 
     572    // {{{ quoteFloat() 
     573 
     574    /** 
     575     * Formats a float value for use within a query in a locale-independent 
     576     * manner. 
     577     * 
     578     * @param float the float value to be quoted. 
     579     * @return string the quoted string. 
     580     * @see DB_common::quoteSmart() 
     581     * @since Method available since release 1.7.8. 
     582     */ 
     583    function quoteFloat($float) { 
     584        return $this->escapeSimple(str_replace(',', '.', strval(floatval($float)))); 
     585    } 
     586      
    588587    // }}} 
    589588    // {{{ fbsqlRaiseError() 
Note: See TracChangeset for help on using the changeset viewer.