eskoviak / pypyodbc

Automatically exported from code.google.com/p/pypyodbc
0 stars 0 forks source link

Reuse of prepared statement does not work #18

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Write a simple script that executes SQL statement with parameter, something 
like cursor.execute("select * from tbl where x = ?", ('ABC',))
2. In the script, execute the statement twice, with different parameters.
3. After each execution, write a simple loop to go through the rows.

What is the expected output? What do you see instead?
Expected output is, getting rows from both calls. 
Instead, I am getting only results of the first call, and then exception:
pypyodbc.ProgrammingError: ('24000', '[24000] [Microsoft][SQL Server Native 
Client 10.0]Invalid cursor state')

What version of the product are you using? On what operating system?
pypyodbc 1.1.1, Python3, Windows 7

Please provide any additional information below.
Looks like something in the cursor is supposed to be closed after iteration 
through the rows. That probably should happen at the time of the second call.
Or am I missing some call that I have to make? Anything that effectively closes 
the result set, but leaves the prepared statement intact?
I tried calling _free_results(), but it did not help.
Should I try development version of the module?

Original issue reported on code.google.com by lilyev...@gmail.com on 8 Jul 2013 at 3:24

GoogleCodeExporter commented 8 years ago
This works in Linux with FreeTDS driver, so it might be the driver issue.
I am going to try FreeTDS on Windows.
Any other suggestions?

Original comment by lilyev...@gmail.com on 8 Jul 2013 at 6:56

GoogleCodeExporter commented 8 years ago
On the other hand, the pyodbc works fine on Windows, so pypyodbc needs to be 
fixed.

Original comment by lilyev...@gmail.com on 9 Jul 2013 at 12:18

GoogleCodeExporter commented 8 years ago
Thanks, it is a critical issue!!!  I have upload a new version in Github:

https://github.com/jiangwen365/pypyodbc/blob/master/pypyodbc.py

Can you download it and see if it works?

Original comment by jiangwen...@gmail.com on 10 Jul 2013 at 2:46

GoogleCodeExporter commented 8 years ago
fixed in version 1.1.5

Original comment by jiangwen...@gmail.com on 11 Jul 2013 at 12:03