Uploaded image for project: 'MariaDB Connector/Python'
  1. MariaDB Connector/Python
  2. CONPY-123

cursor.close() doesn't clear pending result sets

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.3
    • Fix Version/s: 1.0.4
    • Component/s: DBAPI 2.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

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            georg Georg Richter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration