felixge/node-mysql — pull request #294 by bgoldman (2012-09-30 23:30:52+00:00)
Title: add support for escaping fields in addition to values, including arrays of fields

Adds two new methods to SqlString:

1) SqlString.escapeString is the string escaping portion of SqlString.escape which is now in its own method. Users can now call escapeString to escape a string without getting the single quotes surrounding it.

2) SqlString.escapeField is like SqlString.escape except it's for field names instead of values. It uses a backtick instead of a single quote, and can escape arrays of field names, for use in the fields portion of "INSERT INTO foo (`field1`, `field2`, `field3`) VALUES ('value1', 'value2', 'value3')". SqlString.escapeField uses SqlString.escapeString internally.

I also added wrapper methods in Connection.prototype for both methods just as there was for escape.