summaryrefslogtreecommitdiffstats
path: root/Modules/_sqlite/connection.c
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-06-02 12:26:06 (GMT)
committerGitHub <noreply@github.com>2021-06-02 12:26:06 (GMT)
commita384b6c04054a2c5050a99059836175cf73e2016 (patch)
treee55ca9e7067504c22ae77a5ba6df21e4312cd5b3 /Modules/_sqlite/connection.c
parentee7637596d8de25f54261bbeabc602d31e74f482 (diff)
downloadcpython-a384b6c04054a2c5050a99059836175cf73e2016.zip
cpython-a384b6c04054a2c5050a99059836175cf73e2016.tar.gz
cpython-a384b6c04054a2c5050a99059836175cf73e2016.tar.bz2
bpo-44165: Optimise sqlite3 statement preparation by passing string size (GH-26206)
Diffstat (limited to 'Modules/_sqlite/connection.c')
-rw-r--r--Modules/_sqlite/connection.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_sqlite/connection.c b/Modules/_sqlite/connection.c
index 7252cca..e15629c 100644
--- a/Modules/_sqlite/connection.c
+++ b/Modules/_sqlite/connection.c
@@ -451,7 +451,7 @@ pysqlite_connection_commit_impl(pysqlite_Connection *self)
if (!sqlite3_get_autocommit(self->db)) {
Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_prepare_v2(self->db, "COMMIT", -1, &statement, NULL);
+ rc = sqlite3_prepare_v2(self->db, "COMMIT", 7, &statement, NULL);
Py_END_ALLOW_THREADS
if (rc != SQLITE_OK) {
_pysqlite_seterror(self->db);
@@ -501,7 +501,7 @@ pysqlite_connection_rollback_impl(pysqlite_Connection *self)
pysqlite_do_all_statements(self, ACTION_RESET, 1);
Py_BEGIN_ALLOW_THREADS
- rc = sqlite3_prepare_v2(self->db, "ROLLBACK", -1, &statement, NULL);
+ rc = sqlite3_prepare_v2(self->db, "ROLLBACK", 9, &statement, NULL);
Py_END_ALLOW_THREADS
if (rc != SQLITE_OK) {
_pysqlite_seterror(self->db);