Skip to content

Commit

Permalink
Fix for CONPY-213
Browse files Browse the repository at this point in the history
Additionally to the fix for CONPY-214 (which fixed the iterator), we
need to check that converter will not be called with EOF (None).
  • Loading branch information
9EOR9 committed Jul 7, 2022
1 parent 687ba16 commit c30b597
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mariadb/cursors.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def _fetch_row(self):
if not self.field_count:
raise mariadb.ProgrammingError("Cursor doesn't have a result set")
row= super().fetchone()
if self._connection._converter:
if self._connection._converter and row:
l= list(row)
if not self._description:
self._description= super().description
Expand Down
13 changes: 12 additions & 1 deletion testing/test/integration/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,18 @@ def test_conpy209(self):
self.assertEqual(transformed, cursor._transformed_statement)
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):
with create_connection() as connection:
Expand Down

0 comments on commit c30b597

Please sign in to comment.