Skip to Content.
Sympa Menu

freetds - Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in 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] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS)
  • Date: Mon, 28 Jul 2008 10:11:44 -0400

Navdeep Shergill wrote:
> Currently everytime I call dbnextrow(); the results of the row are
> loaded into memory so that I can retrieve them. I am looking for a
> functionality that will allow me to do a 'skip row'. Basically advance
> the row counter by 1 without actually loading the data in memory.

There would be no advantage to such a function.

db-lib fetches the rows from the server serially. The time needed to copy
bound buffers is nil compared to the time to create the row on the server
and to transmit it over the wire. If you don't believe me, try fetching
1,000,000 rows with and without calling dbbind().

Of the creation and transmission steps, creation is by far the more
expensive. That is why you're getting advice not to create the row in the
first place by redoing your SQL.

To avoid transmission of rows already created, the client would have to
tell the server which rows to send. There is no provision for that
operation in the TDS protocol. (That tells us something, doesn't it?)

I would argue that what you want isn't efficiency but convenience.
Convenience you can have: just write your function. You can do so with a
clear conscience knowing there's no efficiency gain to be had.

HTH.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page