forked from mtxr/SublimeText-SQLTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQLTools.sublime-settings
498 lines (476 loc) · 22.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
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
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
// NOTE: it is strongly advised to override ONLY those settings
// that you wish to change in your Users/SQLTools.sublime-settings.
// Don't copy-paste the entire config.
{
"debug" : 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",
"mssql" : "sqlcmd",
"oracle" : "sqlplus",
"sqlite" : "sqlite3",
"vertica" : "vsql",
"firebird": "isql",
"sqsh" : "sqsh",
},
// use paragraph (text between newlines), if selection is empty
"expand_to_paragraph" : false,
// puts results either in output panel or new window
"show_result_on_window" : false,
// clears the output of prev. query
"clear_output" : true,
// query timeout in seconds
"thread_timeout" : 15,
// stream the output line by line
"use_streams" : false,
// number of queries to save in the history
"history_size" : 100,
// unless false, appends LIMIT clause to SELECT statements (not compatible with all DB's)
"safe_limit": false,
"unescape_quotes" : [
"php",
],
"show_records": {
"limit": 50,
},
/**
* Print the queries that were executed to the output.
* 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,
/**
* Possible values for autocompletion: "basic", "smart", true ("smart"),
* or false (disable)
* Completion keywords case is controlled by format.keyword_case (see below)
*/
"autocompletion": "smart",
// Settings used for formatting the queries and autocompletions
//
// "keyword_case" , "upper", "lower", "capitalize" and null (leaves case intact)
// "identifier_case", "upper", "lower", "capitalize" and null (leaves case intact)
// "strip_comments" , formatting removes comments
// "indent_tabs" , use tabs instead of spaces
// "indent_width" , indentation width
// "reindent" , reindent code
"format" : {
"keyword_case" : "upper",
"identifier_case" : null,
"strip_comments" : false,
"indent_tabs" : false,
"indent_width" : 4,
"reindent" : true
},
/**
* 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",
],
/**
* Command line interface options for each RDBMS.
* In this file, the section `cli` above has the names you can use here.
* E.g.: "mysql", "pgsql", "oracle"
*
* Names in the curly brackets (e.g. `{host}`) in sections `args`, `args_optional`,
* `env`, `env_optional` are replaced by the values specified in the connection.
*/
"cli_options": {
"pgsql": {
"options": ["--no-password"],
"before": [],
"after": [],
"args": "-h {host} -p {port} -U {username} -d {database}",
"env_optional": {
"PGPASSWORD": "{password}"
},
"queries": {
"execute": {
"options": []
},
"show records": {
"query": "select * from {0} limit {1};",
"options": []
},
"desc table": {
"query": "\\d+ {0}",
"options": []
},
"desc function": {
"query": "\\sf {0}",
"options": []
},
"explain plan": {
"query": "explain analyze {0};",
"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"]
},
"columns": {
"query": "select distinct quote_ident(table_name) || '.' || quote_ident(column_name) from information_schema.columns where table_schema not in ('pg_catalog', 'information_schema');",
"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"]
}
}
},
"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"]
},
"show records": {
"query": "select * from {0} limit {1};",
"options": ["--table"]
},
"desc table": {
"query": "desc {0}",
"options": ["--table"]
},
"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"]
},
"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) as obj from information_schema.tables where table_schema = database() order by table_name;",
"options": ["--silent", "--raw"]
},
"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) as obj 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, '()') as obj from information_schema.routines where routine_schema = database();",
"options": ["--silent", "--raw"]
}
}
},
"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"]
},
"explain plan": {
"query": "{0};",
"options": ["-k"],
"before": [
"SET STATISTICS PROFILE ON",
"SET STATISTICS IO ON",
"SET STATISTICS TIME ON"
]
},
"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"]
}
}
},
"oracle": {
"options": ["-S"],
"before": [
"SET LINESIZE 32767",
"SET WRAP OFF",
"SET PAGESIZE 0",
"SET EMBEDDED ON",
"SET TRIMOUT ON",
"SET TRIMSPOOL ON",
"SET TAB OFF",
"SET SERVEROUT ON",
"SET NULL '@'",
"SET COLSEP '|'",
"SET SQLBLANKLINES ON"
],
"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 FEEDBACK ON"
]
},
"show records": {
"query": "select * from {0} where rownum <= {1};",
"options": [],
"before": [
"SET FEEDBACK ON"
]
},
"desc table": {
"query": "desc {0};",
"options": [],
"before": [
"SET LINESIZE 80", // override for readability
"SET WRAP ON", // override for readability
"SET FEEDBACK ON"
]
},
"desc function": {
"query": "select text from all_source where type in ('FUNCTION', 'PROCEDURE', 'PACKAGE', 'PACKAGE BODY') and name = nvl(substr(ltrim('{0}', sys_context('USERENV', 'CURRENT_SCHEMA') || '.' ), 0, instr(ltrim('{0}', sys_context('USERENV', 'CURRENT_SCHEMA') || '.' ), '.')-1), ltrim('{0}', sys_context('USERENV', 'CURRENT_SCHEMA') || '.' )) and owner = sys_context('USERENV', 'CURRENT_SCHEMA') order by type, line;",
"options": [],
"before": [
"SET SERVEROUT OFF", // override
"SET NULL ''", // override
"SET HEADING OFF",
"SET FEEDBACK OFF"
]
},
"explain plan": {
"query": "explain plan for {0};\nselect plan_table_output from table(dbms_xplan.display());",
"options": [],
"before": [
"SET FEEDBACK ON"
]
},
"desc" : {
"query": "select owner || '.' || case when upper(name) = name then name else chr(34) || name || chr(34) end 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 SERVEROUT OFF", // override
"SET NULL ''", // override
"SET HEADING OFF",
"SET FEEDBACK OFF"
]
},
"columns": {
"query": "select case when upper(table_name) = table_name then table_name else chr(34) || table_name || chr(34) end || '.' || case when upper(column_name) = column_name then column_name else chr(34) || column_name || chr(34) end 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 SERVEROUT OFF", // override
"SET NULL ''", // override
"SET HEADING OFF",
"SET FEEDBACK OFF"
]
},
"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 not (object_type = 'PACKAGE' and procedure_name is null) and owner = sys_context('USERENV', 'CURRENT_SCHEMA');",
"options": [],
"before": [
"SET SERVEROUT OFF", // override
"SET NULL ''", // override
"SET HEADING OFF",
"SET FEEDBACK OFF"
]
}
}
},
"sqlite": {
"options": [],
"before": [],
"after": [],
"args": "\"{database}\"",
"queries": {
"execute": {
"options": ["-column", "-header", "-bail"]
},
"show records": {
"query": "select * from \"{0}\" limit {1};",
"options": ["-column", "-header"]
},
"explain plan": {
"query": "EXPLAIN QUERY PLAN {0};",
"options": ["-column", "-header", "-bail"]
},
"desc table": {
"query": ".schema \"{0}\"",
"options": ["-column", "-header"]
},
"desc" : {
"query": "SELECT name FROM sqlite_master WHERE type='table';",
"options": ["-noheader"],
"before": [
".headers off"
]
}
}
},
"vertica": {
"options": [],
"before" : [],
"after": [],
"args": "-h \"{host}\" -p {port} -U \"{username}\" -w \"{password}\" -d \"{database}\"",
"queries": {
"execute": {
"options": []
},
"show records": {
"query": "select * from {0} limit {1};",
"options": []
},
"desc table": {
"query": "\\d {0}",
"options": []
},
"explain plan": {
"query": "explain {0};",
"options": []
},
"desc" : {
"query": "select quote_ident(table_schema) || '.' || quote_ident(table_name) as obj from v_catalog.tables where is_system_table = false;",
"options": ["--tuples-only", "--no-vsqlrc"]
},
"columns": {
"query": "select quote_ident(table_name) || '.' || quote_ident(column_name) as obj from v_catalog.columns where is_system_table = false order by table_name, ordinal_position;",
"options": ["--tuples-only", "--no-vsqlrc"]
}
}
},
"firebird": {
"options": [],
"before": [],
"after": [],
"args": "-pagelength 10000 -u \"{username}\" -p \"{password}\" \"{host}/{port}:{database}\"",
"queries": {
"execute": {
"options": [],
"before": [
"set bail on;",
"set count on;"
]
},
"show records": {
"query": "select first {1} * from {0};",
"options": [],
"before": [
"set bail off;",
"set count on;"
]
},
"desc table": {
"query": "show table {0}; \n show view {0};",
"before": [
"set bail off;"
]
},
"desc function": {
"query": "show procedure {0};",
"before": [
"set bail off;"
]
},
"explain plan": {
"query": "{0};",
"before": [
"set bail on;",
"set count on;",
"set plan on;",
"set stats on;"
]
},
"desc" : {
"query": "select case when upper(rdb$relation_name) = rdb$relation_name then trim(rdb$relation_name) else '\"' || trim(rdb$relation_name) || '\"' end as obj from rdb$relations where (rdb$system_flag is null or rdb$system_flag = 0);",
"before": [
"set bail off;",
"set heading off;",
"set count off;",
"set stats off;"
]
},
"columns": {
"query": "select case when upper(f.rdb$relation_name) = f.rdb$relation_name then trim(f.rdb$relation_name) else '\"' || trim(f.rdb$relation_name) || '\"' end || '.' || case when upper(f.rdb$field_name) = f.rdb$field_name then trim(f.rdb$field_name) else '\"' || trim(f.rdb$field_name) || '\"' end as obj from rdb$relation_fields f join rdb$relations r on f.rdb$relation_name = r.rdb$relation_name where (r.rdb$system_flag is null or r.rdb$system_flag = 0) order by f.rdb$relation_name, f.rdb$field_position;",
"before": [
"set bail off;",
"set heading off;",
"set count off;",
"set stats off;"
]
},
"functions": {
"query": "select case when upper(rdb$procedure_name) = rdb$procedure_name then trim(rdb$procedure_name) else '\"' || trim(rdb$procedure_name) || '\"' end || '()' as obj from rdb$procedures where (rdb$system_flag is null or rdb$system_flag = 0);",
"before": [
"set bail off;",
"set heading off;",
"set count off;",
"set stats off;"
]
}
}
},
"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\""]
}
}
}
}
}