Re: little inconsitency in PEAR DB ... should MDB care?
| From: | Tomas V.V.Cox | Date: | Tue, 16 Jul 2002 11:10:06 +0000 |
| Subject: | Re: little inconsitency in PEAR DB ... should MDB care? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-7743@lists.php.net to get a copy of this message | ||
El lun, 15-07-2002 a las 20:28, Lukas Smith escribió:
> Hi,
>
> just found one instance where PEAR DB uses a pass by reference var to
> return data:
>
> fetchInto()
Sorry I guess that I'm not catching where the inconsistency is.
FetchInto() is so, fetch the result into that var.
> stig told me that tomas made this modification to be able to do
> something like this:
>
> while (DB_OK === $rs->fetchInto($fields)) {
> ...
> }
The modification I did was to change the value of the DB_OK constant to
be 1 instead of 0, so it won't break the loop when you have a error
handler defined and do [while ($rs->fetchInto($row)) {]
> but this could also be done like this if I am not mistaken:
>
> while (is_array($rs->fetchInto($fields))) {
> ...
> }
Nop, think on DB_FETCHMODE_OBJECT
> so should MDB use the PEAR DB way in this case or not?
IMHO PEAR DB is a little bit bloat with the amount of fetch types and
methods. If I'd create it from ground I'll only provide fetchRow() and
DB_FETCHMODE_(ORDERED|ASSOC), dropping fetchInto() and
DB_FETCHMODE_OBJECT. Btw I guess that fetchInto() is a little more fast
and some people do love row objects.
Tomas V.V.Cox