This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [sqlite3] drop statement in_use field in favour of sqlite3_stmt_busy()
Type: enhancement Stage: patch review
Components: Extension Modules Versions: Python 3.11
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: erlendaasland Nosy List: berker.peksag, erlendaasland, serhiy.storchaka
Priority: normal Keywords: easy (C), patch

Created on 2021-05-08 07:47 by erlendaasland, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 25984 open erlendaasland, 2021-05-08 08:09
Messages (3)
msg393241 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-05-08 07:47
sqlite3_stmt_busy() has been around since SQLite 3.7.10. I suggest to drop the in_use field of pysqlite_Statement in favour of sqlite3_stmt_busy(); we do not need to duplicate functionality already present in SQLite.

There was a bugfix for sqlite3_stmt_busy() in SQLite 3.8.6 regarding rollback statements, but we normally reset all our statements after use, so it should not be a problem. There are some corner cases in _pysqlite_query_execute() where a sqlite3_stmt may not be reset upon return, but that's easily fixable (and it would be a nice side-effect).

Pro's:
- statement objects have one less member
- no duplication of SQLite functionality
- cleaner exit paths from _pysqlite_query_execute()
- less lines of code, easier to maintain

Con's:
- the current code works / "code churn"
msg393243 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-05-08 07:56
$ git diff --stat
 Modules/_sqlite/connection.c |  1 -
 Modules/_sqlite/cursor.c     |  5 +----
 Modules/_sqlite/statement.c  | 14 +-------------
 Modules/_sqlite/statement.h  |  2 --
 4 files changed, 2 insertions(+), 20 deletions(-)
msg399932 - (view) Author: Erlend E. Aasland (erlendaasland) * (Python triager) Date: 2021-08-19 20:10
See also bpo-44958
History
Date User Action Args
2022-04-11 14:59:45adminsetgithub: 88239
2021-08-19 20:10:44erlendaaslandsetmessages: + msg399932
2021-05-08 08:09:44erlendaaslandsetkeywords: + patch
stage: patch review
pull_requests: + pull_request24636
2021-05-08 07:56:38erlendaaslandsetmessages: + msg393243
2021-05-08 07:47:59erlendaaslandcreate