Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-135644

SQLite DETACH inside transaction Error: Unable to fetch row database is locked

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 6.8.2
    • SQL Support, sqlite
    • None
    • OS Name: Microsoft Windows 11 Pro
      OS Version: 10.0.26100 N/A Build 26100
    • Windows

      When working with SQLite, it is possible to attach (ATTACH command) another database within the current connection to transfer data between databases. After using this attachment, you need to detach (DETACH command). So, when executing this DETACH command within QSqlDatabase::transaction(), I get an error in QSqlQuery:

      QSqlError("1", "Unable to fetch row", "database other is locked")

      If you execute the DETACH command outside the pair of calls to QSqlDatabase::transaction() and QSqlDatabase::commit(), then there is no error.
      Is this normal behavior? If so, should I also move the execution of the ATTACH command outside the pair of calls to QSqlDatabase::transaction() and QSqlDatabase::commit()?

      I am attaching a simple project to reproduce this behavior.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            chehrlic Christian Ehrlicher
            rumgot rumgot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes