pekim/tedious — pull request #166 by rossipedia (2014-07-17 23:35:45+00:00)
Title: add fallbackToDefaultDb option, and make INIT_DB_FATAL the default

Most SQL Server clients will throw an error if the database requested in the connection is unavailable.

Currently, Tedious does not, and falls back to the user's default database. This can potentially have disastrous results (running an automated script such as a migration on the wrong database).

I'm proposing we change the default behavior and add an option, `fallbackToDefaultDb` to re-enable the previous behavior.

Proposed documentation patch:

```diff
diff --git a/api-connection.html b/api-connection.html
index 699bd7d..f205bfc 100644
--- a/api-connection.html
+++ b/api-connection.html
@@ -116,6 +116,16 @@ var connection = new Connection(config);

+ options.fallbackToDefaultDb
+

+

+ By default, if the database requestion by options.database cannot be accessed,
+ the connection will fail with an error. However, if options.fallbackToDefaultDb is
+ set to true, then the user's default database will be used instead
+ (Default: false).
+

+
+

options.connectTimeout

```