Commit Graph

71 Commits

Author SHA1 Message Date
Raul Marin
b5be2ee38c Remove deprecation warnings 2018-05-23 18:04:20 +02:00
Brian Carlson
e4469340ae Fix deprecation warnings in native driver 2017-06-20 09:28:44 -05:00
Brian M. Carlson
b5b49eb895 Add deprecations
This adds deprecations in preparation for `pg@7.0`

- deprecate using event emitters on automatically created results from client.query.
- deprecate query.promise() - it should never have been a public method and it's not documented. I need to do better about using _ prefix on private methods in the future.
- deprecate singleton pool on the `pg` object. `pg.connect`, `pg.end`, and `pg.cancel`.
2017-06-19 16:00:37 -05:00
T.J. Schuck
e5f0e5d36a s/2016/2017/ (#1291) 2017-05-17 16:47:07 -05:00
Brian C
b1b2801c71 Add onFailure to query#then (#1082)
The promise adapter I had implemented wasn't spec compliant: it didn't accept both `onSuccess` and `onFailure` in the call to `query#then`.  This subtly broke yield & async/await because they both rely on `onError` being passed into `Promise#then`.  The pool was also not returning the promise after a client was acquired, which broke awaiting on `pool.connect` - this is also fixed now.
2016-07-19 10:16:48 -05:00
Illirik Smirnov
522d62229b Resolve merge conflict in PR #1041 (#1065)
* Add license comment

* Delete pool.js
2016-06-24 10:56:43 -05:00
Brian C
2fd9c77085 Make Query & NativeQuery implement the promise interface (#1047)
* Make Query & NativeQuery implement the promise interface

* Fix test

* Use older node API for checking listener length

* Do not test for promises on node@v0.10.0
2016-06-10 17:18:19 -05:00
Frederick Stark
b78a508420 Add function stub to native result to solve broken test 2016-02-12 13:38:38 +11:00
Joost Farla
f50f5ce7e8 Require statements break Browserify compatibility 2015-10-10 11:10:51 +02:00
brianc
17f14f4e58 Add warning for native bindings 2015-06-07 10:20:48 -04:00
Mayhem
37956e22c5 Fix result.rowCount being a string instead of a number via native bindings.
Fixes #708
2015-02-21 17:32:39 +01:00
David H. Bronke
4bfdc041ef Moved type override code into a new class. 2014-12-03 11:00:27 -06:00
David H. Bronke
a0bf25e308 Implemented per-client type parser overrides.
Adds Client#getTypeParser() and Client#setTypeParser().
2014-12-03 10:38:57 -06:00
Brian M. Carlson
06b0392a57 Update travis config 2014-11-18 11:51:40 -05:00
Brian M. Carlson
35596fdbdc Upgrade version of pg-native 2014-11-18 09:32:16 -05:00
Brian M. Carlson
21f6dbe006 Break native result into its own file 2014-10-18 00:27:28 -04:00
Brian M. Carlson
5dff31387c Remove dead file 2014-10-18 00:21:39 -04:00
Brian M. Carlson
c3513a27fa Make native bindings an optional install 2014-10-18 00:20:18 -04:00
Brian M. Carlson
89d0938655 Subscribe to notification before emitting connected
Fixes a case where you connect & immediatley disconnect and _sometimes_ your notification subscription starts the reader on the libpq instance after the libpq instance is disconnected.  This segfaults the app.
2014-10-17 23:09:55 -04:00
Brian M. Carlson
4c5f3aba65 Add support for native rowMode: array
This completes the port from the old native bindings to the new node-pg-native bindings!

Time to build in support for older versions of postgres & start the pull request process.
2014-10-11 14:09:29 -04:00
Brian M. Carlson
613112ca33 Upgrade to pg-native 1.2.0 to support rowMode:array 2014-10-09 21:54:34 -04:00
Brian M. Carlson
3867851341 Make cancel query tests pass 2014-10-09 21:12:17 -04:00
Brian M. Carlson
c5d4207aac Fix a few more failing tests 2014-09-23 18:57:20 -04:00
Brian M. Carlson
d2bb532d73 Make moar tests pass 2014-09-14 21:11:51 -04:00
Brian M. Carlson
667c528ea6 Work towards more tests passing 2014-09-14 01:23:02 -04:00
Brian M. Carlson
b325971fdf Make more tests pass 2014-09-13 22:37:30 -04:00
Brian M. Carlson
9a68682109 First tests passing for new native bindings 2014-09-13 12:32:53 -04:00
Philipp Borgers
fa3b1ccc5b remove pause/resumeDrain functions from native code as disccued in issue #515 2014-04-16 19:10:49 +02:00
Brian M. Carlson
9c87253aff Fix memory leak with domains 2014-04-12 00:29:44 -05:00
Brian M. Carlson
bd74d48791 Fix query error emit on native bindings 2014-04-06 12:55:26 -05:00
Brian M. Carlson
876abe8730 Break type parsing into separate module 2014-03-15 15:36:27 -05:00
rpedela
cd4565ba1f #181 #366 Add support for single row mode in Postgres 9.2+. This will enable single row mode only when the user wants to stream rows. 2013-09-04 11:46:07 -06:00
rpedela
cf07a4f2b4 #403 Only use native escape functions if PG version >= 9.0.0. Otherwise use the JS functions. 2013-07-29 15:45:36 -06:00
Brian Carlson
145666c1b3 Support result rows as arrays 2013-07-08 17:45:06 -05:00
Brian Carlson
413eff72e5 Move row parsing into result object 2013-07-08 09:30:10 -05:00
Brian Carlson
3f96bbbc5c Add field metadata to query result object
Refactored the way rows are built in the native bindings which should
result in a small performance improvement
2013-07-08 09:19:30 -05:00
Brian Carlson
05e9026aea Remove tab character 2013-07-08 08:16:10 -05:00
Andrey Popp
4458e69285 call EventEmmiter constructor on native Connection
this allows to preserve an active domain on switches in libpq
2013-05-20 18:31:55 +04:00
bmc
56a5903a02 Make throws in query error callback not break client
If you receive an error while running a query and in user's callback
they throw an exception it can disrupt the internal query queue
and prevent a client from ever cleaning up properly
2013-04-19 09:25:53 -05:00
bmc
9b1c4facc2 Make query callback exceptions not break client
If you throw an exception in a query callback the client will not pulse
its internal query queue and therefor will never process any
more queries or emit its own 'drain' event.

I don't find this to be an issue in production code since I restart
the process on exceptions, but it can break tests and cause things
to 'hang'.  My crude benchmarks show no noticable impact in perf
from the try/catch/rethrow.

:q
2013-04-19 09:09:28 -05:00
brianc
683d636501 better handling of client stream termination
1. Pass an error to an active query if the client is ended while a query is in progress.
2. actually emit 'end' event on the client when the stream ends
3. do not emit an error from native bindings if lasterror is null
2013-03-28 13:24:33 -05:00
brianc
c57eee8661 normalize whitespace, add comments, and do a little house cleaning 2013-03-06 10:26:40 -06:00
brianc
37bb13fc0c move type conversion related code under sub-folder 2013-03-06 08:57:38 -06:00
brianc
b58ae9e7f7 clean up prototype shorthand
For some reason a few years ago I thought it would be neat to use a shorthand version of prototype to save myself some keystrokes.  That was a cosmetic mistake.  It also breaks ctags.

Also, normalized some whitespace.
2013-03-06 08:48:52 -06:00
Philipp Borgers
bed3de9490 fix jshint erros 2013-01-24 22:03:03 +01:00
Philipp Borgers
0c3e1cba83 fix jshint errors in lib/native/query.js 2013-01-24 22:03:03 +01:00
Philipp Borgers
60a022b0b0 fix jshint errors for lib/native/index.js 2013-01-24 21:59:28 +01:00
Philipp Borgers
2cc91225e3 fix jshint errors for lib/native/query.js 2013-01-24 21:59:28 +01:00
bmc
113b6298e2 use ConnectionParameters with native bindings and remove unused util functions 2013-01-22 23:23:47 -06:00
anton
88d684f925 bugfix. sometimes native copy to loose rows 2013-01-20 19:45:41 -06:00