Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit 61f0751

Browse files
author
agvald
committed
Add command to reset table, columns and functions cache
1 parent 1fccdb0 commit 61f0751

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Default.sublime-commands

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
"caption": "ST: Function Description",
3232
"command": "st_desc_function"
3333
},
34+
{
35+
"caption": "ST: Remove Table and Functions cache",
36+
"command": "st_clear_cache"
37+
},
3438
{
3539
"caption": "ST: Save Query",
3640
"command": "st_save_query"

SQLTools.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,19 @@ def setConnection(index, tablesCallback=None, columnsCallback=None, functionsCal
345345
connListNames = list(ST.connectionList.keys())
346346
connListNames.sort()
347347
ST.conn = ST.connectionList.get(connListNames[index])
348+
ST.reset_cache(tablesCallback, columnsCallback, functionsCallback)
349+
350+
Log('Connection {0} selected'.format(ST.conn))
351+
352+
@staticmethod
353+
def reset_cache(tablesCallback=None, columnsCallback=None, functionsCallback=None):
348354
# clear list of identifiers in case connection is changed
349355
ST.tables = []
350356
ST.columns = []
351357
ST.functions = []
352358

353359
ST.loadConnectionData(tablesCallback, columnsCallback, functionsCallback)
354360

355-
Log('Connection {0} selected'.format(ST.conn))
356-
357361
@staticmethod
358362
def selectConnection(tablesCallback=None, columnsCallback=None, functionsCallback=None):
359363
ST.connectionList = getConnections()
@@ -540,6 +544,12 @@ def cb(index):
540544
# from "function_name(int)"
541545
ST.selectFunction(cb)
542546

547+
class StClearCache(WindowCommand):
548+
@staticmethod
549+
def run():
550+
if not ST.conn:
551+
return
552+
ST.reset_cache()
543553

544554
class StExplainPlan(WindowCommand):
545555
@staticmethod

0 commit comments

Comments
 (0)