Skip to content

[sqlite3] drop statement in_use field in favour of sqlite3_stmt_busy() #88239

Description

@erlend-aasland
BPO 44073
Nosy @berkerpeksag, @serhiy-storchaka, @erlend-aasland
PRs
  • gh-88239: Use sqlite3_stmt_busy() to determine if statements are in use #25984
  • 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:

    assignee = 'https://github.com/erlend-aasland'
    closed_at = None
    created_at = <Date 2021-05-08.07:47:59.789>
    labels = ['extension-modules', 'easy', 'type-feature', '3.11']
    title = '[sqlite3] drop statement in_use field in favour of sqlite3_stmt_busy()'
    updated_at = <Date 2021-08-19.20:10:44.154>
    user = 'https://github.com/erlend-aasland'

    bugs.python.org fields:

    activity = <Date 2021-08-19.20:10:44.154>
    actor = 'erlendaasland'
    assignee = 'erlendaasland'
    closed = False
    closed_date = None
    closer = None
    components = ['Extension Modules']
    creation = <Date 2021-05-08.07:47:59.789>
    creator = 'erlendaasland'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44073
    keywords = ['patch', 'easy (C)']
    message_count = 3.0
    messages = ['393241', '393243', '399932']
    nosy_count = 3.0
    nosy_names = ['berker.peksag', 'serhiy.storchaka', 'erlendaasland']
    pr_nums = ['25984']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44073'
    versions = ['Python 3.11']

    Activity

    1. erlend-aasland commented on May 8, 2021

      @erlend-aasland
      ContributorAuthor

      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"
    2. erlend-aasland commented on May 8, 2021

      @erlend-aasland
      ContributorAuthor
      $ 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(-)

    3. erlend-aasland commented on Aug 19, 2021

      @erlend-aasland
      ContributorAuthor

      See also gh-89121 (bpo-44958)

    4. transferred this issue fromon Apr 10, 2022
    5. moved this to In Progress in sqlite3 issueson May 21, 2022
    6. Repository owner moved this from In Progress to Done in sqlite3 issueson Jun 27, 2022
    7. added a commit that references this issue on Jun 27, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions