Re: [PHP-PEAR] The PEAR $db->fetchRow Blues (ref: DB_mysql...
[email protected] ("Stig S. Bakken")
| Newsgroups | php.pear |
|---|---|
| Organization | Fast Search & Transfer |
| Message-ID | <[email protected]> |
I agree, this was also the intended behaviour. Chuck is of course right
in that it should be consistent. This way is IMHO the easiest for the
programmer, and that means a lot to me. :-)
- Stig
Vinai Kopp wrote:
>
> I like to use
>
> while( $row = $result->fetchRow(DB_FETCHMODE_ASSOC) ){
> if( DB::isError( $row ) ){
> handle_db_error( $row );
> break;
> }
>
> At least for me it is the most flexible and most understandable way of
> handling things.
> isError returning true for NULL (which isn't an error) makes things
> IMVHO more complicated for newbies to understand.
> Let's change all the DB fetchRow Functions to return NULL on end of
> results consistently instead.
>
> Vinai
>
> > Robert Kelly wrote:
> >
> > The PEAR FETCHROW BLUES
> >
> > current CVS version
> > // no work
> > while($row = $result->fetchRow(DB_FETCHMODE_ASSOC)) {
> > // because the fetchRow line return $this->raiseError
> >
> > // works
> > while (! DB::isError ( $row = $result->fetchRow
> > (DB_FETCHMODE_ASSOC)) ){
> > // but makes the if $moredata==NULL redundant (? please confirm )
> >
> > I can see the simplicity of version one, the error checking in
> > version 2 and I don't care which one should be used. However, all
> > of the very little documentation out there uses version one, and if
> > you're/we're going to grow PEAR, you may want to concern yourself with
> >
> > barriers to entry (learning curve) and first impressions. As
> > it stands now, if someone downloads PEAR and runs the "newbie"
> > demoResult
> > script, it doesn't work.
> >
> > _I_ on the other hand, wants to use the error checking version,
> > because
> > I am prone to fall flat on my face :)
> >
> > Is there any way to edit the phpbuilder articles?
> > -Bob Kelly
> > [email protected]
>
> --
> PHP Extension and Add-on Repository (PEAR) mailing list.
> Documentation can be found at http://pear.php.net/doc/pear.html
> To unsubscribe, e-mail: [email protected] from the
> mail address you subscribed with.