Skip to content

Commit

Permalink
Changes the way ":" is added to sqlite db paths (#270)
Browse files Browse the repository at this point in the history
1. Only add on win32 platforms
2. Only add if host is a letter

The only case this can't avoid (right now) is realtive paths where the
first folder is a letter. Please avoid it.
  • Loading branch information
dresende committed Aug 2, 2013
1 parent 272850a commit 7302c7c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Drivers/DML/sqlite.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ function Driver(config, connection, opts) {
// on Windows, paths have a drive letter which is parsed by
// url.parse() as the hostname. If host is defined, assume
// it's the drive letter and add ":"
this.db = new sqlite3.Database(((config.host ? config.host + ":" : "") + (config.pathname || "")) || ':memory:');
if (process.platform == "win32" && config.host.match(/^[a-z]$/i)) {
this.db = new sqlite3.Database(((config.host ? config.host + ":" : "") + (config.pathname || "")) || ':memory:');
} else {
this.db = new sqlite3.Database(((config.host ? config.host : "") + (config.pathname || "")) || ':memory:');
}
}

this.aggregate_functions = [ "ABS", "ROUND",
Expand Down

0 comments on commit 7302c7c

Please sign in to comment.