SQLiteResultSetIterator.php

Go to the documentation of this file.
00001 <?php 00002 /* 00003 * $Id: SQLiteResultSetIterator.php,v 1.3 2004/03/15 17:47:45 hlellelid Exp $ 00004 * 00005 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00006 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00007 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00008 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00009 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00010 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00011 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00012 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00013 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00014 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00015 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00016 * 00017 * This software consists of voluntary contributions made by many individuals 00018 * and is licensed under the LGPL. For more information please see 00019 * <http://creole.phpdb.org>. 00020 */ 00021 00029 class SQLiteResultSetIterator implements Iterator { 00030 00031 private $result; 00032 private $pos = 0; 00033 private $fetchmode; 00034 private $row; 00035 00040 public function __construct(SQLiteResultSet $rs) 00041 { 00042 $this->result = $rs->getResource(); 00043 $this->fetchmode = $rs->getFetchmode(); 00044 } 00045 00049 function rewind() 00050 { 00051 sqlite_rewind($this->result); 00052 } 00053 00054 function valid() 00055 { 00056 return sqlite_next($this->result); 00057 } 00058 00065 function key() 00066 { 00067 return $this->pos; 00068 } 00069 00074 function current() 00075 { 00076 return sqlite_current($this->result, $this->fetchmode); 00077 } 00078 00082 function next() 00083 { 00084 $this->pos++; 00085 } 00086 00087 }

This file is part of the Creole[php5] library.


Copyright © 2004 Hans Lellelid  
Creole[php5] CVS