Re: DB stuff
| From: | (Stig Sæther Bakken) | Date: | Mon, 26 Mar 2001 06:45:16 +0000 |
| Subject: | Re: DB stuff | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-93@lists.php.net to get a copy of this message | ||
["Colin Viebrock" <colin@easyDNS.com>]
> > - IMHO there is no need to mantain two versions with the same
> > functionality of fetchrow (fetchrow() and fetchinto()). I propose to
> > erase one in backend extensions and "emulate" the other throw DB_result.
> > Something like this in DB_result:
>
> While we are at it, can we add this to DB_result:
>
> function fetchObject($fetchmode = DB_FETCHMODE_DEFAULT)
> {
> $res = $this->fetchInto ($arr, $fetchmode);
> if (is_object($res)) {
> return $res;
> }
> return (object)$arr;
> }
The fetchmode has to be hardcoded to DB_FETCHMODE_ASSOC here, or your
object won't contain much. Also, if fetchInto() returns an object, an
error should be raised. :-)
> I've been missing mysql_fetch_object since switching to PEAR. :)
If "->" somehow pleases you more than "[]", fine. I still don't see
the point in having objects without methods instead of assocs. :-)
- Stig
--
Stig Sæther Bakken <ssb@fast.no>
Fast Search & Transfer ASA, Trondheim, Norway