Commit Graph

536 Commits

Author SHA1 Message Date
Brian M. Carlson
357b64d704 Remove query emit 'end' event when query has error
Closes #547
2014-04-06 11:53:47 -05:00
Brian C
f3fc6ff705 Merge pull request #546 from CartoDB/2.11-ensure-connect-callback
Ensure connect callback is invoked on premature socket hangup
2014-04-06 11:18:23 -05:00
Sandro Santilli
e72aff4cfb Have stream emit 'close' rather than 'end' for sake of testing 2014-04-04 16:11:44 +02:00
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
Sandro Santilli
d21b995726 Enable the test for #534 (needs special naming)
This time, I hope, travis will confirm that the fix works with
node-0.10 but not with node-0.8
2014-03-18 13:36:57 +01:00
Sandro Santilli
e19235838d Add unit test for callback on early postgresql disconnect
Test adapted by that provided by Jess Sheneberger in #534
2014-03-18 13:19:07 +01:00
Sandro Santilli
7f4351293c Do not assume PGPORT env variable is unset during testing 2014-03-18 10:06:15 +01:00
Brian M. Carlson
779c8064f2 Add domain support to connection pool 2014-03-15 16:41:33 -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 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 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
Michael Payne
b81a60a260 Parse date type as local time 2014-01-26 10:43:15 -05: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
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
Hannes Hörl
5c5c57e60b Fixes bug in test for extended years 2013-12-23 02:13:10 +01:00
Hannes Hörl
9ad0159037 merge with upstream 2013-12-22 23:21:42 +01:00
Aurélio A. Heckert
c0fd4b1431 Set database on socket string connection
Allows to conect to a specific database trough this ways:
pg.connect('/some/path database', callback);
pg.connect('socket:/some/path?db=database', callback)
pg.connect('socket:/some/path?db=database&encoding=utf8', callback)
2013-12-19 15:37:26 -03:00
Brian C
f58ff731ce Merge pull request #477 from rvagg/nan
use NAN for Node 0.8->0.11+ compatibility
2013-12-12 16:19:03 -08:00
Hannes Hörl
61f8f55d43 Handle .pgpass in the native client 2013-12-11 01:24:55 +01:00
Michael Payne
e6a2525540 Test for date range extremes 2013-12-09 23:35:46 -05:00
Rod Vagg
6cb167112e convert to NAN for Node 0.8->0.11+ support 2013-12-06 15:30:28 +11:00
Hannes Hörl
95295ad2fb Handle .pgpass in the js client 2013-12-06 00:01:51 +01:00
Brian Carlson
c6a235fb5d Fix race condition in test 2013-10-02 22:39:31 -05:00
Eugene Ware
4662d41972 bind Buffer variables as binary values 2013-09-19 01:50:42 +10:00
Brian Carlson
1674359b57 Respect SSL setting from connection parameters 2013-09-09 11:50:20 -05:00
brianc
bfdea752b2 Respect PGSSLMODE for setting SSL connection 2013-09-05 16:51:16 -05:00
Brian Carlson
a2d0ab286a Do not run tests for binary mode 2013-09-01 22:03:49 -05:00
Brian Carlson
fb499e4b3d Fix incorrect failing date test 2013-09-01 21:59:33 -05:00
Brian Carlson
5c233896f1 Add failing early date tests 2013-09-01 21:59:01 -05:00
shine-on
82843153a5 down is used but isn't set
https://github.com/brianc/node-postgres/blob/master/script/create-test-tables.js#L41
2013-08-31 12:23:17 +03:00
Brian Carlson
e744d05df7 Add ability to opt-in to int8 parsing
Switching the result of all COUNT operations to a string is
a pretty nasty breaking change, and the majority of us aren't
going to be hitting numbers larger than Number.MAX_VALUE
2013-08-29 00:04:27 -05:00
Brian Carlson
4cdd7a116b Compile result parsing for a 60% speed increase
Tested against a 1000 row result set.  Need to test against
smaller result sets & figure out a way to make this backwards compatible if possible
2013-08-07 15:33:57 -05:00
Brian Carlson
fb5520bb8a Remove built-in binary int64 parser 2013-07-30 13:15:31 -05:00
Brian Carlson
343caefb75 Fix race in error handling test 2013-07-23 09:51:48 -05:00
Maciek Sakrejda
816e9b43ea Use the standard postgres:// URL prefix for consistency
Fixes #286.
2013-07-22 10:45:26 -07:00
rpedela
539d3bae54 Move string escaping tests to proper locations. 2013-07-15 09:13:48 -05:00
rpedela
b5e89b2b9a Add native and JS tests for escapeLiteral and escapeIdentifier. 2013-07-15 09:13:48 -05:00