Avoid sorting twice in Browse Data tab

When browsing a table and changing the sort order, then switching to
another table, and then switching back, we would sort the table twice:
once using the default sort order and then again using the previously
used sort order. This results in four instead of two queries for those
tables (including the COUNT queries). This commit fixes this so that
only two queries are executed which should cut the run time for these
cases in half.

See issue #1007.
This commit is contained in:
Martin Kleusberg
2017-05-04 19:54:03 +02:00
parent a436901d12
commit 9a171e0621
3 changed files with 18 additions and 7 deletions

View File

@@ -38,7 +38,7 @@ public:
void setQuery(const QString& sQuery, bool dontClearHeaders = false);
QString query() const { return m_sQuery; }
void setTable(const QString& table, const QVector<QString> &display_format = QVector<QString>());
void setTable(const QString& table, int sortColumn = 0, Qt::SortOrder sortOrder = Qt::AscendingOrder, const QVector<QString> &display_format = QVector<QString>());
void setChunkSize(size_t chunksize);
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);