forked from mtxr/SublimeText-SQLTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQLTools.sublime-settings
431 lines (431 loc) · 19.9 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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
// 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",
"mssql" : "sqlcmd",
"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": [],
"after": [],
"args": "-h {host} -p {port} -U {username} -d {database}",
"env_optional": {
"PGPASSWORD": "{password}"
},
"queries": {
"execute": {
"options": []
},
"desc": {
"query": "select '|' || quote_ident(table_schema)||'.'||quote_ident(table_name) ||'|' as tblname from information_schema.tables where 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+ {0}",
"options": []
},
"show records": {
"query": "select * from {0} limit {1}",
"options": []
},
"columns": {
"query": "select '|' || quote_ident(table_name) || '.' || quote_ident(column_name) || '|' from information_schema.columns where table_schema not in ('pg_catalog', 'information_schema') order by table_name, ordinal_position",
"options": ["--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 not in ('pg_catalog', 'information_schema')",
"options": ["--tuples-only", "--no-psqlrc"]
},
"desc function": {
"query": "\\sf {0}",
"options": []
},
"explain plan": {
"query": "explain {0};",
"options": []
}
}
},
"oracle": {
"options": ["-S"],
"before": [],
"after": [],
"env_optional": {
"NLS_LANG": "{nls_lang}"
},
"args": "{username}/{password}@\"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={host})(PORT={port})))(CONNECT_DATA=(SERVICE_NAME={service})))\"",
"queries": {
"execute": {
"options": [],
"before": [
// "SET TIMING ON",
"SET LINESIZE 32767",
"SET PAGESIZE 0",
"SET EMBEDDED ON",
"SET WRAP OFF",
"SET TAB OFF",
"SET TRIMOUT ON",
"SET TRIMSPOOL ON",
"SET NULL '@'",
"SET COLSEP '|'",
"SET FEEDBACK ON",
"SET SERVEROUT ON",
"SET SQLBLANKLINES ON"
]
},
"desc" : {
"query": "select owner || '.' || name as obj from (select owner, table_name as name from all_tables union all select owner, view_name as name from all_views) o where owner not in ('ANONYMOUS','APPQOSSYS','CTXSYS','DBSNMP','EXFSYS', 'LBACSYS', 'MDSYS','MGMT_VIEW','OLAPSYS','OWBSYS','ORDPLUGINS', 'ORDSYS','OUTLN', 'SI_INFORMTN_SCHEMA','SYS','SYSMAN','SYSTEM', 'TSMSYS','WK_TEST','WKSYS', 'WKPROXY','WMSYS','XDB','APEX_040000', 'APEX_PUBLIC_USER','DIP', 'FLOWS_30000','FLOWS_FILES','MDDATA', 'ORACLE_OCM','SPATIAL_CSW_ADMIN_USR', 'SPATIAL_WFS_ADMIN_USR', 'XS$NULL','PUBLIC');",
"options": [],
"before": [
"SET LINESIZE 32767",
"SET PAGESIZE 0",
"SET EMBEDDED ON",
"SET WRAP OFF",
"SET HEADING OFF",
"SET FEEDBACK OFF",
"SET TRIMOUT ON"
]
},
"columns": {
"query": "select table_name || '.' || column_name as obj from (select c.table_name, c.column_name, t.owner from all_tab_columns c inner join all_tables t on c.owner = t.owner and c.table_name = t.table_name union all select c.table_name, c.column_name, t.owner from all_tab_columns c inner join all_views t on c.owner = t.owner and c.table_name = t.view_name) o where owner not in ('ANONYMOUS','APPQOSSYS','CTXSYS','DBSNMP','EXFSYS', 'LBACSYS', 'MDSYS','MGMT_VIEW','OLAPSYS','OWBSYS','ORDPLUGINS', 'ORDSYS','OUTLN', 'SI_INFORMTN_SCHEMA','SYS','SYSMAN','SYSTEM', 'TSMSYS','WK_TEST','WKSYS', 'WKPROXY','WMSYS','XDB','APEX_040000', 'APEX_PUBLIC_USER','DIP', 'FLOWS_30000','FLOWS_FILES','MDDATA', 'ORACLE_OCM','SPATIAL_CSW_ADMIN_USR', 'SPATIAL_WFS_ADMIN_USR', 'XS$NULL','PUBLIC');",
"options": [],
"before": [
"SET LINESIZE 32767",
"SET PAGESIZE 0",
"SET EMBEDDED ON",
"SET WRAP OFF",
"SET HEADING OFF",
"SET FEEDBACK OFF",
"SET TRIMOUT ON"
]
},
"functions": {
"query": "select case when object_type = 'PACKAGE' then object_name||'.'||procedure_name else owner || '.' || object_name end || '()' as obj from all_procedures where object_type in ('FUNCTION','PROCEDURE','PACKAGE') and owner = sys_context('USERENV', 'CURRENT_SCHEMA');",
"options": [],
"before": [
"SET LINESIZE 32767",
"SET PAGESIZE 0",
"SET EMBEDDED ON",
"SET WRAP OFF",
"SET HEADING OFF",
"SET FEEDBACK OFF",
"SET TRIMOUT ON"
]
},
"desc table": {
"query": "desc {0};",
"options": [],
"before": [
"SET LINESIZE 80", // altered for readability
"SET PAGESIZE 0",
"SET EMBEDDED ON",
"SET WRAP OFF",
"SET TAB OFF",
"SET TRIMOUT ON",
"SET TRIMSPOOL ON",
"SET NULL '@'",
"SET COLSEP '|'",
"SET FEEDBACK ON",
"SET SERVEROUT ON",
"SET SQLBLANKLINES ON"
]
},
"show records": {
"query": "select * from {0} WHERE ROWNUM <= {1};",
"options": [],
"before": [
"SET LINESIZE 32767",
"SET PAGESIZE 0",
"SET EMBEDDED ON",
"SET WRAP OFF",
"SET TAB OFF",
"SET TRIMOUT ON",
"SET TRIMSPOOL ON",
"SET NULL '@'",
"SET COLSEP '|'",
"SET FEEDBACK ON",
"SET SERVEROUT ON",
"SET SQLBLANKLINES ON"
]
},
"explain plan": {
"query": "explain plan for {0};\nselect plan_table_output from table(dbms_xplan.display());",
"options": [],
"before": [
"SET LINESIZE 32767",
"SET PAGESIZE 0",
"SET EMBEDDED ON",
"SET WRAP OFF",
"SET TAB OFF",
"SET TRIMOUT ON",
"SET TRIMSPOOL ON",
"SET NULL '@'",
"SET COLSEP '|'",
"SET FEEDBACK ON",
"SET SERVEROUT ON",
"SET SQLBLANKLINES ON"
]
}
}
},
"mysql": {
"options": ["--default-character-set=utf8"],
"before": [],
"after": [],
"args": "-h{host} -P{port} -u\"{username}\" -D\"{database}\"",
"args_optional": ["--login-path=\"{login-path}\"", "--defaults-extra-file=\"{defaults-extra-file}\"", "-p\"{password}\""],
"queries": {
"execute": {
"options": ["--table", "-f"]
},
"desc" : {
"query": "select concat('|', case when table_schema REGEXP '[^0-9a-zA-Z$_]' then concat('`',table_schema,'`') else table_schema end, '.', case when table_name REGEXP '[^0-9a-zA-Z$_]' then concat('`',table_name,'`') else table_name end, '|') from information_schema.tables where table_schema = database() order by table_name;",
"options": ["--silent", "--raw"]
},
"desc table": {
"query": "desc {0}",
"options": ["--table"]
},
"show records": {
"query": "select * from {0} limit {1}",
"options": ["--table"]
},
"columns": {
"query": "select concat('|', case when table_name REGEXP '[^0-9a-zA-Z$_]' then concat('`',table_name,'`') else table_name end, '.', case when column_name REGEXP '[^0-9a-zA-Z$_]' then concat('`',column_name,'`') else column_name end, '|') from information_schema.columns where table_schema = database() order by table_name, ordinal_position;",
"options": ["--silent", "--raw"]
},
"functions": {
"query": "select concat('|', case when routine_schema REGEXP '[^0-9a-zA-Z$_]' then concat('`',routine_schema,'`') else routine_schema end, '.', case when routine_name REGEXP '[^0-9a-zA-Z$_]' then concat('`',routine_name,'`') else routine_name end, '()', '|') from information_schema.routines where routine_schema = database();",
"options": ["--silent", "--raw"]
},
"desc function": {
"query": "select routine_definition from information_schema.routines where concat(case when routine_schema REGEXP '[^0-9a-zA-Z$_]' then concat('`',routine_schema,'`') else routine_schema end, '.', case when routine_name REGEXP '[^0-9a-zA-Z$_]' then concat('`',routine_name,'`') else routine_name end) = '{0}';",
"options": ["--silent", "--raw"]
},
"explain plan": {
"query": "explain {0};",
"options": ["--table"]
}
}
},
"mssql": {
"options": [],
"before": [],
"after": ["go", "quit"],
"args": "-d \"{database}\"",
"args_optional": ["-S \"{host},{port}\"", "-S \"{host}\\{instance}\"", "-U \"{username}\"", "-P \"{password}\""],
"queries": {
"execute": {
"options": ["-k"]
},
"show records": {
"query": "select top {1} * from {0};",
"options": []
},
"desc table": {
"query": "exec sp_help N'{0}';",
"options": ["-y30", "-Y30"]
},
"desc function": {
"query": "exec sp_helptext N'{0}';",
"options": ["-h-1"]
},
"desc": {
"query": "set nocount on; select concat(table_schema, '.', table_name) as obj from information_schema.tables order by table_schema, table_name;",
"options": ["-h-1"]
},
"columns": {
"query": "set nocount on; select distinct concat(table_name, '.', column_name) as obj from information_schema.columns;",
"options": ["-h-1"]
},
"functions": {
"query": "set nocount on; select concat(routine_schema, '.', routine_name) as obj from information_schema.routines order by routine_schema, routine_name;",
"options": ["-h-1"]
},
"explain plan": {
"query": "{0};",
"options": ["-k"],
"before": [
"SET STATISTICS PROFILE ON",
"SET STATISTICS IO ON",
"SET STATISTICS TIME ON"
]
}
}
},
"vertica": {
"options": [],
"before" : [],
"after": [],
"args": "-h {host} -p {port} -U \"{username}\" -w \"{password}\" -d \"{database}\"",
"queries": {
"execute": {
"options": []
},
"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 {0}",
"options": []
},
"show records": {
"query": "select * from {0} limit {1}",
"options": []
},
"explain plan": {
"query": "explain {0};",
"options": []
}
}
},
"sqsh": {
"options": [],
"before": [],
"after": [],
"args": "-S {host}:{port} -U\"{username}\" -P\"{password}\" -D{database}",
"queries": {
"execute": {
"options": [],
"before": ["\\set semicolon_cmd=\"\\go -mpretty -l\""]
},
"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 \"{0}\";",
"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\""]
}
}
},
"sqlite": {
"options": [],
"before": [],
"after": [],
"args": "\"{database}\"",
"queries": {
"execute": {
"options": ["-column", "-header"]
},
"desc" : {
"query": ".headers off\nSELECT '|' || name || '|' FROM sqlite_master WHERE type='table';",
"options": ["-noheader"]
},
"desc table": {
"query": ".schema \"{0}\"",
"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": [],
"after": [],
"args": "-u \"{username}\" -p \"{password}\" \"{host}/{port}:{database}\"",
"queries": {
"execute": {
"options": []
},
"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 \"{0}\";",
"options": []
},
"show records": {
"query": "select first {1} * from \"{0}\";",
"options": []
}
}
}
}
}