tanrj / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

nextset produces confusing results when resultsets are interleaved with other actions #142

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
[Copied from http://groups.google.com/group/pyodbc/msg/3eb36b0d94faecff]

We have a pair of selects, possibly separated
by something which is not a select. The pattern might be: SELECT
INSERT SELECT; or SELECT RAISERROR SELECT; or SELECT PRINT SELECT. An
additional complication is whether SET NOCOUNT is ON or not.

In short, a rowcount-producing INSERT/UPDATE between SELECTs produces
"No results.  Previous SQL was not a query" while a RAISERROR between
SELECTs produces "Error: ('HY000', 'The driver did not supply an
error!')"; a PRINT between SELECTs likewise gives the "No results"
message. This is against a pyodbc.pyd built from a fresh git
clone.

Example code at: http://python.pastebin.com/g4fh4z5A

Original issue reported on code.google.com by tjgolden@gmail.com on 1 Dec 2010 at 1:46

GoogleCodeExporter commented 8 years ago

Original comment by mkleehammer on 5 Dec 2010 at 11:55

GoogleCodeExporter commented 8 years ago
After Cursor_nextset calls SQLMoreResults, I think it should check for 
!SQL_SUCCEEDED(ret) before SQL_NO_DATA (as it does in execute). 

Original comment by jeremy.eric.woo on 5 Nov 2011 at 12:05