Unsolved QT App with SQLITE Database (Query max records ~512)
-
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 -
There is no such a limitation, please show us some code.
-
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(); }
-
It's QSqlQueryModel which has an internal pagination. Search the forum for QSqlQueryModel and you will find some threads about this.