Repository navigation
bpo-9303: Migrate sqlite3 module to _v2 API to enhance performance #359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c92e604
Add optional use of sqlite3_open_v2, sqlite3_close_v2 and sqlite3_pre…
palaviv 8eccb84
Use SQLITE_VERSION_NUMBER
palaviv 5360795
Don't call sqlite3_reset in _pysqlite_seterror in using sqlite3_prepa…
palaviv 9185cb9
Revert sqlite3_open change
palaviv f7dcd02
Don't reset the statment if using sqlite3_prepare_v2
palaviv d4d9c4e
CR fixes
palaviv 64c3bb7
Add NEWS entry
palaviv 645d959
Merge remote-tracking branch 'upstream/master' into sqlite-v2-api
palaviv f1ddaba
Fix ifdef in _pysqlite_seterror
palaviv 3157f4c
Merge remote-tracking branch 'upstream/master' into sqlite-v2-api
palaviv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
Add optional use of sqlite3_open_v2, sqlite3_close_v2 and sqlite3_pre…
…pare_v2
- Loading branch information
commit c92e6047bde01bcb846ad1fcf4126d3001e30f4b
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -118,7 +118,12 @@ int pysqlite_connection_init(pysqlite_Connection* self, PyObject* args, PyObject | |
| return -1; | ||
| } | ||
| Py_BEGIN_ALLOW_THREADS | ||
| #ifdef HAVE_SQLITE3_OPEN_V2 | ||
| rc = sqlite3_open_v2(database, &self->db, | ||
| SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style nitpick: |
||
| #else | ||
| rc = sqlite3_open(database, &self->db); | ||
| #endif | ||
| #endif | ||
| Py_END_ALLOW_THREADS | ||
|
|
||
|
|
@@ -241,7 +246,7 @@ void pysqlite_connection_dealloc(pysqlite_Connection* self) | |
| /* Clean up if user has not called .close() explicitly. */ | ||
| if (self->db) { | ||
| Py_BEGIN_ALLOW_THREADS | ||
| sqlite3_close(self->db); | ||
| SQLITE3_CLOSE(self->db); | ||
| Py_END_ALLOW_THREADS | ||
| } | ||
|
|
||
|
|
@@ -334,7 +339,7 @@ PyObject* pysqlite_connection_close(pysqlite_Connection* self, PyObject* args) | |
|
|
||
| if (self->db) { | ||
| Py_BEGIN_ALLOW_THREADS | ||
| rc = sqlite3_close(self->db); | ||
| rc = SQLITE3_CLOSE(self->db); | ||
| Py_END_ALLOW_THREADS | ||
|
|
||
| if (rc != SQLITE_OK) { | ||
|
|
@@ -375,7 +380,7 @@ PyObject* _pysqlite_connection_begin(pysqlite_Connection* self) | |
| sqlite3_stmt* statement; | ||
|
|
||
| Py_BEGIN_ALLOW_THREADS | ||
| rc = sqlite3_prepare(self->db, self->begin_statement, -1, &statement, &tail); | ||
| rc = SQLITE3_PREPARE(self->db, self->begin_statement, -1, &statement, &tail); | ||
| Py_END_ALLOW_THREADS | ||
|
|
||
| if (rc != SQLITE_OK) { | ||
|
|
@@ -417,7 +422,7 @@ PyObject* pysqlite_connection_commit(pysqlite_Connection* self, PyObject* args) | |
| if (!sqlite3_get_autocommit(self->db)) { | ||
|
|
||
| Py_BEGIN_ALLOW_THREADS | ||
| rc = sqlite3_prepare(self->db, "COMMIT", -1, &statement, &tail); | ||
| rc = SQLITE3_PREPARE(self->db, "COMMIT", -1, &statement, &tail); | ||
| Py_END_ALLOW_THREADS | ||
| if (rc != SQLITE_OK) { | ||
| _pysqlite_seterror(self->db, NULL); | ||
|
|
@@ -460,7 +465,7 @@ PyObject* pysqlite_connection_rollback(pysqlite_Connection* self, PyObject* args | |
| pysqlite_do_all_statements(self, ACTION_RESET, 1); | ||
|
|
||
| Py_BEGIN_ALLOW_THREADS | ||
| rc = sqlite3_prepare(self->db, "ROLLBACK", -1, &statement, &tail); | ||
| rc = SQLITE3_PREPARE(self->db, "ROLLBACK", -1, &statement, &tail); | ||
| Py_END_ALLOW_THREADS | ||
| if (rc != SQLITE_OK) { | ||
| _pysqlite_seterror(self->db, NULL); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that there is an opportunity to simplify this whole
SQLITE_OPEN_URIandHAVE_SQLITE3_OPEN_V2dance.(The use of
Py_BEGIN_ALLOW_THREADSis a bit weird in line 111 and line 120.)