summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-09-20 08:56:56 -0700
committerBerker Peksag <berker.peksag@gmail.com>2018-09-20 18:56:56 +0300
commit015cd0f5cb17b1b208a92e549cd665dc38f2f699 (patch)
tree0e17e76cb5ea7f272d181700b0ada705b7ca912a
parent476177005e8c8d4ece3070c8c378f8b8c068e76f (diff)
downloadcpython-git-015cd0f5cb17b1b208a92e549cd665dc38f2f699.tar.gz
bpo-32215: Fix performance regression in sqlite3 (GH-8511)
(cherry picked from commit 8d1e190fc507a9e304f6817e761e9f628a23cbd8) Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
-rw-r--r--Misc/NEWS.d/next/Library/2018-07-28-12-08-53.bpo-32215.EU68SY.rst2
-rw-r--r--Modules/_sqlite/statement.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/Misc/NEWS.d/next/Library/2018-07-28-12-08-53.bpo-32215.EU68SY.rst b/Misc/NEWS.d/next/Library/2018-07-28-12-08-53.bpo-32215.EU68SY.rst
new file mode 100644
index 0000000000..c097cf7310
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-07-28-12-08-53.bpo-32215.EU68SY.rst
@@ -0,0 +1,2 @@
+Fix performance regression in :mod:`sqlite3` when a DML statement appeared
+in a different line than the rest of the SQL query.
diff --git a/Modules/_sqlite/statement.c b/Modules/_sqlite/statement.c
index 3869088422..78033d8efc 100644
--- a/Modules/_sqlite/statement.c
+++ b/Modules/_sqlite/statement.c
@@ -85,10 +85,10 @@ int pysqlite_statement_create(pysqlite_Statement* self, pysqlite_Connection* con
continue;
}
- self->is_dml = (PyOS_strnicmp(p, "insert ", 7) == 0)
- || (PyOS_strnicmp(p, "update ", 7) == 0)
- || (PyOS_strnicmp(p, "delete ", 7) == 0)
- || (PyOS_strnicmp(p, "replace ", 8) == 0);
+ self->is_dml = (PyOS_strnicmp(p, "insert", 6) == 0)
+ || (PyOS_strnicmp(p, "update", 6) == 0)
+ || (PyOS_strnicmp(p, "delete", 6) == 0)
+ || (PyOS_strnicmp(p, "replace", 7) == 0);
break;
}