Skip to content
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Commit ae86d93

Browse files
authored
Merge pull request #175 from mtxr/review-pg-mysql-mssql-config
Review and improve PostgreSQL, MySQL, MSSQL configs
2 parents 2621cbf + 7fcacc1 commit ae86d93

File tree

2 files changed

+39
-27
lines changed

2 files changed

+39
-27
lines changed

SQLTools.sublime-settings

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Note: forward slashes ("/") should be used in path. Example:
88
* "mysql" : "c:/Program Files/MySQL/MySQL Server 5.7/bin/mysql.exe"
99
*/
10-
"cli" : {
10+
"cli": {
1111
"mysql" : "mysql",
1212
"pgsql" : "psql",
1313
"mssql" : "sqlcmd",
@@ -26,32 +26,28 @@
2626
"expand_to": "file",
2727

2828
// puts results either in output panel or new window
29-
"show_result_on_window" : false,
29+
"show_result_on_window": false,
3030

3131
// clears the output of previous query
32-
"clear_output" : true,
32+
"clear_output": true,
3333

3434
// query timeout in seconds
35-
"thread_timeout" : 15,
35+
"thread_timeout": 15,
3636

3737
// stream the output line by line
38-
"use_streams" : false,
38+
"use_streams": false,
3939

4040
// number of queries to save in the history
41-
"history_size" : 100,
42-
43-
// unless false, appends LIMIT clause to SELECT statements (not compatible with all DB's)
44-
"safe_limit": false,
45-
46-
"unescape_quotes" : [
47-
"php"
48-
],
41+
"history_size": 100,
4942

5043
"show_records": {
5144
"limit": 50
5245
},
5346

54-
"debug" : false,
47+
// unless false, appends LIMIT clause to SELECT statements (not compatible with all DB's)
48+
"safe_limit": false,
49+
50+
"debug": false,
5551

5652
/**
5753
* Print the queries that were executed to the output.
@@ -77,7 +73,7 @@
7773
// "indent_tabs" , use tabs instead of spaces
7874
// "indent_width" , indentation width
7975
// "reindent" , reindent code
80-
"format" : {
76+
"format": {
8177
"keyword_case" : "upper",
8278
"identifier_case" : null,
8379
"strip_comments" : false,
@@ -111,7 +107,12 @@
111107
"options": ["--no-password"],
112108
"before": [],
113109
"after": [],
114-
"args": "-h {host} -p {port} -U {username} -d {database}",
110+
"args": "-d {database}",
111+
"args_optional": [
112+
"-h {host}",
113+
"-p {port}",
114+
"-U {username}"
115+
],
115116
"env_optional": {
116117
"PGPASSWORD": "{password}"
117118
},
@@ -151,21 +152,31 @@
151152
},
152153

153154
"mysql": {
154-
"options": ["--default-character-set=utf8"],
155+
"options": ["--no-auto-rehash", "--compress"],
155156
"before": [],
156157
"after": [],
157-
"args": "-h{host} -P{port} -u\"{username}\" -D\"{database}\"",
158-
"args_optional": ["--login-path=\"{login-path}\"", "--defaults-extra-file=\"{defaults-extra-file}\"", "-p\"{password}\""],
158+
"args": "-D\"{database}\"",
159+
"args_optional": [
160+
"--login-path=\"{login-path}\"",
161+
"--defaults-extra-file=\"{defaults-extra-file}\"",
162+
"--default-character-set=\"{default-character-set}\"",
163+
"-h\"{host}\"",
164+
"-P{port}",
165+
"-u\"{username}\""
166+
],
167+
"env_optional": {
168+
"MYSQL_PWD": "{password}"
169+
},
159170
"queries": {
160171
"execute": {
161-
"options": ["--table", "-f"]
172+
"options": ["--table"]
162173
},
163174
"show records": {
164175
"query": "select * from {0} limit {1};",
165176
"options": ["--table"]
166177
},
167178
"desc table": {
168-
"query": "desc {0}",
179+
"query": "desc {0};",
169180
"options": ["--table"]
170181
},
171182
"desc function": {
@@ -178,15 +189,15 @@
178189
},
179190
"desc" : {
180191
"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;",
181-
"options": ["--silent", "--raw"]
192+
"options": ["--silent", "--raw", "--skip-column-names"]
182193
},
183194
"columns": {
184195
"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;",
185-
"options": ["--silent", "--raw"]
196+
"options": ["--silent", "--raw", "--skip-column-names"]
186197
},
187198
"functions": {
188199
"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();",
189-
"options": ["--silent", "--raw"]
200+
"options": ["--silent", "--raw", "--skip-column-names"]
190201
}
191202
}
192203
},
@@ -224,15 +235,15 @@
224235
},
225236
"desc": {
226237
"query": "set nocount on; select concat(table_schema, '.', table_name) as obj from information_schema.tables order by table_schema, table_name;",
227-
"options": ["-h-1"]
238+
"options": ["-h-1", "-r1"]
228239
},
229240
"columns": {
230241
"query": "set nocount on; select distinct concat(table_name, '.', column_name) as obj from information_schema.columns;",
231-
"options": ["-h-1"]
242+
"options": ["-h-1", "-r1"]
232243
},
233244
"functions": {
234245
"query": "set nocount on; select concat(routine_schema, '.', routine_name) as obj from information_schema.routines order by routine_schema, routine_name;",
235-
"options": ["-h-1"]
246+
"options": ["-h-1", "-r1"]
236247
}
237248
}
238249
},

SQLToolsConnections.sublime-settings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"password": "password", // you will get a security warning in the output
2121
// "defaults-extra-file": "/path/to/defaults_file_with_password", // use [client] or [mysql] section
2222
// "login-path": "your_login_path", // login path in your ".mylogin.cnf"
23+
"default-character-set": "utf8",
2324
"encoding": "utf-8"
2425
},
2526
"Connection PostgreSQL": {

0 commit comments

Comments
 (0)