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

Commit 160406b

Browse files
authored
Merge pull request #170 from mtxr/feature/review-settings
Review settings, move important options to the top
2 parents 15aed0f + 58c679b commit 160406b

File tree

3 files changed

+71
-53
lines changed

3 files changed

+71
-53
lines changed

SQLTools.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,9 @@ def getConnections():
9696
connectionsObj[name] = createConnection(name, config, settings=settings.all())
9797

9898
# project settings
99-
try:
100-
options = Window().project_data().get('connections', {})
101-
for name, config in options.items():
102-
connectionsObj[name] = createConnection(name, config, settings=settings.all())
103-
except Exception:
104-
pass
99+
options = Window().project_data().get('connections', {})
100+
for name, config in options.items():
101+
connectionsObj[name] = createConnection(name, config, settings=settings.all())
105102

106103
return connectionsObj
107104

SQLTools.sublime-settings

Lines changed: 47 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,7 @@
1-
// NOTE: it is strongly advised to override
2-
// only those settings that you wish to change
3-
// in your Users/SQLTools.sublime-settings
1+
// NOTE: it is strongly advised to override ONLY those settings
2+
// that you wish to change in your Users/SQLTools.sublime-settings.
3+
// Don't copy-paste the entire config.
44
{
5-
"debug" : true,
6-
"thread_timeout" : 15, // query timeout in seconds
7-
"history_size" : 100,
8-
"show_result_on_window" : false,
9-
"clear_output" : true,
10-
"safe_limit" : false,
11-
"expand_to_paragraph" : false,
12-
"use_streams" : false, // use streams for results
13-
/**
14-
* The list of syntax selectors for which the plugin autocompletion will be active.
15-
* An empty list means autocompletion always active.
16-
*/
17-
"selectors": ["source.sql", "source.pgsql", "source.plpgsql.postgres", "source.plsql.oracle", "source.tsql"],
18-
/**
19-
* Possible values for autocompletion: "basic", "smart", true ("smart"),
20-
* or false (disable)
21-
* Completion keywords case is controlled by format.keyword_case (see below)
22-
*/
23-
"autocompletion": "smart",
24-
/**
25-
* Possible values for show_query: "top", "bottom", true ("top"), or false (disable)
26-
* When using regular output, this will determine where query details is displayed.
27-
* In stream output mode, any option that isn't false will print query details at
28-
* the bottom of result.
29-
*/
30-
"show_query": false,
315
/**
326
* If DB cli binary is not in PATH, set the full path in "cli" section.
337
* Note: forward slashes ("/") should be used in path. Example:
@@ -36,33 +10,61 @@
3610
"cli" : {
3711
"mysql" : "mysql",
3812
"pgsql" : "psql",
39-
"oracle" : "sqlplus",
4013
"mssql" : "sqlcmd",
14+
"oracle" : "sqlplus",
15+
"sqlite" : "sqlite3",
4116
"vertica" : "vsql",
42-
"sqsh" : "sqsh",
4317
"firebird": "isql",
44-
"sqlite" : "sqlite3"
18+
"sqsh" : "sqsh"
4519
},
20+
"expand_to_paragraph" : false, // use paragraph (text between newlines), if selection is empty
21+
"show_result_on_window" : false, // puts results either in output pannel or new window
22+
"clear_output" : true, // clears the output of prev. query
23+
"thread_timeout" : 15, // query timeout in seconds
24+
"use_streams" : false, // stream the output line by line
25+
"history_size" : 100, // number of queries to save in the history
4626
"show_records": {
4727
"limit": 50
4828
},
29+
/**
30+
* Print the queries that were executed to the output.
31+
* Possible values for show_query: "top", "bottom", true ("top"), or false (disable)
32+
* When using regular output, this will determine where query details is displayed.
33+
* In stream output mode, any option that isn't false will print query details at
34+
* the bottom of result.
35+
*/
36+
"show_query": false,
37+
/**
38+
* Possible values for autocompletion: "basic", "smart", true ("smart"),
39+
* or false (disable)
40+
* Completion keywords case is controlled by format.keyword_case (see below)
41+
*/
42+
"autocompletion": "smart",
43+
// Settings used for formatting the queries and autocompletions
4944
"format" : {
50-
"keyword_case" : "upper",
51-
"identifier_case" : null,
52-
"strip_comments" : false,
53-
"indent_tabs" : false,
54-
"indent_width" : 4,
55-
"reindent" : true
45+
"keyword_case" : "upper", // "upper", "lower", "capitalize" and null (leaves case intact)
46+
"identifier_case" : null, // "upper", "lower", "capitalize" and null (leaves case intact)
47+
"strip_comments" : false, // formatting removes comments
48+
"indent_tabs" : false, // use tabs instead of spaces
49+
"indent_width" : 4, // indentation width
50+
"reindent" : true // reindent code
5651
},
52+
"debug": false,
53+
"safe_limit": false, // unless false, appends LIMIT clause to SELECT statements (not compatible with all DB's)
5754
"unescape_quotes" : [
5855
"php"
5956
],
6057
/**
61-
* Client options for you RDBMS.
62-
* In this file, the section cli has the names you can use here. Eg: "pgsql": "psql"
63-
* So here, you must have "psql with the same sections listed bellow (options, before, args and queries)"
58+
* The list of syntax selectors for which the plugin autocompletion will be active.
59+
* An empty list means autocompletion always active.
60+
*/
61+
"selectors": ["source.sql", "source.pgsql", "source.plpgsql.postgres", "source.plsql.oracle", "source.tsql"],
62+
/**
63+
* Command line interface options for each RDBMS.
64+
* In this file, the section `cli` above has the names you can use here. E.g.: "mysql", "pgsql", "oracle"
6465
*
65-
* Avoid changing the brackets content in "args"
66+
* Names in the curly brackets (e.g. `{host}`) in sections `args`, `args_optional`, `env`, `env_optional`
67+
* are replaced by the values specified in the connetion.
6668
*/
6769
"cli_options": {
6870
"pgsql": {
@@ -319,7 +321,7 @@
319321
"options": [],
320322
"before" : [],
321323
"after": [],
322-
"args": "-h {host} -p {port} -U \"{username}\" -w \"{password}\" -d \"{database}\"",
324+
"args": "-h \"{host}\" -p {port} -U \"{username}\" -w \"{password}\" -d \"{database}\"",
323325
"queries": {
324326
"execute": {
325327
"options": []
@@ -337,11 +339,11 @@
337339
"options": []
338340
},
339341
"desc" : {
340-
"query": "select table_schema || '.' || table_name as tblname from v_catalog.tables where is_system_table = false;",
342+
"query": "select quote_ident(table_schema) || '.' || quote_ident(table_name) as obj from v_catalog.tables where is_system_table = false;",
341343
"options": ["--tuples-only", "--no-vsqlrc"]
342344
},
343345
"columns": {
344-
"query": "select table_name || '.' || column_name as tblname from v_catalog.columns where is_system_table = false order by table_name, ordinal_position;",
346+
"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;",
345347
"options": ["--tuples-only", "--no-vsqlrc"]
346348
}
347349
}

SQLToolsConnections.sublime-settings

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Generic Template": { // Connection name, used in menu (Display name)
55
"type" : "pgsql", // DB type: (mysql, pgsql, oracle, vertica, sqlite, firebird, sqsh)
66
"host" : "HOSTNAME", // DB host to connect to
7-
"port" : "PORT", // DB port
7+
"port" : PORT, // DB port
88
"database" : "DATABASE", // DB name (for SQLite this is the path to DB file)
99
"username" : "USERNAME", // DB username
1010
"password" : "PASSWORD", // DB password (see RDMBS specific comments below)
@@ -60,7 +60,26 @@
6060
"Connection SQLite": {
6161
"type" : "sqlite",
6262
// note the forward slashes in path
63-
"database": "d:/sqlite/sample_db/chinook.db",
63+
"database": "c:/sqlite/sample_db/chinook.db",
64+
"encoding": "utf-8"
65+
},
66+
"Connection Vertica": {
67+
"type" : "vertica",
68+
"host" : "localhost",
69+
"port" : 5433,
70+
"username": "anotheruser",
71+
"password": "password",
72+
"database": "dbname",
73+
"encoding": "utf-8"
74+
},
75+
"Connection Firebird": {
76+
"type" : "firebird",
77+
"host" : "localhost",
78+
"port" : 3050,
79+
"username": "sysdba",
80+
"password": "password",
81+
// note the forward slashes (if path is used)
82+
"database": "c:/firebird/examples/empbuild/employee.fdb",
6483
"encoding": "utf-8"
6584
}
6685
*/

0 commit comments

Comments
 (0)