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
Brian C
7dbc4c9845
Merge pull request #552 from geon/patch-1
...
Added missing argument to handleError method call.
2014-04-03 08:58:48 -05:00
Brian C
fb9876c896
Merge pull request #554 from benesch/remove-dead-types-code-path
...
query: remove dead type-parsing code path
2014-03-31 11:55:59 -05: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
cb7bbe6502
query: remove dead type-parsing code path
...
Type parsing was factored out into the pg-types package. Remove vestigal
`noParse` function.
2014-03-30 19:02:11 -04:00
Nikhil Benesch
5c49a4ab20
benchmark value preparation
2014-03-30 18:57:52 -04:00
Victor Widell
5079c1e0c4
Added missing argument to handleError method call.
...
Before the change, it would crash with a very unhelpful error message:
[project path]/node_modules/pg/lib/query.js:92
connection.sync();
^
TypeError: Cannot call method 'sync' of undefined
at Query.handleError ([project path]/node_modules/pg/lib/query.js:92:16)
at Client.connect ([project path]/node_modules/pg/lib/client.js:178:24)
at g (events.js:185:14)
at EventEmitter.emit (events.js:85:17)
at Socket.<anonymous> ([project path]/node_modules/pg/lib/connection.js:60:10)
at Socket.EventEmitter.emit (events.js:85:17)
at TCP.onread (net.js:424:51)
After the change, it reports a much more helpful
error running query [Error: Stream unexpectedly ended during query execution]
2014-03-29 16:45:00 +01: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
Brian M. Carlson
0f13c8068f
Bump version
2014-03-21 11:47:40 -05:00
Brian M. Carlson
1961125476
Update pg-cursor
...
pg-cursor no longer returns the empty array 'done' signal to the callback
until the cursor recieves a readyForQuery message. This means pg-query-stream
will not emit 'close' or 'end' events until the server is __truly__ ready for
the next query. This fixes some race-conditions where some queries
are triggered off of the `end` event of the query-stream
closes #3
2014-03-21 11:47:32 -05:00
Brian M. Carlson
37de20e826
Bump version
2014-03-21 11:44:59 -05:00
Brian M. Carlson
1a9fd7ff76
Do not callback with final empty array until readyForQuery is received
...
Closes https://github.com/brianc/node-pg-query-stream/issues/3
2014-03-21 11:44:46 -05:00
Sandro Santilli
96e4afdb1b
Have Connection also emit 'end' on stream 'close' event
...
Should fix missing connect callback call with node-0.8 (#534 )
2014-03-18 14:23:05 +01: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
64d6883a81
Ensure connect callback is invoked on premature socket hangup
...
Closes #534
2014-03-18 13:03:15 +01: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 M. Carlson
0a7da37ab7
Bump version
2014-02-26 09:38:25 -06:00
Brian M. Carlson
37de9c2ab0
Rebase code on top of pg-cursor
2014-02-26 09:38:16 -06:00
Brian M. Carlson
b1b39bbd4f
Bump version
2014-02-26 09:30:09 -06:00
Brian M. Carlson
f1dbe7884c
Normalize parameter values
2014-02-26 09:30:00 -06:00
Brian M. Carlson
122bcfb27b
Bump version
2014-02-26 07:16:00 -06:00
Brian M. Carlson
b66be5e934
Add test for stream close & satisfy stream contract
2014-02-26 07:15:01 -06:00
Brian M. Carlson
f8f2a92897
Remove Makefile
2014-02-26 07:11:16 -06:00
Brian M. Carlson
290906294d
Port tests to use mocha
2014-02-26 07:11:16 -06:00
Brian C
0ed940cbfc
Merge pull request #1 from grncdr/patch-1
...
Emit 'close' events when query completes
2014-02-26 07:11:07 -06:00
Brian M. Carlson
cc9f08a042
Bump version
2014-02-26 06:48:35 -06:00
Brian M. Carlson
4925172530
Fix require problem for pg module
...
Closes #3
2014-02-26 06:48:05 -06:00
Brian M. Carlson
a3074e9d54
Bump mocha version
2014-02-26 06:43:22 -06:00
Brian M. Carlson
87c3cf5e5e
Bump version
2014-02-26 06:42:36 -06: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