Skip to content

[3.10] gh-79579: Improve DML query detection in sqlite3 (GH-93623) - #93801

Merged
erlend-aasland merged 3 commits into
python:3.10from
erlend-aasland:backport-4674007-3.10
Jun 14, 2022
Merged

[3.10] gh-79579: Improve DML query detection in sqlite3 (GH-93623)#93801
erlend-aasland merged 3 commits into
python:3.10from
erlend-aasland:backport-4674007-3.10

Conversation

@erlend-aasland

Copy link
Copy Markdown
Contributor

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 4674007)

Co-authored-by: Erlend Egeberg Aasland erlend.aasland@protonmail.com

…GH-93623)
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 4674007)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@protonmail.com>
@erlend-aasland
erlend-aasland merged commit 2229d34 into python:3.10Jun 14, 2022
@erlend-aasland
erlend-aasland deleted the backport-4674007-3.10 branch June 14, 2022 13:05
erlend-aasland added a commit to erlend-aasland/cpython that referenced this pull request Jul 19, 2022
…lite3 directory
The directory was incorrectly partially backported in commit 2229d34
(See pythongh-93801)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@erlend-aasland@bedevere-bot