forked from mtxr/SublimeText-SQLTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQLTools.sublime-settings
343 lines (343 loc) · 15.3 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
// 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": {
"exec": {
"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": [
"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"
],
"after": [],
"args": "{username}/{password}@\"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={host})(PORT={port})))(CONNECT_DATA=(SERVICE_NAME={service})))\"",
"queries": {
"exec": {
"options": []
},
"desc" : {
"query": "select concat(concat(concat(concat('|', owner), '.'), table_name), '|') as tbls from all_tables UNION ALL select concat(concat(concat(concat('|', owner), '.'), view_name), '|') as tbls from all_views;",
"options": []
},
"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 UNION ALL SELECT concat(concat(concat(concat('|', c.table_name), '.'), c.column_name), '|') AS cols FROM all_tab_columns c INNER JOIN all_views t ON c.owner = t.owner AND c.table_name = t.view_name;",
"options": []
},
"desc table": {
"query": "desc {0};",
"options": []
},
"show records": {
"query": "select * from {0} WHERE ROWNUM <= {1};",
"options": []
},
"explain plan": {
"query": "explain plan for {0};\nselect plan_table_output from table(dbms_xplan.display());",
"options": []
}
}
},
"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": {
"exec": {
"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": {
"exec": {
"options": []
},
"desc": {
"query": "set nocount on; select concat(table_schema, '.', table_name) from information_schema.tables order by table_name;",
"options": ["-h", "-1"]
},
"columns": {
"query": "set nocount on; select concat(table_name, '.', column_name) from information_schema.columns order by table_name, ordinal_position;",
"options": ["-h", "-1"]
},
"desc table": {
"query": "exec sp_help \"{0}\";",
"options": []
},
"show records": {
"query": "select top {1} * from {0};",
"options": []
}
}
},
"vertica": {
"options": [],
"before" : [],
"after": [],
"args": "-h {host} -p {port} -U \"{username}\" -w \"{password}\" -d \"{database}\"",
"queries": {
"exec": {
"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": {
"exec": {
"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": {
"exec": {
"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": {
"exec": {
"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": []
}
}
}
}
}