Commit Graph

1279 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
364cf4b3ca utils: convert tabs to spaces 2014-03-30 19:11:02 -04:00
Nikhil Benesch
7faa2b325e utils: reorganize prepareValue conditional for clarity
Prefer positive tests; group tests for specific objects.
2014-03-30 19:03:28 -04:00
Nikhil Benesch
b778f2bdf0 utils-tests: add unit tests for prepareValue 2014-03-30 19:03:24 -04:00
Nikhil Benesch
5c49a4ab20 benchmark value preparation 2014-03-30 18:57:52 -04:00
Brian C
b12dd4c420 Merge pull request #543 from CartoDB/2.11-remove-ended-connections
Remove disconnected clients from the pool
2014-03-22 10:47:53 -05:00
Brian C
f15a027e4e Merge pull request #545 from CartoDB/master-do-not-assume-pgport
Do not assume PGPORT env variable is unset during testing
2014-03-22 10:46:12 -05:00
Sandro Santilli
7f4351293c Do not assume PGPORT env variable is unset during testing 2014-03-18 10:06:15 +01:00
Sandro Santilli
fb118cf069 Avoid loop between pool.destroy and client.end 2014-03-18 09:42:19 +01:00
Sandro Santilli
9c5cd8d02d Remove disconnected clients from the pool
Might fix #458
Fixes https://github.com/CartoDB/CartoDB-SQL-API/issues/135
2014-03-17 18:51:32 +01:00
Brian M. Carlson
128f9c071c Add npm script to generate changelog 2014-03-16 21:50:17 -05:00
Brian C
9103f80b22 Merge pull request #524 from lalitkapoor/changelog
Create changelog based on pull requests
2014-03-16 21:48:15 -05:00
Brian C
84a3f32ce7 Merge pull request #531 from brianc/domains
domain aware connection pool
2014-03-15 16:49:29 -05:00
Brian M. Carlson
ecbc61c2bc Fix async version for older nodes 2014-03-15 16:46:57 -05:00
Brian M. Carlson
779c8064f2 Add domain support to connection pool 2014-03-15 16:41:33 -05:00
Brian C
def663d848 Merge pull request #541 from brianc/pg-types
Break type parsing into separate module
2014-03-15 15:56:16 -05: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
Brian C
e8e16f866f Update README.md
Reorder example section to highlight the connection pooling as this is typically what web application developers should be using.
2014-03-14 09:57:37 -05:00
Brian C
8d44a39063 Merge pull request #536 from brianc/packet-reader
This moves the packet reading and chunking into a separate module
2014-03-14 08:37:12 -05:00
Brian M. Carlson
79f03948dd Use packet reader 2014-03-14 06:59:19 -05:00
Brian M. Carlson
f63476b7b8 Adjust test to ensure DATE data-type is converted to local time 2014-03-14 06:37:00 -05:00
Brian C
2716f95257 Merge pull request #514 from benighted/parse-date-as-local
Parse date type as local time
2014-02-26 06:16:12 -06:00
Brian C
ff8fb616f6 Merge pull request #501 from lalitkapoor/GH-452
improve support for int arrays and float arrays
2014-02-26 06:15:35 -06:00
Brian C
be37756607 Merge pull request #395 from aaronyo/master
Unable to reconnect after calling pg.end()
2014-02-26 06:12:57 -06:00
Brian M. Carlson
bf0c4bfaa9 Merge branch 'pull/326'
Conflicts:
	lib/connection-parameters.js
	test/unit/connection-parameters/creation-tests.js
2014-02-26 06:10:15 -06:00
Lalit Kapoor
421561d2e4 initial changelog 2014-02-20 13:04:28 -05:00
Brian C
3bd5e699ce Merge pull request #521 from prust/patch-1
Add SQL-Bricks to list of SQL helpers
2014-02-13 16:13:22 -06:00
Peter Rust
c9af470e24 Added SQL-Bricks to list of SQL helpers 2014-02-13 13:19:27 -08:00
Michael Payne
b81a60a260 Parse date type as local time 2014-01-26 10:43:15 -05:00
Brian M. Carlson
51a28c2265 Bump version 2014-01-22 08:43:16 -06:00
Brian C
62f6b2fbf9 Merge pull request #507 from brianc/issues/507
Unexpected identifier with pg versions > 2.3.1
2014-01-22 06:42:59 -08:00
Brian M. Carlson
5f592a1240 Fix exception caused by column names with single quotes
Also rename some test files so they match the Makefile regex.  They will be included in the test suite from now on.
2014-01-22 08:38:29 -06:00
Lalit Kapoor
f1c0abab75 test array/float8 2014-01-08 01:00:03 -06:00
Lalit Kapoor
9bd88f8449 test array/float4 2014-01-08 00:14:42 -06:00
Lalit Kapoor
eee21dd088 test array/int8 2014-01-08 00:13:52 -06:00
Lalit Kapoor
6410a8aca2 test array/int4 2014-01-08 00:13:16 -06:00
Lalit Kapoor
0939490033 test array/int2 2014-01-08 00:12:31 -06:00
Lalit Kapoor
8f4644dc3d parse values in float arrays as floats not strings
javascript numbers are 64-bit floating numbers
2014-01-08 00:09:34 -06:00
Lalit Kapoor
3cb35e0f46 big integer array support 2014-01-08 00:08:57 -06:00
Brian C
07a12c0948 Merge pull request #500 from lalitkapoor/patch-1
comment explaining how to get oid for a type
2014-01-07 10:55:00 -08:00
Lalit Kapoor
58b4d9cf9c comment explaining how to get oid 2014-01-07 11:48:55 -06:00
Brian M. Carlson
8abf59a632 Bump version 2014-01-06 08:11:29 -06:00
Brian M. Carlson
ba16118268 Update NEWS 2014-01-06 08:11:22 -06:00
Brian C
22d5adb335 Merge pull request #497 from hoegaarden/application_name
application_name
2014-01-06 06:09:50 -08:00
Hannes Hörl
4f00e5ab1a typo 2014-01-05 18:29:30 +01:00
Hannes Hörl
caffda67f2 change test to work on travis 2014-01-05 18:26:42 +01:00
Hannes Hörl
7fd79a41c3 Add support for (fallback_)application_name 2014-01-05 18:08:58 +01:00