Changeset 123 for branches

Show
Ignore:
Timestamp:
08/21/08 19:13:27 (4 months ago)
Author:
dwhittle
Message:

fixed merged issue for getDate method in mysqli

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.2/classes/creole/drivers/mysqli/MySQLiResultSet.php

    r122 r123  
    146146        $ts = strtotime($this->fields[$column]); 
    147147 
    148     /** 
    149      * @see ResultSetCommon::getDate() 
    150      */ 
    151     public function getDate($column, $format = '%X') 
    152     { 
    153         /* As of PHP 5.2.4, strftime() returns false for '0000-00-00' which 
    154            is impossible to tell apart from illegal dates. (Pre-PHP 5.2.4 
    155            even interpreted such dates incorrectly, see  
    156            http://bugs.php.net/bug.php?id=41523). 
    157            We catch this special case and return null as the date here. 
    158            However, we need to know the exact format the DBMS returns this 
    159            date, which is why we make this decision here in the specific 
    160            driver before dispatching to the common implementation. */ 
    161         $idx = (is_int($column) ? $column - 1 : $column);         
    162         if (array_key_exists($idx, $this->fields) && $this->fields[$idx] == '0000-00-00') return null; 
    163         return parent::getDate($column, $format); 
    164     } 
    165  
    166148        if ($ts === -1 || $ts === false) { // in PHP 5.1 return value changes to FALSE 
    167149            // otherwise it's an ugly MySQL timestamp! 
     
    189171        } 
    190172    } 
     173 
     174    /** 
     175     * @see ResultSetCommon::getDate() 
     176     */ 
     177    public function getDate($column, $format = '%X') 
     178    { 
     179        /* As of PHP 5.2.4, strftime() returns false for '0000-00-00' which 
     180           is impossible to tell apart from illegal dates. (Pre-PHP 5.2.4 
     181           even interpreted such dates incorrectly, see  
     182           http://bugs.php.net/bug.php?id=41523). 
     183           We catch this special case and return null as the date here. 
     184           However, we need to know the exact format the DBMS returns this 
     185           date, which is why we make this decision here in the specific 
     186           driver before dispatching to the common implementation. */ 
     187        $idx = (is_int($column) ? $column - 1 : $column);         
     188        if (array_key_exists($idx, $this->fields) && $this->fields[$idx] == '0000-00-00') return null; 
     189        return parent::getDate($column, $format); 
     190    } 
    191191}