mirror of
https://github.com/mariadb-corporation/mariadb-connector-python.git
synced 2025-08-14 08:56:00 +00:00
Fix for CONPY-213
Additionally to the fix for CONPY-214 (which fixed the iterator), we need to check that converter will not be called with EOF (None).
This commit is contained in:
@ -353,7 +353,7 @@ class Cursor(mariadb._mariadb.cursor):
|
|||||||
if not self.field_count:
|
if not self.field_count:
|
||||||
raise mariadb.ProgrammingError("Cursor doesn't have a result set")
|
raise mariadb.ProgrammingError("Cursor doesn't have a result set")
|
||||||
row= super().fetchone()
|
row= super().fetchone()
|
||||||
if self._connection._converter:
|
if self._connection._converter and row:
|
||||||
l= list(row)
|
l= list(row)
|
||||||
if not self._description:
|
if not self._description:
|
||||||
self._description= super().description
|
self._description= super().description
|
||||||
|
@ -1333,7 +1333,18 @@ class TestCursor(unittest.TestCase):
|
|||||||
self.assertEqual(transformed, cursor._transformed_statement)
|
self.assertEqual(transformed, cursor._transformed_statement)
|
||||||
del cursor
|
del cursor
|
||||||
|
|
||||||
|
def test_conpy213(self):
|
||||||
|
conversions= { **{FIELD_TYPE.NEWDECIMAL : float}}
|
||||||
|
connection = create_connection({"converter": conversions})
|
||||||
|
cursor= connection.cursor()
|
||||||
|
cursor.execute("SELECT 1.1")
|
||||||
|
rows= cursor.fetchall()
|
||||||
|
self.assertEqual(rows[0][0], 1.1)
|
||||||
|
cursor.execute("SELECT 1.1")
|
||||||
|
row= cursor.fetchone()
|
||||||
|
self.assertEqual(row[0], 1.1)
|
||||||
|
del cursor
|
||||||
|
del connection
|
||||||
|
|
||||||
def test_conpy91(self):
|
def test_conpy91(self):
|
||||||
with create_connection() as connection:
|
with create_connection() as connection:
|
||||||
|
Reference in New Issue
Block a user