turbodbc
turbodbc copied to clipboard
cursor.nextset() does not exist in turbodbc
Hi,
Ubuntu 16.04 Python 3.6.4 Driver: FreeTDS turbODBC 2.5.0 SQL Server Database
I have a proc in db where I can receive multiple result sets per execute. While I was using pyodbc, I was able to read all result sets by calling cursor.nextset(), but when I switch to turbodbc, I could not find any similar function therefore it throws me the following error
'Cursor' object has no attribute 'nextset'
Thanks
Hi! Yes, the optional nextset()
method from PEP-249 is not implemented yet. I'll put it on the list.
Thank you so much.
This isn't a common requirement as I think most people/organizations use queries or stored procs which just return a single result set, but we've got a few different procedures which produce multiple result sets.
Would nextset()
be straightforward to implement in Turbodbc for MS SQL Server?
The equivalent code in pyodbc
is at L1760 of cursor.cpp, and essentially just calls SQL Server's SQLMoreResults() function.
It looks like the back-end C++ machinery is already done. We only need to expose the C++ function call to Python.
More specifically:
-
statement.cpp
already hasmore_results()
callingraii_statement::do_more_results()
. - On the Python side, in
cursor.py
, need to define aCursor.nextset()
method, callingCursor.impl.more_results()
. - In
cpp/turbodbc_python/Library/src/python_bindings/cursor.cpp
, need to add a line like:
.def("more_results", &turbodbc::cursor::more_results())
Can anyone try this quickly? I am on Windows and am having trouble compiling this...
Has this functionality been added? I need to run this as well.
This should be closed out due to #369