Skip to Content.
Sympa Menu

freetds - Re: [freetds] SQL_NO_DATA or SQL_SUCCESS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Peter Deacon <peterd AT iea-software.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] SQL_NO_DATA or SQL_SUCCESS
  • Date: Wed, 27 Feb 2008 09:11:42 -0800 (Pacific Standard Time)

On Wed, 27 Feb 2008, James K. Lowden wrote:

Mmmm... as said if nobody complains I would commit... so I complain :)

Yes, it seems that DELETE/UPDATE with no rows produce SQL_NO_DATA!!
However I must say that as documented only DELETE/UPDATE with no rows
should return SQL_NO_DATA. The situaction is complicated by the fact
that only mssql (no Sybase) return proper informations to detect
UPDATE/DELETE execution!

http://msdn2.microsoft.com/en-us/library/ms715424(VS.85).aspx
I'm sure you've read the above confusing page more than once. It says
that whether SQLExecute returns SQL_NO_DATA or SQL_SUCCESS depends on:

1. Whether the *application* is 2.x or 3.x.
2. Whether the "searched update or delete" was part of a batch.
3. Whether any rows were affected.

According to the documentation, then, SQLExecute returns SQL_NO_DATA only
if

1. a "searched update or delete" is not part of a batch -- or, I presume,
a stored procedure -- and
2. is issued by a 3.x application, and
3. affected zero rows.

FWIW I didn't realize version mattered. I was able to reproduce the SQL_NO_DATA by capturing a trace from isqlw/sql2000.

isqlw 1298-674 EXIT SQLExecDirectW with return code 100 (SQL_NO_DATA_FOUND)
HSTMT 014F1C00
WCHAR * 0x0016C0B8 [ -3] "UPDATE Configs SET ConfigID = 4343 WHERE ConfigID = 43240324\ d\ a\ 0"
SDWORD -3

(I do not know what a "searched update" is. I guess it means one with a
WHERE clause. If I issue "UPDATE tablename SET columname = 0" on a table
with zero rows, it affects zero rows. What should the driver return
then?)

Yea, searched updates are exactly that.

take care,
Peter




Archive powered by MHonArc 2.6.24.

Top of Page