Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. database is locked Unable to fetch row
Forum Updated to NodeBB v4.3 + New Features

database is locked Unable to fetch row

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tmalfrere
    wrote on 17 Jul 2020, 13:46 last edited by
    #1

    Hi,

    I have an application that dispatches jobs over network to devices on the network. Jobs are queued in a database table. My application pushes them 1 at a time to the network device. At the start of the job, the start time is written onto the job-record. At the end of the job the end time is written onto the job-record.

    I have a view (derived from QTableView) linked to a QSqlQueryModel that only shows jobs that still need to start. (The start time is empty). Normally this shows 5-10 rows.

    However, when I want to show all records in the jobs table (13000 records), I update the query (setQuery() without a 'WHERE' clause) not to filter on the starttime is NULL.
    Then I get "database is locked Unable to fetch row" on all queries executed on the database, even on other tables.
    When I restore the original query of the view (setQuery() with 'WHERE' clause) the database is locked disappears again.

    Is the QTableView query without 'WHERE' taking too long?
    Can I tell QTableView to only fetch the first x rows?
    Are there too many rows in the table? (20 years ago, I used to work on Oracle. Oracle support always said "if you don't have a million records, you don't have a database")
    Is there a way to find out what is locking the database?

    I do access the database from multiple threads, but I took measures to provide 1 connection per thread. As long as I don't remove the 'WHERE' it's work fine...

    I'm using an SQLite v3 database that I access with QSQL. QT version is v5.15 but the problem also happens in v5.12.7 LTS. The compiler is MinGW 8.1.0 64-bit on Windows10

    J 1 Reply Last reply 17 Jul 2020, 13:51
    0
    • T Tmalfrere
      17 Jul 2020, 13:46

      Hi,

      I have an application that dispatches jobs over network to devices on the network. Jobs are queued in a database table. My application pushes them 1 at a time to the network device. At the start of the job, the start time is written onto the job-record. At the end of the job the end time is written onto the job-record.

      I have a view (derived from QTableView) linked to a QSqlQueryModel that only shows jobs that still need to start. (The start time is empty). Normally this shows 5-10 rows.

      However, when I want to show all records in the jobs table (13000 records), I update the query (setQuery() without a 'WHERE' clause) not to filter on the starttime is NULL.
      Then I get "database is locked Unable to fetch row" on all queries executed on the database, even on other tables.
      When I restore the original query of the view (setQuery() with 'WHERE' clause) the database is locked disappears again.

      Is the QTableView query without 'WHERE' taking too long?
      Can I tell QTableView to only fetch the first x rows?
      Are there too many rows in the table? (20 years ago, I used to work on Oracle. Oracle support always said "if you don't have a million records, you don't have a database")
      Is there a way to find out what is locking the database?

      I do access the database from multiple threads, but I took measures to provide 1 connection per thread. As long as I don't remove the 'WHERE' it's work fine...

      I'm using an SQLite v3 database that I access with QSQL. QT version is v5.15 but the problem also happens in v5.12.7 LTS. The compiler is MinGW 8.1.0 64-bit on Windows10

      J Online
      J Online
      JonB
      wrote on 17 Jul 2020, 13:51 last edited by JonB
      #2

      @Tmalfrere said in database is locked Unable to fetch row:

      database is locked Unable to fetch row

      I don't use SQLite, but I think you should start by reading https://stackoverflow.com/questions/17057420/qt-sqlite-unable-to-fetch-row-database-locked.

      If that does not answer, there are other hits from Googling: database is locked unable to fetch row sqlite.

      1 Reply Last reply
      1

      1/2

      17 Jul 2020, 13:46

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved