Skip to content

Conversation

@berkerpeksag
Copy link
Member

@berkerpeksag berkerpeksag commented Jul 28, 2018

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to add tests.

Is the tab character recognized as a whitespace by Sqlite?

|| (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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there commands that start with "update", "delete", etc? Can a user function that starts with such prefix (for example "replacewhitespaces()") be used in this context?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can a user function that starts with such prefix (for example "replacewhitespaces()") be used in this context?

Yes, they can. The original intent of the old version was to make that check more robust and avoid cases like you've mentioned. I don't think there is a way to achieve this without relying on SQLite APIs, but then relying on newer APIs usually results seeing "I can't compile the sqlite3 module on my system" issues on the tracker :)

@berkerpeksag
Copy link
Member Author

Would be nice to add tests.

To test that the performance regression is fixed or to test that something like a user defined function (e.g. replacewhitespaces()) doesn't cause any problems?

Is the tab character recognized as a whitespace by Sqlite?

Looking at https://github.com/mackyle/sqlite/blob/master/src/tokenize.c it does.

@serhiy-storchaka
Copy link
Member

First, test that \t and \n instead of space are accepted. Is there any effect besides the performance regression?

Testing a user function starting with one of these prefixes would be nice too.

@berkerpeksag
Copy link
Member Author

I'm going to merge this without tests to get it in for 3.7.1 and open a separate pull request for tests.

@berkerpeksag berkerpeksag merged commit 8d1e190 into python:master Sep 20, 2018
@miss-islington
Copy link
Contributor

Thanks @berkerpeksag for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

@berkerpeksag berkerpeksag deleted the 32215-sqlite-performance branch September 20, 2018 11:10
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 20, 2018
(cherry picked from commit 8d1e190)

Co-authored-by: Berker Peksag <[email protected]>
@bedevere-bot
Copy link

GH-9441 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 20, 2018
(cherry picked from commit 8d1e190)

Co-authored-by: Berker Peksag <[email protected]>
@bedevere-bot
Copy link

GH-9442 is a backport of this pull request to the 3.6 branch.

@miss-islington
Copy link
Contributor

Thanks @berkerpeksag for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 20, 2018
(cherry picked from commit 8d1e190)

Co-authored-by: Berker Peksag <[email protected]>
@bedevere-bot
Copy link

GH-9449 is a backport of this pull request to the 3.7 branch.

berkerpeksag added a commit that referenced this pull request Sep 20, 2018
(cherry picked from commit 8d1e190)

Co-authored-by: Berker Peksag <[email protected]>
@miss-islington
Copy link
Contributor

Thanks @berkerpeksag for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 20, 2018
(cherry picked from commit 8d1e190)

Co-authored-by: Berker Peksag <[email protected]>
@bedevere-bot
Copy link

GH-9452 is a backport of this pull request to the 3.6 branch.

berkerpeksag added a commit that referenced this pull request Sep 20, 2018
(cherry picked from commit 8d1e190)

Co-authored-by: Berker Peksag <[email protected]>
Sign up for free to 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.

5 participants