Re: [PHP-PEAR] The PEAR $db->fetchRow Blues (ref: DB_mysql...
[email protected] (Chuck Hagenbuch)
| Newsgroups | php.pear |
|---|---|
| Message-ID | <[email protected]> |
Quoting Robert Kelly <[email protected]>: > 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 ) Yes, I changed things. In my defense, none of this was consistent between the various db backends in the first place. Anyway. One of my other changes was to make DB::isError() return true (ie, yes, this is an error) when it is passed null. This lets you use the second loop and have it terminate _both_ when an error occurs and when you reach the end of your results. Otherwise, either of the above checks is prone to an infinite loop. So: we want to standardize that fetchRow() should always return null when the end of the result set is reached, that's fine - as long as the DB::isError() change stays - and I will make this change for all backends. I just think it should be consistent. And if there are examples out there, we'll just have to correct them or put up more authoritative, accurate ones. -chuck -- Charles Hagenbuch, <[email protected]> "My intuitive grasp of math often leads me astray." -Me