Menu

#17 Error with fetchmany() executed on exhausted record set

open
nobody
None
5
2009-02-20
2009-02-20
No

When fetchmany() is executed on an exhausted record set, the following error occurs:

TypeError: 'NoneType' object is not iterable

Here is a test case:

conn = DB2.conn(...)
cur = conn.cursor()
cur.execute("create table test (C1 BIGINT)")
cur.execute("insert into test values (1)")
cur.execute("select * from test")
cur.fetchmany()
cur.fetchmany()

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\python25\lib\site-packages\DB2.py", line 216, in fetchmany
return self._convert_result_rows(rlist)
File "c:\python25\lib\site-packages\DB2.py", line 193, in _convert_result_rows

for r in rows:
TypeError: 'NoneType' object is not iterable

Should be simply a matter of checking if rows is None in _convert_result_rows().

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.