[CONPY-27] Add support for prepared cursor Created: 2019-11-11  Updated: 2021-02-15  Resolved: 2019-11-13

Status: Closed
Project: MariaDB Connector/Python
Component/s: Generic
Affects Version/s: 0.9.1
Fix Version/s: 0.9.52

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


 Description   

Add support for prepared cursors:

cursor= connection.cursor(Prepared=True)

When executing a SQL statement via cursor.execute() the first time, the sql statement will be parsed, prepared and executed. Subsequent calls to cursor.execute()`will irgnore the statement string, since it was already prepared but executing it again using the values specified in 2nd parameter of execute().

Example:

cursor= connection.cursor(Prepared=True)
cursor.execute("INSERT INTO t1 VALUES (?,?)", (1,2))
cursor.execute("INSERT INTO t1 VALUES (?,?)", (3,4))
# this will also work, since the sql statement will be ignored
cursor.execute("", (2,3))


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