brianc/node-postgres — pull request #396 by rpedela (2013-07-11 22:48:30+00:00)
Title: Add escapeLiteral and escapeIdentifier functions

I needed to be able to escape SQL identifiers (table names, column names, etc), so I added ```escapeLiteral``` and ```escapeIdentifier```. There is a native and JS version. Below is an example usage.

```js
var identifier = client.escapeIdentifier('my_table_name');
var literal = client.escapeLiteral('my_literal_value');
```

I am unsure the bindings C code is 100% correct. Particularly how errors are handled. The functions are synchronous so not sure I did the right thing for error handling. The native functions do not perform any I/O just string manipulation as far as I can tell which is why I made them synchronous.

I would appreciate it if someone double checked my C to JS port of PQescapeLiteral and PQescapeIdentifier starting on line 3238.
http://doxygen.postgresql.org/fe-exec_8c_source.html

I added tests for both JS and native, but I am unable to run the native tests. It tells me that it cannot find node-gyp, any ideas?