[CONPY-164] execute() with INSERT statement fails after executemany() Created: 2021-09-07  Updated: 2021-09-07  Resolved: 2021-09-07

Status: Closed
Project: MariaDB Connector/Python
Component/s: DBAPI 2.0
Affects Version/s: 1.1.0a1
Fix Version/s: 1.1.0b1

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

Python Version: 3.9

 Description   

Since execute() and executemany() use the same callback for retrieving data, array_size needs to be cleared.

Example:

import mariadb

connection= mariadb.connect(db="test")
 
cursor= connection.cursor()
 
cursor.execute("create temporary table t1 (a int, b int)")
 
cursor.executemany("insert into t1 values (?,?)", [(1,2),(3,4)])
 
cursor.execute("insert into t1 values (?,?)", (4,5))

raises exception:
mariadb.DataError: Can't access column number 1 at row 1


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