forked from mtxr/SublimeText-SQLTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQLTools.sublime-settings
285 lines (285 loc) · 12.6 KB
/
SQLTools.sublime-settings
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
// NOTE: it is strongly advised to override
// only those settings that you wish to change
// in your Users/SQLTools.sublime-settings
{
"debug" : true,
"thread_timeout" : 15, // query timeout in seconds
"history_size" : 100,
"show_result_on_window" : false,
"clear_output" : true,
"safe_limit" : false,
"expand_to_paragraph" : false,
"use_streams" : false, // use streams for results
/**
* The list of syntax selectors for which the plugin autocompletion will be active.
* An empty list means autocompletion always active.
*/
"selectors": ["source.sql", "source.pgsql", "source.plpgsql.postgres", "source.plsql.oracle", "source.tsql"],
/**
* Possible values for autocompletion: "basic", "smart", true ("smart"),
* or false (disable)
* Completion keywords case is controlled by format.keyword_case (see below)
*/
"autocompletion": "smart",
/**
* Possible values for show_query: "top", "bottom", true ("top"), or false (disable)
* When using regular output, this will determine where query details is displayed.
* In stream output mode, any option that isn't false will print query details at
* the bottom of result.
*/
"show_query": false,
/**
* If DB cli binary is not in PATH, set the full path in "cli" section.
* Note: forward slashes ("/") should be used in path. Example:
* "mysql" : "c:/Program Files/MySQL/MySQL Server 5.7/bin/mysql.exe"
*/
"cli" : {
"mysql" : "mysql",
"pgsql" : "psql",
"oracle" : "sqlplus",
"vertica" : "vsql",
"sqsh" : "sqsh",
"firebird": "isql",
"sqlite" : "sqlite3"
},
"show_records": {
"limit": 50
},
"format" : {
"keyword_case" : "upper",
"identifier_case" : null,
"strip_comments" : false,
"indent_tabs" : false,
"indent_width" : 4,
"reindent" : true
},
"unescape_quotes" : [
"php"
],
/**
* Client options for you RDBMS.
* In this file, the section cli has the names you can use here. Eg: "pgsql": "psql"
* So here, you must have "psql with the same sections listed bellow (options, before, args and queries)"
*
* Avoid changing the brackets content in "args"
*/
"cli_options": {
"pgsql": {
"options": ["--no-password"],
"before": [],
"args": "-h {host} -p {port} -U {username} -d {database}",
"env_optional": {
"PGPASSWORD": "{password}"
},
"queries": {
"desc" : {
"query": "select '|' || quote_ident(table_schema)||'.'||quote_ident(table_name) ||'|' as tblname from information_schema.tables where table_schema = any(current_schemas(false)) and table_schema not in ('pg_catalog', 'information_schema') order by table_schema = current_schema() desc, table_schema, table_name",
"options": ["--tuples-only", "--no-psqlrc"]
},
"desc table": {
"query": "\\d+ %s",
"options": ["--no-password"]
},
"show records": {
"query": "select * from {0} limit {1}",
"options": ["--no-password"]
},
"columns": {
"query": "select '|' || quote_ident(table_name) || '.' || quote_ident(column_name) || '|' from information_schema.columns where table_schema = any(current_schemas(false)) and table_schema not in ('pg_catalog', 'information_schema') order by table_name, ordinal_position",
"options": ["--no-password", "--tuples-only", "--no-psqlrc"]
},
"functions": {
"query": "select '|' || quote_ident(n.nspname)||'.'||quote_ident(f.proname) || '(' || pg_get_function_identity_arguments(f.oid) || ')' || '|' as funname from pg_catalog.pg_proc as f inner join pg_catalog.pg_namespace as n on n.oid = f.pronamespace where f.proisagg = false and n.nspname = any(current_schemas(false)) and n.nspname not in ('pg_catalog', 'information_schema')",
"options": ["--no-password", "--tuples-only", "--no-psqlrc"]
},
"desc function": {
"query": "\\sf %s",
"options": ["--no-password"]
},
"explain plan": {
"query": "explain {0};",
"options": ["--no-password"]
}
}
},
"oracle": {
"options": ["-S"],
"before": [
"SET AUTO OFF",
"SET COLSEP '|'",
"SET FEED ON",
"SET FEEDBACK ON",
"SET HEADING ON",
"SET LINESIZE 32767",
"SET LONG 100",
"SET NULL @",
"SET PAGESIZE 0 EMBEDDED ON",
"SET SERVEROUTPUT ON",
"SET SQLBLANKLINES ON",
"SET SQLPROMPT ''",
"SET TAB OFF",
"SET TI ON",
"SET TIMI OFF",
"SET TRIMSPOOL OFF",
"SET UND '-'",
"SET VERIFY OFF ",
"SET WRAP OFF"
],
"args": "{username}/{password}@\"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={host})(PORT={port})))(CONNECT_DATA=(SERVICE_NAME={service})))\"",
"queries": {
"desc" : {
"query": "select concat(concat(concat(concat('|', owner), '.'), table_name), '|') as tbls from all_tables;",
"options": ["-S"]
},
"columns": {
"query": "select concat(concat(concat(concat('|', c.table_name), '.'), c.column_name), '|') as cols from all_tab_columns c inner join all_tables t ON c.owner = t.owner and c.table_name = t.table_name;",
"options": ["-S"]
},
"desc table": {
"query": "desc %s;",
"options": ["-S"]
},
"show records": {
"query": "select * from {0} WHERE ROWNUM <= {1};",
"options": ["-S"]
},
"explain plan": {
"query": "explain plan for {0};\nselect plan_table_output from table(dbms_xplan.display());",
"options": ["-S"]
}
}
},
"mysql": {
"options": ["-f", "--table"],
"before": [],
"args": "-h{host} -P{port} -u\"{username}\" -D\"{database}\"",
"args_optional": ["--login-path=\"{login-path}\"", "--defaults-extra-file=\"{defaults-extra-file}\"", "-p\"{password}\""],
"queries": {
"desc" : {
"query": "select concat('|', table_schema, '.', table_name, '|') from information_schema.tables where table_schema = database() order by table_name;",
"options": ["-f", "--silent", "--raw"]
},
"desc table": {
"query": "desc %s",
"options": ["-f", "--table"]
},
"show records": {
"query": "select * from {0} limit {1}",
"options": ["-f", "--table"]
},
"columns": {
"query": "select concat('|', table_name, '.', column_name, '|') from information_schema.columns where table_schema = database() order by table_name, ordinal_position;",
"options": ["-f", "--silent", "--raw"]
},
"functions": {
"query": "select concat('|', routine_schema, '.', routine_name, '()', '|') from information_schema.routines where routine_schema = database();",
"options": ["-f", "--silent", "--raw"]
},
"desc function": {
"query": "select routine_definition from information_schema.routines where concat(routine_schema, '.', routine_name) = '%s';",
"options": ["-f", "--silent", "--raw"]
},
"explain plan": {
"query": "explain {0};",
"options": ["-f", "--table"]
}
}
},
"vertica": {
"options": [],
"before" : [],
"args": "-h {host} -p {port} -U \"{username}\" -w \"{password}\" -d \"{database}\"",
"queries": {
"desc" : {
"query": "select '|' || table_schema || '.' || table_name || '|' as tblname from v_catalog.tables where is_system_table = false",
"options": ["--tuples-only", "--no-vsqlrc"]
},
"columns": {
"query": "select '|' || table_name || '.' || column_name || '|' as tblname from v_catalog.columns where is_system_table = false order by table_name, ordinal_position",
"options": ["--tuples-only", "--no-vsqlrc"]
},
"desc table": {
"query": "\\d %s",
"options": []
},
"show records": {
"query": "select * from {0} limit {1}",
"options": []
},
"explain plan": {
"query": "explain {0};",
"options": []
}
}
},
"sqsh": {
"options": [],
"before": ["\\set semicolon_cmd=\"\\go -mpretty -l\""],
"args": "-S {host}:{port} -U\"{username}\" -P\"{password}\" -D{database}",
"queries": {
"desc": {
"query": "select concat(table_schema, '.', table_name) from information_schema.tables order by table_name;",
"options": [],
"before" :["\\set semicolon_cmd=\"\\go -mpretty -l -h -f\""]
},
"columns": {
"query": "select concat(table_name, '.', column_name) from information_schema.columns order by table_name, ordinal_position;",
"options": [],
"before" :["\\set semicolon_cmd=\"\\go -mpretty -l -h -f\""]
},
"desc table": {
"query": "exec sp_columns \"%s\";",
"options": [],
"before": ["\\set semicolon_cmd=\"\\go -mpretty -l -h -f\""]
},
"show records": {
"query": "select top {1} * from \"{0}\";",
"options": [],
"before": ["\\set semicolon_cmd=\"\\go -mpretty -l -h -f\""]
}
}
},
"sqlite": {
"options": ["-column", "-header"],
"before": [],
"args": "\"{database}\"",
"queries": {
"desc" : {
"query": ".headers off\nSELECT '|' || name || '|' FROM sqlite_master WHERE type='table';",
"options": ["-noheader"]
},
"desc table": {
"query": ".schema \"%s\"",
"options": ["-column", "-header"]
},
"show records": {
"query": "select * from \"{0}\" limit {1};",
"options": ["-column", "-header"]
},
"explain plan": {
"query": "EXPLAIN QUERY PLAN {0};",
"options": ["-column", "-header"]
}
}
},
"firebird": {
"options": [],
"before": [],
"args": "-u \"{username}\" -p \"{password}\" \"{host}/{port}:{database}\"",
"queries": {
"desc" : {
"query": "select '|' || rdb$relation_name || '|' from rdb$relations where rdb$view_blr is null and (rdb$system_flag is null or rdb$system_flag = 0);",
"options": []
},
"desc table": {
"query": "show table \"%s\";",
"options": []
},
"show records": {
"query": "select first 100 * from \"%s\";",
"options": []
}
}
}
}
}