mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-05-19 03:58:28 -05:00
Fix remaining issue with optimised SELECT statements
This fixes a remaining issue which was introduced in the series of commits made for improving the performance of running SELECT statements in the Execute SQL tab. The problem here was that rerunning a query did not show any results in the view. See issue #2165.
This commit is contained in:
+4
-6
@@ -233,11 +233,11 @@ void RowLoader::process (Task & t)
|
||||
const bool first_chunk = !cache_data.initialised();
|
||||
if(first_chunk)
|
||||
{
|
||||
size_t num_columns = static_cast<size_t>(sqlite3_column_count(stmt));
|
||||
for(size_t i=0;i<num_columns;++i)
|
||||
int num_columns = sqlite3_column_count(stmt);
|
||||
for(int i=0;i<num_columns;++i)
|
||||
{
|
||||
headers.push_back(sqlite3_column_name(stmt, static_cast<int>(i)));
|
||||
data_types.push_back(sqlite3_column_type(stmt, static_cast<int>(i)));
|
||||
headers.push_back(sqlite3_column_name(stmt, i));
|
||||
data_types.push_back(sqlite3_column_type(stmt, i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,8 +271,6 @@ void RowLoader::process (Task & t)
|
||||
// If there is no need to query the row count this means the number of rows we just got is the total row count.
|
||||
if(first_chunk)
|
||||
{
|
||||
cache_data.setInitialised();
|
||||
|
||||
if(row == t.row_end)
|
||||
triggerRowCountDetermination(t.token);
|
||||
else
|
||||
|
||||
@@ -67,17 +67,19 @@ void SqliteTableModel::handleFinishedFetch (int life_id, unsigned int fetched_ro
|
||||
|
||||
Q_ASSERT(fetched_row_end >= fetched_row_begin);
|
||||
|
||||
// Tell the query object about the column names. We also use this property to determine if the number of columns changed for some
|
||||
// reason and if so, we tell the view to update the table layout.
|
||||
if(m_query.columnNames().size() != m_headers.size())
|
||||
// Tell the query object about the column names
|
||||
m_query.setColumNames(m_headers);
|
||||
|
||||
// If the cache has been uninitialised so far we set it to initialised now and
|
||||
// tell the view to update the table layout.
|
||||
if(!m_cache.initialised())
|
||||
{
|
||||
m_cache.setInitialised();
|
||||
emit layoutChanged();
|
||||
emit columnsChanged();
|
||||
}
|
||||
m_query.setColumNames(m_headers);
|
||||
|
||||
auto old_row_count = m_currentRowCount;
|
||||
|
||||
auto new_row_count = std::max(old_row_count, fetched_row_begin);
|
||||
new_row_count = std::max(new_row_count, fetched_row_end);
|
||||
Q_ASSERT(new_row_count >= old_row_count);
|
||||
|
||||
Reference in New Issue
Block a user