turbodbc icon indicating copy to clipboard operation
turbodbc copied to clipboard

cursor.nextset() does not exist in turbodbc

Open jackalhan opened this issue 7 years ago • 6 comments

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

jackalhan avatar Jan 27 '18 23:01 jackalhan

Hi! Yes, the optional nextset() method from PEP-249 is not implemented yet. I'll put it on the list.

MathMagique avatar Jan 29 '18 07:01 MathMagique

Thank you so much.

jackalhan avatar Jan 31 '18 16:01 jackalhan

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.

airdrik avatar Sep 14 '18 15:09 airdrik

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.

stevesimmons avatar Dec 08 '19 11:12 stevesimmons

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 has more_results() calling raii_statement::do_more_results().
  • On the Python side, in cursor.py, need to define a Cursor.nextset() method, calling Cursor.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...

stevesimmons avatar Dec 08 '19 13:12 stevesimmons

Has this functionality been added? I need to run this as well.

adavis-vvp avatar Mar 16 '22 22:03 adavis-vvp

This should be closed out due to #369

david-engelmann avatar Dec 18 '22 16:12 david-engelmann