Re: DB_mssql fetchrow and mssql/freetds
| From: | chrisj at ctel dot net | Date: | Thu, 07 Dec 2000 21:10:41 +0000 |
| Subject: | Re: DB_mssql fetchrow and mssql/freetds | ||
| References: | 1 2 3 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-605@lists.php.net to get a copy of this message | ||
Sterling Hughes wrote:
>
> > Quoting chrisj@ctel.net:
> >
> > > I've been trying to use DB_mssql using PHP4.0.3pl1 and FreeTDS 0.50. What
> I've
> > > found is that DB::fetchRow returns an unknow error on end of result set and
> > > not a false like the native function (mssql_fetchrow) or a 'NULL' like
> > > DB::fetchRow for mysql. Has this been seen by others? If so, I can fix it
> and
> > > submit a patch, but I'm new to mssql w/freetds and want to see some
> > > confirmations before fixing something that isn't really broken.
> >
> > I haven't seen it (no mssql experience), but it should be consistent with the
> > other implementations, and NULL sounds like reasonable behavior to me...
> >
>
> It shouldn't return Null, that will cause loops like:
>
> while (!DB::isError($row = $sth->fetchRow()))
> {
> print $row['somecol'];
> }
>
> to go on infinitely, which is incorrect behaviour.
>
> -Sterling
I hope not, I believe NULL == false
DB::fetchRow for mysql returns NULL at the end of the result set, a DB
error on error, and an array on success.
DB::fetchRow for mssql returns an array on success or else a DB error,
no end-of-data is specified.