2255 Commits

Author SHA1 Message Date
Ryan Hamilton
549404e21e Update README.md (#1247)
grammar fix
2017-03-20 12:00:57 -05:00
Brian M. Carlson
4fae7a9a7f Bump version v6.1.4 2017-03-09 15:06:29 -06:00
Linus Unnebäck
ce8f215c88 Fix throw in type parsers when in prepared statement (#1242) 2017-03-09 15:05:26 -06:00
Shakeel Mohamed
2aed8bf7b3 Add syntax highlighting to code block in README (#42) 2017-03-06 11:47:30 -06:00
Brian Carlson
ff5ceb4304 Bump version v6.1.3 2017-03-06 11:06:08 -06:00
Linus Unnebäck
5cb38f5892 Handle throws in type parsers (#1218)
* Handle throws in type parsers

* Fix throw in type parsers test for Node 0.x
2017-03-06 11:04:16 -06:00
Arnaud Benhamdine
2a46c8a3d4 Add node LTS and current versions to travis matrix 2017-03-01 15:11:40 +01:00
Charmander
41017814d3 Avoid infinite loop on malformed message (#1208)
* Avoid infinite loop on malformed message

If handling of such messages is deemed unimportant, `indexOf` is still faster (~40%) and cleaner than a manual loop.

Addresses #1048 to an extent.

* Use indexOf fallback for Node ≤0.12
2017-02-21 11:19:03 -06:00
Charmander
5b6d883723 Remove broken tests with external dependency (#1209)
Yikes.
2017-02-12 22:23:09 -06:00
Patai Adam
6e63f0e217 Update readme (#1210)
* Fix sample code in README

* Fix typo
2017-02-12 22:20:41 -06:00
Alexander Mochalin
f6c40b9331 parse int8[] (#1152)
* parse int8[]

* missing semicolon

* test

* test fixed

* test fixed

* test fixed. again.
2016-12-16 09:44:19 -06:00
Brian Carlson
2c636c750f Bump version v6.1.2 2016-12-13 11:53:57 -06:00
Brian C
7f35240a5c Fix for utf-8 characters in md5 passwords (#1183)
This is the same fix as supplied in 1178 but includes a test.

Closes #1178
2016-12-13 11:51:36 -06:00
Charmander
981960b445 Remove confusing conditions (#1159)
* Remove unreachable code

* Remove redundant condition

Every path with `!this.values` results in `false` regardless of `this.binary`.
2016-12-13 07:50:07 -06:00
Charmander
48a9738a0b Run inbound parser tests (#1182)
They were disabled by 4cdd7a116bab03c6096ab1af8f0f522b04993768 without comment; it seems that this might have been unintentional?

In any case, they should probably be enabled, updated, or removed.
2016-12-13 07:36:13 -06:00
Brian Carlson
c4879e321d Bump version v6.1.1 2016-12-10 18:58:27 -06:00
Brian Carlson
5feacd66d0 Remove redundant test
This functionality is already tested in the node-pg-types repo.
2016-12-10 18:17:09 -06:00
Charmander
5d821c3acb Use more correct escaping for array elements (#1177)
It’s not JSON.
2016-12-10 17:28:48 -06:00
Charmander
27bee1d0bc Fix CI (#1179)
* Use container-based CI

* Remove unnecessary CI configuration

* Use Node 6/PostgreSQL 9.6 as default test

… rather than testing 0.10 twice with unspecified PostgreSQL.

* Use `precise` for PostgreSQL 9.1

According to https://docs.travis-ci.com/user/database-setup/, 9.1 isn’t supported on trusty.

* Fix Node 0.10 and 0.12 CI builds

These binaries appear to have been built using g++ with flags that clang doesn’t support. Or something.
2016-12-10 17:16:51 -06:00
Cris Vergara
af84d5cd4b Fix require for webpack compatibility 2016-12-05 17:18:25 -05:00
Brian Carlson
ab70f57923 Bump version 2016-12-04 17:27:10 -06:00
Charmander
fd802a385c Don’t create promises when callbacks are provided (#31)
* Revert "When connection fail, emit the error. (#28)"

This reverts commit 6a7edabc22e36db7386c97ee93f08f957364f37d.

The callback passed to `Pool.prototype.connect` should be responsible for handling connection errors. The `error` event is documented to be:

> Emitted whenever an idle client in the pool encounters an error.

This isn’t the case of an idle client in the pool; it never makes it into the pool.

It also breaks tests on pg’s master because of nonspecific dependencies.

* Don’t create promises when callbacks are provided

It’s incorrect to do so. One consequence is that a rejected promise will be unhandled, which is currently annoying, but also dangerous in the future:

> DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

The way callbacks are used currently also causes #24 (hiding of errors thrown synchronously from the callback). One fix for that would be to call them asynchronously from inside the `new Promise()` executor:

    process.nextTick(cb, error);

I don’t think it’s worth implementing, though, since it would still be backwards-incompatible – just less obvious about it.

Also fixes a bug where the `Pool.prototype.connect` callback would be called twice if there was an error.

* Use Node-0.10-compatible `process.nextTick`
2016-12-04 17:20:24 -06:00
Brian M. Carlson
fbdfc15b89 Bump version 2016-09-13 21:29:56 -05:00
Yanlong Wang
6a7edabc22 When connection fail, emit the error. (#28)
* When connection fail, emit the error.

If client connect failed, emit the connection error  rather than swallowing it.

* Add test for connection error.
2016-09-13 21:26:03 -05:00
Bill Butler
83a946f61c Might be nice to have the host in the example (#1118) 2016-08-29 08:57:57 -05:00
Brian M. Carlson
cf28f9357f Bump version 2016-08-26 09:11:18 -05:00
jphaas
b091cc0d05 Bug fix: Pool.query now calls cb if connect() fails (#25)
* Pool.query calls cb if connect() fails

Old behavior was that if connect called back with an error, the promise would get rejected but the cb function would never get called.

* Test that Pool.query passes connection errors to callback

* Fixes to standardjs compliance
2016-08-26 09:08:15 -05:00
Brian M. Carlson
f2221a4040 Bump version 2016-08-26 09:07:54 -05:00
Brian M. Carlson
afce7ed6e3 Bump version 2016-08-26 09:05:46 -05:00
Vitaly Tomilov
ec941c45c1 Upgrading tests to PostgreSQL 9.5 (#1114)
Setting PostgreSQL 9.5 as the main version to test against.

NOTE: The following settings are required for 9.5 to work:
```
sudo: required
dist: trusty
```
2016-08-22 22:35:41 -05:00
brianc
42689dac11 Bump version v6.1.0 2016-08-11 10:18:19 -05:00
brianc
4251a09b0b Update changelog 2016-08-11 10:18:12 -05:00
Brian C
a536afb1a8 Add callback to client#end (#1106)
A long standing bug was the pure JS client didn't accept or call a callback on `client.end`.  This is inconsistent with both the documentation & general node patterns.

This fixes the issue & adds a test.  The issue did not exist in the native version of the client.
2016-08-11 10:17:03 -05:00
brianc
a95d9ac711 Bump version v6.0.4 2016-08-10 15:15:43 -05:00
hoegaarden
f857bbf623 pgpass: Upgrade to 1.x (#1098)
pgpass is using semver versioning now, thus a dependency on
version 1.x should be safe.
2016-08-10 15:15:09 -05:00
brianc
9964208fe8 Bump version 2016-08-05 16:23:05 -05:00
Cody Greene
eca2ea0ede emit "connect" event only on success and avoid double callback (#22)
* fail: "connect" event only on success

Double callback invocation will also cause this to fail.

* avoid double callback: _create

If `client.connect` returns an error, then the callback for `Pool#_create` is only invoked once. Also the `connect` event is only emitted on a successful connection, the client is otherwise rather useless.

* legacy compat; don't use Object.assign

* legacy compat; events.EventEmitter
2016-08-05 16:22:50 -05:00
Cody Greene
51fb7db8fa Support function-like construction (plus test) (#23)
* Support function-like construction

Remove the necessity of using `new` in front of the `Pool`, i.e. allow it to be used as a regular function. This is following https://github.com/brianc/node-postgres/issues/1077

* add Pool factory test
2016-08-05 16:21:51 -05:00
Arnaud Benhamdine
9f955c4348 Add details about differences between js and native bindings (#1096) 2016-08-02 09:21:31 -05:00
Vince Coppola
4e77464bfc Small spelling fix (#1099) 2016-08-01 09:24:54 -05:00
Risto Novik
1d89029ba7 Added missing new keyword to Heroku example. (#21) 2016-07-26 10:18:14 -05:00
Arnaud Benhamdine
74db8f9cd2 Add badges for npm version and number of dl on npm (#1094) 2016-07-26 09:32:12 -05:00
brianc
9274f08fa2 Bump version v6.0.3 2016-07-19 10:18:56 -05:00
brianc
892d02ca1c Fix typo 2016-07-19 10:17:40 -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
Timothy Haley
e2d77719e7 Url parsing example (#19)
* Added URL parsing example

* Typos and cleanup

* Last typo
2016-07-18 15:54:57 -05:00
Brian C
1dc1dbc5b6 Update README.md
Move SSL connection information to wiki
2016-07-10 16:29:42 -05:00
brianc
bd7fc59635 Bump version v6.0.2 2016-07-10 16:29:04 -05:00
guoxiangyang
33a1c35ad2 changed for self signed ssl support (#1072) 2016-07-10 16:26:36 -05:00
brianc
8c42c4172b Bump version 2016-07-03 16:17:55 -07:00