felixge/node-mysql — pull request #709 by sidorares (2014-01-16 05:11:58+00:00)
Title: Domains support

This change is very similar to https://github.com/sidorares/node-mysql2/pull/75

Usually connection/pool is created in top level domain (or no domain at all) and you would expect `query(cb)` callback to be called in the context of `query()` domain (often http request level domain). Instead, connection EventEmitter captures connect time domain and it is used later in all callbacks. This PR wraps all api callbacks with `bindToCurrentDomain` function. There should be no performance impact when domains are not used. See test and https://github.com/sidorares/node-mysql2/issues/73 for code examples