]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.10] gh-79579: Improve DML query detection in sqlite3 (GH-93623) (#93801)
authorErlend Egeberg Aasland <erlend.aasland@innova.no>
Tue, 14 Jun 2022 13:05:36 +0000 (15:05 +0200)
committerGitHub <noreply@github.com>
Tue, 14 Jun 2022 13:05:36 +0000 (15:05 +0200)
commit2229d34a6ef9c03e476882f46bba4d7c83552d1e
treea699290af00f9bedf002fc4af83fbf152eb10193
parentf9585e2adc36fb2886f96ef86a5aa14215fc1151
[3.10] gh-79579: Improve DML query detection in sqlite3 (GH-93623) (#93801)

The fix involves using pysqlite_check_remaining_sql(), not only to check
for multiple statements, but now also to strip leading comments and
whitespace from SQL statements, so we can improve DML query detection.

pysqlite_check_remaining_sql() is renamed lstrip_sql(), to more
accurately reflect its function, and hardened to handle more SQL comment
corner cases.

(cherry picked from commit 46740073ef32bf83964c39609c7a7a4772c51ce3)
Lib/test/test_sqlite3/test_dbapi.py [new file with mode: 0644]
Misc/NEWS.d/next/Library/2022-06-06-12-58-27.gh-issue-79579.e8rB-M.rst [new file with mode: 0644]
Modules/_sqlite/statement.c