[CONPY-123] cursor.close() doesn't clear pending result sets Created: 2020-10-12  Updated: 2020-10-12  Resolved: 2020-10-12

Status: Closed
Project: MariaDB Connector/Python
Component/s: DBAPI 2.0
Affects Version/s: 1.0.3
Fix Version/s: 1.0.4

Type: Task Priority: Major
Reporter: Georg Richter Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

When there arr pending result sets, cursor.close() needs to clear them to prevent out of sync errors when executing another cursor.

import mariadb
from mariadb.constants import CLIENT
 
c= mariadb.connect(client_flag=CLIENT.MULTI_STATEMENTS)
 
cursor1= c.cursor()
cursor1.execute("SELECT 1; SELECT 2; SELECT 3")
cursor1.close
cursor2= c.cursor()
cursor2.execute("SELECT 1")
cursor2.fetchall()

results in following error:
mariadb.InterfaceError: Commands out of sync; you can't run this command now



 Comments   
Comment by Georg Richter [ 2020-10-12 ]

Fixed rev. 020017ee33876940bd4961ac963cb1023ae4ed74

Generated at Thu Feb 08 03:30:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.