Changeset 262

Show
Ignore:
Timestamp:
09/18/06 18:44:01 (2 years ago)
Author:
laurentj
Message:

fix bug sur jDbPDOResultSet : il ne doit pas implementer Iterator, PDOStatement l'interdisant (mais reste utilisable dans un foreach par exemple)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/db/jDbPDOConnection.class.php

    r248 r262  
    2929 * @subpackage db 
    3030 */ 
    31 class jDbPDOResultSet extends PDOStatement implements Iterator
     31class jDbPDOResultSet extends PDOStatement
    3232 
    3333    const FETCH_CLASS = 8; 
     
    5555        return parent::setFetchMode($mode, $param); 
    5656    } 
    57  
    58     //--------------- interface Iterator 
    59     protected $_currentRecord = false; 
    60     protected $_recordIndex = 0; 
    61  
    62     function current () { 
    63         return $this->_currentRecord; 
    64     } 
    65         function key () { 
    66           return $this->_recordIndex; 
    67         } 
    68  
    69         function next () { 
    70           $this->_currentRecord =  $this->fetch(JPDO_FETCH_OBJ,JPDO_FETCH_ORI_NEXT); 
    71           if($this->_currentRecord) 
    72               $this->_recordIndex++; 
    73         } 
    74  
    75         function rewind () { 
    76           $this->_rewind(); 
    77           $this->_recordIndex = 0; 
    78           $this->_currentRecord =  $this->fetch(JPDO_FETCH_OBJ,JPDO_FETCH_ORI_FIRST); 
    79         } 
    80  
    81         function valid () { 
    82           return ($this->_currentRecord != false); 
    83         } 
    84  
    8557} 
    8658 
Download in other formats: Unified Diff Zip Archive