pekim/tedious — pull request #165 by rossipedia (2014-07-17 22:52:14+00:00)
Title: add requireDatabase option

Currently, when the user requests a database that doesn't exist, or they don't have access to, tedious/TDS falls back to the user's default database. This is unexpected, as most client's will give an error when the requested database is inaccessible.

Since I don't want to introduce any breaking changes to current behavior, this PR introduces a new option, `requireDatabase` which tells tedious to send the `INIT_DB_FATAL` flag along with the login packet, which will throw an error if the requested database is inaccessible.

If everything looks good to you guys I'll go ahead and merge this in and update the docs as well:

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

+ options.requireDatabase
+

+

+ If this is true, and the connection cannot be changed to the requested database,
+ then the connection will fail with an error. If this is false, then the connection
+ will succeed and be set to the default database for the specified user instead (default: false).
+

+
+

options.connectTimeout

```