nakagami/pyfirebirdsql — Issue #30: Incorrect handling empty row for RowMapping
Author: teserak
Created: 2012-02-23 08:45:28+00:00
State: open

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

Exception:

```python
Traceback (most recent call last):
File "firebirdsql_issue_30.py", line 28, in
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:

```python
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
```