Don't show misleading "determining row count" message in empty db

When no table is selected in the Browse Data tab, either because the
current database is empty or because no database is opened, we would
forever show the "determining row count" message even though nothing is
to be determined at this point. This commit makes sure to show a better
"0 - 0 of 0" message as we did before.

See issue #1654.
This commit is contained in:
Martin Kleusberg
2018-12-09 12:43:50 +01:00
parent 6944874f85
commit 7e549c7c4c
2 changed files with 9 additions and 1 deletions

View File

@@ -1028,9 +1028,16 @@ void MainWindow::setRecordsetLabel()
// Update the validator of the goto row field
gotoValidator->setRange(0, total);
// When there is no query for this table (i.e. no table is selected), there is no row count query either which in turn means
// that the row count query will never finish. And because of this the row count will be forever unknown. To avoid always showing
// a misleading "determining row count" text in the UI we set the row count status to complete here for empty queries.
auto row_count_available = m_browseTableModel->rowCountAvailable();
if(m_browseTableModel->query().isEmpty())
row_count_available = SqliteTableModel::RowCount::Complete;
// Update the label showing the current position
QString txt;
switch(m_browseTableModel->rowCountAvailable())
switch(row_count_available)
{
case SqliteTableModel::RowCount::Unknown:
txt = tr("determining row count...");

View File

@@ -100,6 +100,7 @@ void SqliteTableModel::reset()
beginResetModel();
clearCache();
m_sQuery.clear();
m_query.clear();
m_headers.clear();
m_vDataTypes.clear();