Skip to content

Commit 84d8693

Browse files
committedApr 5, 2018
set limit to 20 to store database query in the history
1 parent 1242402 commit 84d8693

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎python/plugins/db_manager/dlg_sql_window.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353

5454
class DlgSqlWindow(QWidget, Ui_Dialog):
5555
nameChanged = pyqtSignal(str)
56+
QUERY_HISTORY_LIMIT = 20
5657

5758
def __init__(self, iface, db, parent=None):
5859
QWidget.__init__(self, parent)
@@ -181,6 +182,9 @@ def populateQueryHistory(self):
181182
self.queryHistoryTableWidget.resizeRowsToContents()
182183

183184
def writeQueryHistory(self, sql, affectedRows, secs):
185+
if len(self.history[self.connectionName]) >= self.QUERY_HISTORY_LIMIT:
186+
self.history[self.connectionName].pop(0)
187+
184188
settings = QgsSettings()
185189
self.history[self.connectionName].append({'query': sql,
186190
'rows': affectedRows,

0 commit comments

Comments
 (0)
Please sign in to comment.