felixge/node-mysql — pull request #713 by dougwilson (2014-01-16 19:28:40+00:00)
Title: Add trace flag for configuring long stack traces

This adds a new connection option `trace` to control if long stack traces are generated. The default if not specified is to generate them, which keeps the default behavior the same.

This also makes a minor tweak on how the initial stack is generated. Before it was generated in the `Sequence` constructor, so it captured the stack at the time the protocol sequence was generated. The stack is not captured in `Protocol.prototype._enqueue`. In all cases within the public API this captures the same stack, except there will be the extra call to `_enqueue` at the top of the stack. The following case, though, will be positively altered, though:

```javascript
var mysql = require('mysql');
var connection = mysql.createConnection(...);

connection.connect();

connection.query('FAIL', function (err) { // 1
if (err) throw err;
// Stack trace will include the line marked 1, as expected
});

var query = connection.createQuery('FAIL'); // 2

connection.query(query, function (err) { // 3
if (err) throw err;
// Stack trace will include the line marked 3
// Prior to this it would include the line marked 2
});
```

The change of the call site capture essentially moves the stack when using `require('mysql').createQuery` from the call to `createQuery` to the actual location where the query was handed over to the connection.

closes #710