Skip to Content.
Sympa Menu

freetds - Re: [freetds] PHP und Freetds

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] PHP und Freetds
  • Date: Sat, 22 Mar 2008 10:08:35 -0400

Thomas, Christopher (LLU) wrote:
>
> I have had trouble with the odbc_num_rows() function. It seems to always
> return -1 if you call it just after odbc_exec(). For me, it always
> returned the right value after I looped through all the results.(useless
> at that point)

http://www.freetds.org/faq.html#pending

The driver cannot tell you something the server itself doesn't know. The
server sends the rows as they are produced, and can't (and therefore
doesn't) send the rowcount until the last row is sent.

Equally, the driver cannot tell you the rowcount before it fetches the
last row. To produce the rowcount prior to the application fetching the
last row, it would have to cache the rows in advance.

If you think it through, you'll see that *every* server -- any RDBMS, not
just TDS servers -- face the same problem: you can't know the answer
before you calculate it. You have to construct the rows before you know
how many there are. Any system that provides the rowcount in advance of
the rows themselves is caching the rows, and any client of such a system
always pays the price of that overhead, regardless of its value to the
application.

--jkl





Archive powered by MHonArc 2.6.24.

Top of Page