brianc / node-libpq

Simple, low level native bindings to PostgreSQL's libpq from node.js
112 stars 42 forks source link

Fix escapeLiteral() so it properly returns empty string and null #48

Open rgagnon24 opened 7 years ago

rgagnon24 commented 7 years ago

escapeLiteral("") should return "''" and escapeLiteral(null) should return "NULL"

If empty string is currently sent to escapeLiteral, empty string is returned. What should be returned is a string containing just an open and close single-quote (which the actual library will do)

If null is sent to the method, the string "NULL" should be returned.