New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
more than 2 consecutive cursor open execute and iter fail [PYFB15] #38
Comments
Modified by: @pmakowskidescription: import fdb return : => #coding:utf-8 import fdb con = fdb.connect(dsn='localhost:employee', user='sysdba', password='masterkey') cur = con.cursor() cur.execute(SELECT) the third iteration fails if you close the cursor, all is ok summary: bub in cur.itermap() => more than 2 consecutive cursor open execute and iter fail |
Commented by: @pmakowski another test case that fail: import fdb |
Commented by: @pmakowski one solution can be to do a change in class Cursor instead of : put : but the problem is then still there for PreparedStatement |
Commented by: @pmakowski Seems that the problem is in class PreparedStatement:
if fact self.__closed is sometime wrongly reported as true if you change class PreparedStatement _free_handle(self) for : (without the condition on self.__closed) do I commit it ? |
Commented by: @pmakowski fixed in rev 54113 |
Modified by: @pmakowskiassignee: Pavel Cisar [ pcisar ] => Philippe Makowski [ makowski ] status: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 0.8.0 [ 10464 ] |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: @pmakowski
Assigned to: @pmakowski
#coding:utf-8
import fdb
con = fdb.connect(dsn='localhost:employee', user='sysdba', password='masterkey')
cur = con.cursor()
SELECT = "select COUNTRY, CURRENCY from country"
cur.execute(SELECT)
for row in cur:
print('%s - %s.' % (row[0], row[1]))
print('end1')
cur.execute(SELECT)
print('start2')
for row in cur:
print('%s - %s.' % (row[0], row[1]))
print('end2')
cur.execute(SELECT)
print('start3')
for row in cur:
print('%s - %s.' % (row[0], row[1]))
print('end3')
the third iteration fails
start3
Traceback (most recent call last):
File "test_bla.py", line 22, in <module>
for row in cur:
File "/usr/lib/python2.7/site-packages/fdb-0.7.1-py2.7.egg/fdb/fbcore.py", line 1633, in next
row = self.fetchone()
File "/usr/lib/python2.7/site-packages/fdb-0.7.1-py2.7.egg/fdb/fbcore.py", line 1697, in fetchone
return self._ps._fetchone()
File "/usr/lib/python2.7/site-packages/fdb-0.7.1-py2.7.egg/fdb/fbcore.py", line 1599, in _fetchone
"Cursor.fetchone: Unknown status returned by fetch operation:")
fdb.fbcore.ProgrammingError: ('Cursor.fetchone: Unknown status returned by fetch operation:\n- SQLCODE: -502\n- The cursor identified in an OPEN statement is already open.\n- Dynamic SQL Error', -502, 335544569)
if you close the cursor, all is ok
cur.execute(SELECT)
for row in cur:
print('%s - %s.' % (row[0], row[1]))
print('end1')
cur.execute(SELECT)
print('start2')
for row in cur:
print('%s - %s.' % (row[0], row[1]))
print('end2')
cur.close() # here added a close
cur.execute(SELECT)
print('start3')
for row in cur:
print('%s - %s.' % (row[0], row[1]))
print('end3')
Commits: 324a05a
The text was updated successfully, but these errors were encountered: