[freetds] SQL_NO_DATA or SQL_SUCCESS

James K. Lowden jklowden at freetds.org
Wed Feb 27 19:35:42 EST 2008


Peter Deacon wrote:
> > (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.

Hi Peter,

What should I expect if the following are executed as two batches?  

	CREATE TABLE B (b int)
then
	DELETE FROM B

It's not "searched", but it affects no rows.  SQL_SUCCESS or SQL_NO_DATA? 


It's very hard for me to believe there's any *point* in distinguishing
cases like this.  It smells like documentation to cover a bug, not a
design choice.  

If you want to know if there's a resultset, examine at the column count. 
If you want to know if rows were affected, examine the rowcount.  The
purpose of SQL_NO_DATA is (obviously, if you ask me) to let you know
something else: when you've read the last row.  

--jkl



More information about the FreeTDS mailing list