Commit Graph

21 Commits

Author SHA1 Message Date
Nikhil Benesch
619ba46ffe pass prepareValue hook to toPostgres
Pass `toPostgres` type-coercers a reference to the `prepareValue`
function to ease constructing literals composed of other Postgres types.
2014-04-03 10:28:02 -04:00
Nikhil Benesch
6ced524390 allow type-coercion overrides for custom objects
Attempt to call a `toPostgres` method on objects passed as query values
before converting them to JSON. This allows custom types to convert
themselves to the appropriate PostgreSQL literal.

This strategy is fully backwards-compatible and uses the same pattern as
the `toJSON` override.
2014-03-30 20:39:56 -04:00
Nikhil Benesch
c41eedc3e0 properly prepare complex arrays
`arrayString` duplicated too much of `prepareValue`'s logic, and so
didn't receive bugfixes for handling dates with timestamps. Defer to
`prepareValue` whenever possible.

This change enforces double-quote escaping of all array elements,
regardless of whether escaping is necessary. This has the side-effect of
properly escaping JSON arrays.
2014-03-30 19:12:18 -04:00
Nikhil Benesch
b778f2bdf0 utils-tests: add unit tests for prepareValue 2014-03-30 19:03:24 -04:00
Brian M. Carlson
0254fa565f Add test for pg.types interface 2014-03-15 15:41:36 -05:00
Brian M. Carlson
876abe8730 Break type parsing into separate module 2014-03-15 15:36:27 -05:00
bmc
113b6298e2 use ConnectionParameters with native bindings and remove unused util functions 2013-01-22 23:23:47 -06:00
bmc
868a9d0e8d remove node-tap 2013-01-20 19:42:40 -06:00
Stephen Sugden
5d25bcdcf0 add some tests for normalizeQueryConfig 2012-12-16 00:58:30 -06:00
brianc
ee36344a26 add test for exported types 2012-10-15 17:47:28 -05:00
brianc
046c4f07c2 ignore connection string test until better parsing is incorporated 2012-07-11 22:44:21 -05:00
burc sahinoglu
3e70c457cc test case for password containing a < or > sign 2012-06-13 12:46:47 -07:00
brianc
aa63f50437 remove custom pool code 2011-08-11 21:30:10 -05:00
brianc
f395ee646f fix failing error handling tests 2011-07-10 13:34:25 -05:00
brianc
94f670590f support for connecting via hostname with native bindings (using node async dns lookup instead of sync libpq dns) 2011-05-05 19:13:43 -05:00
brianc
b18c981a82 remove unused functions of pool 2011-05-01 21:55:31 -05:00
bmc
c0ef5296c6 support for connecting via domain socket 2011-03-01 20:35:14 +00:00
Brian Carlson
f89e9c4bb0 made require statement work with older versions of node 2010-12-14 19:57:26 -06:00
Brian Carlson
ab13d0c1eb initial crack at connection pooling -- still dirty 2010-12-10 17:32:34 -06:00
Brian Carlson
169c6dc3ce Pool object for use in connection pooling 2010-12-09 18:10:42 -06:00
brianc
f9f7e0759d failing test for EventEmitter.once backwards compatibility 2010-10-23 12:42:01 -05:00