PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB2 » Bug #4685

Specify fetchmode for the iterator

Details

Request #4685Specify fetchmode for the iterator
Submitted2005-06-26 16:20 UTC
Fromo dot persson at gmail dot com
StatusClosed
PackageMDB2
PHP Version5.0.4
Roadmaps(Not assigned)

Comments

[2005-06-26 16:20 UTC] o dot persson at gmail dot com

Description:
------------
Would be a nice feature to be able to specify the fetch-mode when using the MDB2-iterators.

Reproduce code:
---------------
--- Iterator.php.orig 2005-06-26 18:14:39.000000000 +0200
+++ Iterator.php 2005-06-26 18:13:46.000000000 +0200
@@ -51,6 +51,7 @@
*/
class MDB2_Iterator implements Iterator
{
+ protected $fetchmode;
protected $result;
protected $row;

@@ -59,9 +60,10 @@
/**
* Constructor
*/
- public function __construct($result)
+ public function __construct($result, $fetchmode = MDB2_FETCHMODE_DEFAULT)
{
$this->result = $result;
+ $this->fetchmode = $fetchmode;
}

// }}}
@@ -108,7 +110,7 @@
public function current()
{
if (is_null($this->row)) {
- $row = $this->result->fetchRow();
+ $row = $this->result->fetchRow($this->fetchmode);
if (PEAR::isError($row)) {
$row = false;
}

[2005-06-29 12:31 UTC] smith at backendmedia dot com

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.