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

Commit a66d0a1

Browse files
agvaldtkopets
authored andcommitted
Add command to reset table, columns and functions cache
1 parent 6a5a7eb commit a66d0a1

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
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: Refresh Connection Data",
36+
"command": "st_refresh_connection_data"
37+
},
3438
{
3539
"caption": "ST: Save Query",
3640
"command": "st_save_query"

SQLTools.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ def loadConnectionData(tablesCallback=None, columnsCallback=None, functionsCallb
321321
ST.columns = []
322322
ST.functions = []
323323
ST.completion = None
324+
callbacksRun = 0
324325

325326
if not ST.conn:
326327
return
@@ -358,7 +359,6 @@ def funcCallback(functions):
358359
if functionsCallback:
359360
functionsCallback()
360361

361-
callbacksRun = 0
362362
ST.conn.getTables(tbCallback)
363363
ST.conn.getColumns(colCallback)
364364
ST.conn.getFunctions(funcCallback)
@@ -371,9 +371,7 @@ def setConnection(index, tablesCallback=None, columnsCallback=None, functionsCal
371371
connListNames = list(ST.connectionList.keys())
372372
connListNames.sort()
373373
ST.conn = ST.connectionList.get(connListNames[index])
374-
375374
ST.loadConnectionData(tablesCallback, columnsCallback, functionsCallback)
376-
377375
Log('Connection {0} selected'.format(ST.conn))
378376

379377
@staticmethod
@@ -552,6 +550,12 @@ def cb(index):
552550
# from "function_name(int)"
553551
ST.selectFunction(cb)
554552

553+
class StRefreshConnectionData(WindowCommand):
554+
@staticmethod
555+
def run():
556+
if not ST.conn:
557+
return
558+
ST.loadConnectionData()
555559

556560
class StExplainPlan(WindowCommand):
557561
@staticmethod

0 commit comments

Comments
 (0)