Skip to content
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

Incorrect handling empty row for RowMapping #30

Closed
teserak opened this issue Feb 23, 2012 · 1 comment
Closed

Incorrect handling empty row for RowMapping #30

teserak opened this issue Feb 23, 2012 · 1 comment

Comments

@teserak
Copy link

teserak commented Feb 23, 2012

Problem with fetchonemap (and probably: fetchallmap, fetchmanymap)
When fetch (fetchone and probably: fetchall, fetchmany) return None, RowMapping raise Exception

Exception:

Traceback (most recent call last):
  File "firebirdsql_issue_30.py", line 28, in <module>
    for key, val in cur.fetchonemap().items():
  File "build\bdist.win32\egg\firebirdsql\fbcore.py", line 598, in fetchonemap
  File "build\bdist.win32\egg\firebirdsql\fbcore.py", line 994, in __init__
TypeError: 'NoneType' object is unsubscriptable

Example code:

import firebirdsql
assert firebirdsql.__version__ == "0.6.5"

# Firebird 2.5 64bit, Windows 7 Home Premium SP1 64 bit 
# Python 2.6, 32 bit

conn_conf = {
    'database': './issue_30.fdb',
    'user': 'sysdba',
    'password': 'masterke',
    'host': 'localhost',
    'port': 3050,
}

con = firebirdsql.create_database(**conn_conf)
con = firebirdsql.connect(**conn_conf)

# ok
cur = con.cursor()
res = cur.execute("SELECT * FROM RDB$ROLES")
for key, val in cur.fetchonemap().items():
    print key, val

# error
cur = con.cursor()
res = cur.execute("SELECT * FROM RDB$PROCEDURES")
con.commit(True)
for key, val in cur.fetchonemap().items():
    print key, val
nakagami added a commit that referenced this issue Feb 23, 2012
@nakagami
Copy link
Owner

in example code seems RDB$ROLES has some record(s).
and empty record query raise TypeError everytime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants