[unixODBC-dev] when to return SQL_NO_DATA from SQLExecute/SQLExecDirect

jon pounder jonp at inline.net
Tue Oct 30 23:24:49 GMT 2012

On 10/30/2012 06:07 PM, Nick Gorham wrote:
> On 30/10/12 22:01, jon pounder wrote:
>> On 10/30/2012 05:48 AM, Peter Harvey wrote:
>> I have run into that before and I think its pretty common actually.
>> No data does not necessarily mean error at all.
> Hi Jon, long time no email.
yes its been a while.
> SQL_NO_DATA should be only returned when a update or delete query uses 
> a search that returns no rows.
> ie
> delete from table where col = 10
> if there are no rows in table that have a col value 10.

That stuff kind of goes by the wayside in cases where there are say 
functions in postgres, and they may be volatile (contain 
update/insert/delete or immutable (select only)  the function is 
technically always executed as a select.

That gets further blurred where an immutable function may use a dblink 
to do an update to another database.

I know I usually just rely on <> SQL_ERROR where I care if it failed or 
not and get the actual rows affected or result rows where that matters.

More information about the unixODBC-dev mailing list