4 V4.92a 29 Aug 2006 (c) 2000-2006 John Lim (jlim#natsoft.com.my). All rights reserved.
5 Released under both BSD license and Lesser GPL library license.
6 Whenever there is any discrepancy between the two licenses,
7 the BSD license will take precedence.
11 Declares the ADODB Base Class for PHP5 "ADODB_BASE_RS", and supports iteration with
12 the ADODB_Iterator class.
14 $rs = $db->Execute("select * from adoxyz");
15 foreach($rs as $k => $v) {
16 echo $k; print_r($v); echo "<br>";
20 Iterator code based on http://cvs.php.net/cvs.php/php-src/ext/spl/examples/cachingiterator.inc?login=2
24 class ADODB_Iterator
implements Iterator
{
28 function __construct($rs)
34 $this->rs
->MoveFirst();
39 return !$this->rs
->EOF
;
44 return $this->rs
->_currentRow
;
49 return $this->rs
->fields
;
54 $this->rs
->MoveNext();
57 function __call($func, $params)
59 return call_user_func_array(array($this->rs
, $func), $params);
65 return !$this->rs
->EOF
;
71 class ADODB_BASE_RS
implements IteratorAggregate
{
72 function getIterator() {
73 return new ADODB_Iterator($this);
76 /* this is experimental - i don't really know what to return... */
79 include_once(ADODB_DIR
.'/toexport.inc.php');
80 return _adodb_export($this,',',',',false,true);