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
sqlite3: remove sqlite3_stmt_readonly() #73541
Comments
In CPython 3.6.0, sqlite3 module uses sqlite3_stmt_readonly(), however this function is only available on SQLite 3.7.4+ (release on 2010-12-07). sqlite3_stmt_readonly() was introduced in 284676cf2ac8, it was used twice [1][2], but it seems that we can avoid using this function in both of them. [1] https://hg.python.org/cpython/file/3.6/Modules/_sqlite/cursor.c#l517 [2] https://hg.python.org/cpython/file/3.6/Modules/_sqlite/cursor.c#l612 This issue depends on bpo-28518. |
Another report of sqlite3 not compiling correctly on RHEL6 (jupyterhub/jupyterhub#991). Is there currently a solution to build Python 3.6 with sqlite3 support? |
I installed SQLite 3.16.2 on a Debian-based system with this way: |
Thanks for the report, Ma.
What do you mean by the old way? The use of switch statement? |
The "old way" is not using sqlite3_stmt_readonly(). Before 3.6.0, we only count rowcount for INSERT, UPDATE, DELETE, REPLACE: These four statements can be representd by is_dml in PR 245: So only change this line is ok, then restore the behavior before 3.6.0 exactly: - if (!sqlite3_stmt_readonly(self->statement->st)) {
+ if (self->statement->is_dml) {
self->rowcount += (long)sqlite3_changes(self->connection->db);
} else {
self->rowcount= -1L;
} Why it's better? In addition, we can add a comment for code safe in statement.c. |
Ah, yes now I understand what do you mean! :) I agree and this is already in my local branch to fix bpo-28518. |
The patch for bpo-28518 has been merged and it doesn't contain any use of sqlite3_stmt_readonly(). Closing this as 'out of date'. Thanks again Ma! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: