Re: DB::fetchRow() question
| From: | Tomas V.V.Cox | Date: | Tue, 21 Aug 2001 10:41:49 +0000 |
| Subject: | Re: DB::fetchRow() question | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-1644@lists.php.net to get a copy of this message | ||
Cynic wrote:
>
> Hi there,
>
> can anyone tell me why fetchRow() expects resultset identifier
> as its first argument? It's in $this->result, so why increase
> the programmer's burden?
>
> The function looks like this:
> function &fetchRow($result, $fetchmode = DB_FETCHMODE_DEFAULT)
>
> when all that is IMO needed is
> function &fetchRow($fetchmode = DB_FETCHMODE_DEFAULT)
>
> I must have missed something...
>
A DB_result object is an interface for the native driver methods, so
$this->result is not avaible there.
// The DB_result object is created and stores $dbh itself as a property
$res = $dbh->query();
// This will internally call $res->dbh->fetchRow($result, ...)
$res->fetchRow();
See DB_Common::query(), DB_result class in DB.php and native driver for
more info.
Tomas V.V.Cox