Re: PHP und Freetds
"James K. Lowden" <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
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