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

jon pounder jonp at inline.net
Tue Oct 30 23:32:05 GMT 2012

On 10/30/2012 07:24 PM, jon pounder wrote:
> 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.

Keep in mind - writing robust code and following standards to the letter 
aren't always the same thing. Just because one driver does it one way is 
no guarantee every driver will act the same way, or relying the dm to 
hide driver behaviour is not always good either since someone could load 
the driver directly and wouldn't expect the upper level code to change 

> _______________________________________________
> unixODBC-dev mailing list
> unixODBC-dev at mailman.unixodbc.org
> http://mailman.unixodbc.org/mailman/listinfo/unixodbc-dev

More information about the unixODBC-dev mailing list