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

Commit da70aaf

Browse files
authored
Merge pull request #121 from mtxr/feature/execute-all-file
Add Execute All File command
2 parents 73c3fa4 + 39cc193 commit da70aaf

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

Default (Linux).sublime-keymap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[
22
{ "keys": ["ctrl+alt+e"], "command": "st_select_connection" },
33
{ "keys": ["ctrl+e", "ctrl+e"], "command": "st_execute" },
4+
{ "keys": ["ctrl+e", "ctrl+a"], "command": "st_execute_all" },
45
{ "keys": ["ctrl+e", "ctrl+x"], "command": "st_explain_plan" },
56
{ "keys": ["ctrl+e", "ctrl+h"], "command": "st_history" },
67
{ "keys": ["ctrl+e", "ctrl+s"], "command": "st_show_records" },
@@ -9,6 +10,6 @@
910
{ "keys": ["ctrl+e", "ctrl+b"], "command": "st_format" },
1011
{ "keys": ["ctrl+e", "ctrl+q"], "command": "st_save_query" },
1112
{ "keys": ["ctrl+e", "ctrl+r"], "command": "st_remove_saved_query" },
12-
{ "keys": ["ctrl+e", "ctrl+a"], "command": "st_list_queries"},
13+
{ "keys": ["ctrl+e", "ctrl+l"], "command": "st_list_queries"},
1314
{ "keys": ["ctrl+e", "ctrl+o"], "command": "st_list_queries", "args": {"mode" : "open"}}
1415
]

Default (OSX).sublime-keymap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[
22
{ "keys": ["ctrl+super+e"], "command": "st_select_connection" },
33
{ "keys": ["ctrl+e", "ctrl+e"], "command": "st_execute" },
4+
{ "keys": ["ctrl+e", "ctrl+a"], "command": "st_execute_all" },
45
{ "keys": ["ctrl+e", "ctrl+x"], "command": "st_explain_plan" },
56
{ "keys": ["ctrl+e", "ctrl+h"], "command": "st_history" },
67
{ "keys": ["ctrl+e", "ctrl+s"], "command": "st_show_records" },
@@ -9,6 +10,6 @@
910
{ "keys": ["ctrl+e", "ctrl+b"], "command": "st_format" },
1011
{ "keys": ["ctrl+e", "ctrl+q"], "command": "st_save_query" },
1112
{ "keys": ["ctrl+e", "ctrl+r"], "command": "st_remove_saved_query" },
12-
{ "keys": ["ctrl+e", "ctrl+a"], "command": "st_list_queries"},
13+
{ "keys": ["ctrl+e", "ctrl+l"], "command": "st_list_queries"},
1314
{ "keys": ["ctrl+e", "ctrl+o"], "command": "st_list_queries", "args": {"mode" : "open"}}
1415
]

Default (Windows).sublime-keymap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[
22
{ "keys": ["ctrl+alt+e"], "command": "st_select_connection" },
33
{ "keys": ["ctrl+e", "ctrl+e"], "command": "st_execute" },
4+
{ "keys": ["ctrl+e", "ctrl+a"], "command": "st_execute_all" },
45
{ "keys": ["ctrl+e", "ctrl+x"], "command": "st_explain_plan" },
56
{ "keys": ["ctrl+e", "ctrl+h"], "command": "st_history" },
67
{ "keys": ["ctrl+e", "ctrl+s"], "command": "st_show_records" },
@@ -9,6 +10,6 @@
910
{ "keys": ["ctrl+e", "ctrl+b"], "command": "st_format" },
1011
{ "keys": ["ctrl+e", "ctrl+q"], "command": "st_save_query" },
1112
{ "keys": ["ctrl+e", "ctrl+r"], "command": "st_remove_saved_query" },
12-
{ "keys": ["ctrl+e", "ctrl+a"], "command": "st_list_queries"},
13+
{ "keys": ["ctrl+e", "ctrl+l"], "command": "st_list_queries"},
1314
{ "keys": ["ctrl+e", "ctrl+o"], "command": "st_list_queries", "args": {"mode" : "open"}}
1415
]

Default.sublime-commands

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"caption": "ST: Execute",
88
"command": "st_execute"
99
},
10+
{
11+
"caption": "ST: Execute All File",
12+
"command": "st_execute_all"
13+
},
1014
{
1115
"caption": "ST: Explain Plan",
1216
"command": "st_explain_plan"

SQLTools.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,18 @@ def run():
473473
ST.conn.execute(getSelection(), createOutput(), stream=settings.get('use_streams', False))
474474

475475

476+
class StExecuteAll(WindowCommand):
477+
@staticmethod
478+
def run():
479+
if not ST.conn:
480+
ST.selectConnection(tablesCallback=lambda: Window().run_command('st_execute_all'))
481+
return
482+
483+
Window().status_message(MESSAGE_RUNNING_CMD)
484+
allText = View().substr(sublime.Region(0, View().size()))
485+
ST.conn.execute(allText, createOutput(), stream=settings.get('use_streams', False))
486+
487+
476488
class StFormat(TextCommand):
477489
@staticmethod
478490
def run(edit):

0 commit comments

Comments
 (0)