Skip to Content.
Sympa Menu

freetds - Re: Num Rows issue...

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <camber AT ais.org>
  • To: TDS Development Group <freetds AT franklin.metalab.unc.edu>
  • Subject: Re: Num Rows issue...
  • Date: Wed, 24 Jul 2002 00:20:17 -0400 (EDT)


On Tue, 23 Jul 2002, Jay Van Vark wrote:

> I guess I am still confused though...
>
> ret = tds_process_result_tokens(tds);
>
> printf( "[JVV][Here I am in _SQLExecute... - getting the end of it ][%d]\n",
> tds->rows_affected );
>
>
> In the _SQLExecute routine...
>
> And this value for tds->rows_affected is always 0...
>

You can't. I think you'll find that SQLRowCount() is only defined for
insert/update/delete functions and not selects. It is a "feature" of the
TDS protocol that the number of rows is not known until the last row is
fetched. It allows the server to immediately start returning rows instead
of processing the whole select first, like mysql for instance.

Now your SQL is cut off in the original message, so I can't see if it is a
select or an insert/update/delete, so I'm going on the assumption it is a
select. If not, we'll need to start this conversation over ;-)

Brian

> What can I do to make this correct...?
>
> On 7/23/02 6:38 PM, "Brian Bruns" <camber AT ais.org> wrote:
>
> >
> > If you look at tds_process_result_tokens() closely you'll note that when a
> > TDS_RESULT_TOKEN (TDS 5.0), TDS7_RESULT_TOKEN (7.0/8.0), or
> > TDS_COL_NAME_TOKEN (4.2) the code returns from the function at that point
> > generally to finished up later by a call to tds_process_row_tokens(). The
> > check for end tokens at this point is for non-result returning queries
> > (such as inserts/updates).
> >
> > Brian
> >
> > On Tue, 23 Jul 2002, Jay Van Vark wrote:
> >
> >> I am struggling to figure out where a problem is with FreeTDS...
> >>
> >> I have some simple code that always returns 0 for the number of rows...
> >>
> >> I have been making some simple printf statement to try to track things
> >> down...
> >>
> >> old_city2) = 'los angeles' OR Lower(old_city3) = 'los angeles' OR
> >> Lower(old_city4) = 'los angeles' OR Lower(old_city5) = 'los angeles'
> >>
> >> [JVV][Here I am in _SQLExecute... - getting the end of it ][0]
> >>
> >> -- the above is coming right AFTER the call to
> >>
> >> ret = tds_process_result_tokens(tds);
> >>
> >> in _SQLExecute
> >>
> >> I get some valid data displayed from isql...
> >>
> >> [JVV][Here I am in process_END - getting the end of it ][10]
> >>
> >> -- the above is coming from the tds_process_end function --
> >>
> >> Then the isql final for the number of rows..
> >>
> >> 10 rows affected
> >>
> >> The most interesting thing is the above is the sequence...!
> >>
> >> How can the line after the call to tds_process_result_tokens do it's
> >> printf
> >> before the one inside the tds_process_end -- which is of course called
> >> as
> >> part of the tds_process_result_tokens...
> >>
> >> Any help would be greatly appreciated....
> >>
> >>
> >>
> >> Jay Van Vark
> >> 'Guiding Positive Change in High-Tech Companies'
> >> one box voicemail (866) 248-7670 x 6471
> >> efax (801) 659-7952
> >>
> >> -- Great tool for advertising bid optimization, check out:
> >> http://www.Promote4Less.com





Archive powered by MHonArc 2.6.24.

Top of Page