Skip to content
Permalink
Browse files

set limit to 20 to store database query in the history

  • Loading branch information
slarosa committed Apr 5, 2018
1 parent 1242402 commit 84d86935e422e6ebec173a10c8b6e5da5883730e
Showing with 4 additions and 0 deletions.
  1. +4 −0 python/plugins/db_manager/dlg_sql_window.py
@@ -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)
@@ -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,

0 comments on commit 84d8693

Please sign in to comment.
You can’t perform that action at this time.