]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-32215: Fix performance regression in sqlite3 (GH-8511)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 20 Sep 2018 17:19:50 +0000 (10:19 -0700)
committerBerker Peksag <berker.peksag@gmail.com>
Thu, 20 Sep 2018 17:19:50 +0000 (20:19 +0300)
(cherry picked from commit 8d1e190fc507a9e304f6817e761e9f628a23cbd8)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
Misc/NEWS.d/next/Library/2018-07-28-12-08-53.bpo-32215.EU68SY.rst [new file with mode: 0644]
Modules/_sqlite/statement.c

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 (file)
index 0000000..c097cf7
--- /dev/null
@@ -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.
index 087375be9b63d888a7f12b46feb18ddf8a17d18d..de265963b084b9702d305c554f261894575a84ed 100644 (file)
@@ -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;
     }