Skip to Content.
Sympa Menu

freetds - RE: [freetds] SQLRowCount failing after prepare and execute

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] SQLRowCount failing after prepare and execute
  • Date: Mon, 16 Feb 2004 15:45:10 +0100

>
> Thanks Freddy - most interesting.
>
> 1st interesting thing is the packet we get back from the
> prepare. Its like we get the full results back even thogh the
> stateemnts havent been executed yet. It seems to me we should
> only be ienterested in the DONEPROC and PARAM tokens from a
> sp_prepare...
>
> 2nd interesting thing. These are the DONEINPROC tokens coming
> back from sp_execute () when the prepared statement was
>
> select * from #tmp where i = 2
> delete from #tmp
>
> ff 11 00 c1 00 00 00 00 00
> ff 11 00 c4 00 01 00 00 00
>
> We have two things that may help us with the DONEINPROC tokens
>
> 1) both have the "done_count_valid" bit set.
> 2) the short token value. I can tell you that
>
> c1 = SELECT
> c4 = DELETE
>
> also, FYI...
>
> c3 = INSERT
> c5 = UPDATE
>
> Not sure if this helps.
>
> My feeling on this is that after a statement (or batched
> multiple statements
> ) have been executed by the server,
> the API functions should behave exactly the same to the
> caller whether the statement was previously "prepared" or not.
>
> I don't know if this how the MS ODBC driver behaves, and I
> don't really care to be honest.
>
> In our example the user should be able to identify, using the
> API, that there were two separate statements in the prepared
> batch, and be able to access the rowcounts and column counts
> for each!
>
> Good Luck,
>
> Bill
>

It would be very nice... however it's impossible. A simple select can
return a bunch of DONE/DONEINPROC... simply a trigger can execute a
INSERT/UPDATE/DELETE and this statement returns DONEINPROC like your
prepared INSERT/DELETE/UPDATE... there is no way to distinguish the two
cases so it's better to ignore every DONEINPROC returned (this seemed
the way MS ODBC works...). I don't like the way MS ODBC handle this case
either however I understand the request... be able to read row count
even using prepared insert/delete/update.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page