Skip to content

Commit

Permalink
set limit to 20 to store database query in the history
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Apr 5, 2018
1 parent 1242402 commit 84d8693
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/plugins/db_manager/dlg_sql_window.py
Expand Up @@ -53,6 +53,7 @@

class DlgSqlWindow(QWidget, Ui_Dialog):
nameChanged = pyqtSignal(str)
QUERY_HISTORY_LIMIT = 20

def __init__(self, iface, db, parent=None):
QWidget.__init__(self, parent)
Expand Down Expand Up @@ -181,6 +182,9 @@ def populateQueryHistory(self):
self.queryHistoryTableWidget.resizeRowsToContents()

def writeQueryHistory(self, sql, affectedRows, secs):
if len(self.history[self.connectionName]) >= self.QUERY_HISTORY_LIMIT:
self.history[self.connectionName].pop(0)

settings = QgsSettings()
self.history[self.connectionName].append({'query': sql,
'rows': affectedRows,
Expand Down

0 comments on commit 84d8693

Please sign in to comment.