mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 18:40:13 -06:00
Fix code to determine the total row number before a SQL dump
Before running the actual SQL dump we need to determine the total number of rows in the database in order to show a progress bar. This code didn't work as expected since the multithreading changes. On the one hand it would produce occasional error messages in the console and maybe even crash. On the other hand the resulting value would always be zero which in turn leads to the progress bar not working. Both issues are fixed by rewriting the code here. See issue #1476.
This commit is contained in:
@@ -628,9 +628,11 @@ bool DBBrowserDB::dump(const QString& filePath,
|
||||
it.remove();
|
||||
} else {
|
||||
// Otherwise get the number of records in this table
|
||||
SqliteTableModel tableModel(*this);
|
||||
tableModel.setTable(sqlb::ObjectIdentifier("main", it.value()->name()));
|
||||
numRecordsTotal += tableModel.rowCount();
|
||||
SqliteTableModel m(*this);
|
||||
m.setQuery(QString("SELECT COUNT(*) FROM %1;")
|
||||
.arg(sqlb::ObjectIdentifier("main", it.value()->name()).toString()));
|
||||
if(m.completeCache())
|
||||
numRecordsTotal += m.data(m.index(0, 0)).toUInt();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user