[CONPY-224] second executemany fails with "Commands out of sync" if using the same cursor Created: 2022-09-21  Updated: 2022-09-22  Resolved: 2022-09-22

Status: Closed
Project: MariaDB Connector/Python
Component/s: DBAPI 2.0
Affects Version/s: 1.1.4
Fix Version/s: 1.1.5

Type: Bug Priority: Major
Reporter: Diego Dupin Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

on actual 1.1 branch. if i run a second executemany, command fails with "Commands out of sync; you can't run this command now"
If this second executemany runs on another cursor, command run successfully.

example to reproduce change test "test_inserttuple" in test_cursor to run 2 x executemany:

    def test_inserttuple(self):
        if is_maxscale():
            self.skipTest("MAXSCALE doesn't support BULK yet")
        cursor = self.connection.cursor()
        cursor.execute("CREATE TEMPORARY TABLE test_inserttuple ("
                       "id int, name varchar(64), "
                       "city varchar(64))")
        params = ((1, u"Jack", u"Boston"),
                  (2, u"Martin", u"Ohio"),
                  (3, u"James", u"Washington"),
                  (4, u"Rasmus", u"Helsinki"),
                  (5, u"Andrey", u"Sofia"))
        cursor.executemany("INSERT INTO test_inserttuple VALUES (?,?,?)",
                           params)
        cursor.executemany("INSERT INTO test_inserttuple VALUES (?,?,?)",
                           params)
        cursor = self.connection.cursor()
        cursor.execute("SELECT name FROM test_inserttuple ORDER BY id DESC")
        row = cursor.fetchone()
        self.assertEqual("Andrey", row[0])
        del cursor



 Comments   
Comment by Georg Richter [ 2022-09-22 ]

commit 37ea27cf86b5e331932c5d5d6131b280015b4693

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