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 13:39:58 +0100

>
> Freddy,
>
> An interesting problem then.
>
> Do we make our ODBC implementation behave like another
> (clearly buggy) implementation for the sake of
> "compatibility" ? or do we do the job properly ?
>
> Bill
>

You are right!
However the problem here is that with MS ODBC you are able to read rows
from a prepared delete/update/insert while using FreeTDS no... MS
solution is quite wrong, I must admit but works... This is a sligtly
difference but some workaround should be taken... Perhaps the best
solution (for compatibility and others) is:
- ignore DONEINPROC token if we have no rows (as we do now) but cache
row count
- if we get last DONE/DONEPROC and we have a cached row count return
another (empty recordset)

So

create table #tmp (i int)
insert into #tmp values(1)

Issuing this query (using SQLPrepare)

select * from #tmp where i=2 delete from #tmp

will return two recordset
- 1 column with 0 rows (select)
- 0 columns with 1 row (delete)

However this query

delete from #tmp select * from #tmp where i=2

will return just a recordset
- 1 column with 0 rows (select)

This cause we are unable to know if the first DONEINPROC came from a
trigger or whatever... Does this solution seems reasonable?

Freddy77




Archive powered by MHonArc 2.6.24.

Top of Page