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. QT App with SQLITE Database (Query max records ~512)
Forum Updated to NodeBB v4.3 + New Features

QT App with SQLITE Database (Query max records ~512)

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 321 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.
  • R Offline
    R Offline
    Rich Bair
    wrote on last edited by
    #1

    Is there a limit regarding a query that can be executed using the SQLITE driver? My query seems to stop at 511 rows (512 records I think) but not sure why as the query will return much higher results in the SQLITE database browser.

    Are there settings to overcome this?

    Thanks,
    -Rich

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      There is no such a limitation, please show us some code.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • R Offline
        R Offline
        Rich Bair
        wrote on last edited by
        #3

        Here's some example output:

        • Cleared expanded vector...cnt: 511
        • "SELECT CreatedDateTime, UserName, EventName, EventDetail FROM AuditLog ORDER BY CreatedDateTime DESC LIMIT 1500"
        • Running this same query in a DB browser returns more records.
        • Same database

        Also, the 5000 timeout was added because canFetchMore() was hanging.

        void SqlQueryModel::setQueryStr(const QString &qry){
            if(queryStr() == qry) {
                return;
            }
        
            setQuery(qry);
        
            int lastRowCnt = -1;
            int timeOut = 0;
            while (canFetchMore() && (timeOut < 5000)) {
                fetchMore();
        
                if (rowCount() == lastRowCnt) {
                    ++timeOut;
                }
                else {
                    timeOut = 0;
                    lastRowCnt = rowCount();
                }
            }
        
            Expanded.clear();
            int i;
            for(i=0; i < this->rowCount(); ++i) {
                Expanded.insert(i, false);
            }
            qDebug() << "Cleared expanded vector...cnt: " << i;
            qDebug() << queryStr();
        
            emit queryStrChanged();
        }
        
        1 Reply Last reply
        0
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It's QSqlQueryModel which has an internal pagination. Search the forum for QSqlQueryModel and you will find some threads about this.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          3

          • Login

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