forked from mtxr/SublimeText-SQLTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSQLTools.sublime-settings
235 lines (235 loc) · 9.39 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
{
"debug" : true,
"thread_timeout" : 5000,
"history_size" : 100,
"show_result_on_window" : false,
"unescape_quotes" : [
"php"
],
"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
},
/**
* Client options for you SGBD.
* 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": [],
"before": [],
"args": "-h {host} -p {port} -U {username} -d {database}",
"queries": {
"desc" : {
"query": "SELECT '|' || CASE WHEN n.nspname = current_schema() THEN quote_ident(c.relname) ELSE quote_ident(n.nspname)||'.'||quote_ident(c.relname) END ||'|' AS tblname FROM pg_catalog.pg_class AS c INNER JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace WHERE relkind = 'r' AND n.nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema') ORDER BY n.nspname = current_schema() DESC, pg_catalog.pg_table_is_visible(c.oid) DESC, n.nspname, c.relname",
"options": ["-t", "--no-psqlrc"],
"format" : "|%s|"
},
"desc table": {
"query": "\\d+ %s",
"options": [],
"format" : "|%s|"
},
"show records": {
"query": "select * from {0} limit {1}",
"options": [],
"format" : "|%s|"
},
"columns": {
"query": "SELECT DISTINCT '|' || table_name || '.' || column_name || '|' FROM information_schema.columns WHERE table_schema = CURRENT_SCHEMA() GROUP BY table_name, column_name;",
"options": ["-t", "--no-psqlrc"],
"format" : "|%s|"
},
"functions": {
"query": "SELECT '|' || CASE WHEN n.nspname = current_schema() THEN quote_ident(f.proname) ELSE quote_ident(n.nspname)||'.'||quote_ident(f.proname) END || '(' || 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 proisagg = false AND n.nspname NOT IN ('pg_catalog', 'information_schema')",
"options": ["-t", "--no-psqlrc"],
"format" : "|%s|"
},
"desc function": {
"query": "\\sf %s",
"options": [],
"format" : "|%s|"
},
}
},
"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('| ', table_name), ' |') as tables from user_tables;",
"options": ["-S"],
"format" : "|%s|"
},
"desc table": {
"query": "desc %s;",
"options": ["-S"],
"format" : "|%s|"
},
"show records": {
"query": "select * from {0} limit {1};",
"options": ["-S"],
"format" : "|%s|"
}
}
},
"mysql": {
"options": ["-f", "--table"],
"before": [],
"args": "-h{host} -P{port} -u\"{username}\" -p\"{password}\" -D\"{database}\"",
"queries": {
"desc" : {
"query": "show tables",
"options": ["-f", "--table", "--skip-column-names"],
"format" : "|%s|"
},
"desc table": {
"query": "desc `%s`",
"options": ["-f", "--table"],
"format" : "|%s|"
},
"show records": {
"query": "select * from `{0}` limit {1}",
"options": ["-f", "--table"],
"format" : "|%s|"
},
"columns": {
"query": "SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = DATABASE();",
"options": ["-f", "--table"],
"format" : "|%s|"
}
}
},
"vertica": {
"options": [],
"before" : [],
"args": "-h {host} -p {port} -U \"{username}\" -w \"{password}\" -d \"{database}\"",
"queries": {
"desc" : {
"query": "\\dt",
"options": ["-t"],
"format" : "|%s|"
},
"desc table": {
"query": "\\d %s",
"options": [],
"format" : "|%s|"
},
"show records": {
"query": "select * from {0} limit {1}",
"options": [],
"format" : "|%s|"
}
}
},
"sqsh": {
"options": [],
"before": ["\\set semicolon_cmd=\"\\go -mpretty -l\""],
"args": "-S {options.host}:{options.port} -U\"{options.username}\" -P\"{options.password}\" -D{options.database}",
"queries": {
"desc": {
"query": "select table_name from information_schema.tables order by 1;",
"before" :["\\set semicolon_cmd=\"\\go -mpretty -l -h -f\""],
"options": [],
"format": "|%s|"
},
"desc table": {
"query": "exec sp_columns \"%s\";",
"options": [],
"before": ["\\set semicolon_cmd=\"\\go -mpretty -l -h -f\""],
"format": "|%s|"
},
"show records": {
"query": "select top 100 * from \"%s\";",
"options": [],
"before": ["\\set semicolon_cmd=\"\\go -mpretty -l -h -f\""],
"format": "|%s|"
}
}
},
"sqlite": {
"options": ["-column", "-nullvalue null"],
"before": [".headers on"],
"args": "\"{options.database}\"",
"queries": {
"desc" : {
"query": ".headers off\nSELECT '|' || name || '|' FROM sqlite_master WHERE type='table';",
"options": [],
"format" : "|%s|"
},
"desc table": {
"query": ".schema \"%s\"",
"options": ["-column"],
"format" : "%s"
},
"show records": {
"query": "select * from \"%s\" limit 100;",
"options": ["-column"],
"format" : "|%s|"
}
}
},
"firebird": {
"options": [],
"before": [],
"args": "-u \"{options.username}\" -p \"{options.password}\" \"{options.host}/{options.port}:{options.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": [],
"format" : "|%s|"
},
"desc table": {
"query": "show table \"%s\";",
"options": [],
"format" : "|%s|"
},
"show records": {
"query": "select first 100 * from \"%s\";",
"options": [],
"format" : "|%s|"
}
}
}
}
}