Fixed bug 688290 "NULL values with converters error on fetch."

master
baztian 2010-12-12 20:35:07 +01:00
parent 32c64c47c7
commit 83fede1f8d
4 changed files with 12 additions and 10 deletions

View File

@ -266,9 +266,10 @@ class Cursor(object):
for col in range(1, self._meta.getColumnCount() + 1):
sqltype = self._meta.getColumnType(col)
v = self._rs.getObject(col)
converter = _converters.get(sqltype)
if converter:
v = converter(v)
if v:
converter = _converters.get(sqltype)
if converter:
v = converter(v)
row.append(v)
return tuple(row)

View File

@ -2,6 +2,7 @@ create table konto (
"KONTO_ID" TIMESTAMP default CURRENT_TIMESTAMP not null,
"KONTO_NR" INTEGER not null,
"SALDO" DECIMAL default 0.0 not null,
"SPERRE" DECIMAL,
primary key ("KONTO_ID")
);

View File

@ -1,2 +1,2 @@
insert into Konto values ('2009-09-10 14:15:22.123456', 18, 12.4);
insert into Konto values ('2009-09-11 14:15:22.123456', 19, 12.9);
insert into Konto values ('2009-09-10 14:15:22.123456', 18, 12.4, null);
insert into Konto values ('2009-09-11 14:15:22.123456', 19, 12.9, 1);

View File

@ -93,20 +93,20 @@ class IntegrationTest(TestCase):
cursor = self.conn.cursor()
cursor.execute("select * from konto")
result = cursor.fetchall()
assert [(u'2009-09-10 14:15:22.123456', 18, 12.4),
(u'2009-09-11 14:15:22.123456', 19, 12.9)] == result
assert [(u'2009-09-10 14:15:22.123456', 18, 12.4, None),
(u'2009-09-11 14:15:22.123456', 19, 12.9, 1)] == result
def test_execute_and_fetch_parameter(self):
cursor = self.conn.cursor()
cursor.execute("select * from konto where konto_nr = ?", 18)
result = cursor.fetchall()
assert [(u'2009-09-10 14:15:22.123456', 18, 12.4)] == result
assert [(u'2009-09-10 14:15:22.123456', 18, 12.4, None)] == result
def test_execute_and_fetchone(self):
cursor = self.conn.cursor()
cursor.execute("select * from konto order by konto_nr")
result = cursor.fetchone()
assert (u'2009-09-10 14:15:22.123456', 18, 12.4) == result
assert (u'2009-09-10 14:15:22.123456', 18, 12.4, None) == result
def test_execute_reset_description_without_execute_result(self):
"""Excpect the descriptions property being reset when no query
@ -130,7 +130,7 @@ class IntegrationTest(TestCase):
cursor = self.conn.cursor()
cursor.execute("select * from konto order by konto_nr")
result = cursor.fetchmany()
assert [(u'2009-09-10 14:15:22.123456', 18, 12.4)] == result
assert [(u'2009-09-10 14:15:22.123456', 18, 12.4, None)] == result
def test_executemany(self):
cursor = self.conn.cursor()