51 Commits

Author SHA1 Message Date
Malcolm
43ebcfb6bc Fix input preparation for date objects with a BC year (#1864)
* test: BC date input preparation

* Fix input preparation for BC dates
2019-04-15 18:38:20 -05:00
Jan Schär
894e2f2f1e Support Uint8Array values 2017-11-04 14:18:36 -05:00
Sehrope Sarkuni
ef3379a480 Normalize export in utils to use short form 2017-08-30 15:30:36 -05:00
Sehrope Sarkuni
e74c13ddad Centralize password md5 hashing logic
Centralize logic for md5 hashing of passwords for authentication. Adds
a new function postgresMd5PasswordHash(user, password, salt) to utils
and updates client.js and tests to use it.
2017-08-30 15:30:36 -05:00
Vitaly Tomilov
40cc6aa111 Update utils.js
fixing invalid custom type check
2017-07-21 17:02:06 -05:00
Brian M. Carlson
ca4ac9983a Re-implement other patch 2017-07-16 16:39:22 -05:00
Brian C
8798e50ad3 Re-enable eslint with standard format (#1367)
* Work on converting lib to standard

* Finish updating lib

* Finish linting lib

* Format test files

* Add .eslintrc with standard format

* Supply full path to eslint bin

* Move lint command to package.json

* Add eslint as dev dependency
2017-07-15 12:05:58 -05:00
Brian M. Carlson
0f1f8626cf Add use strict to every file 2017-06-18 16:48:14 -05:00
Brian M. Carlson
2300445646 Cleanup a bit of dead code 2017-06-18 16:48:14 -05:00
Brian M. Carlson
1bc1758579 Remove deprecated methods 2017-06-18 16:48:14 -05:00
Brian M. Carlson
cfd9caa925 Deprecate query.on & query.once 2017-06-16 21:43:45 -05:00
T.J. Schuck
e5f0e5d36a s/2016/2017/ (#1291) 2017-05-17 16:47:07 -05: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
5d821c3acb Use more correct escaping for array elements (#1177)
It’s not JSON.
2016-12-10 17:28:48 -06: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
Muhammad Raihan Muhaimin
667953fd5c Proper error message for undefined where options (#1022)
When user provides a knex select statement with an undefined options in where clause it is not properly handled an give an ambiguous error message telling `Unhandled rejection TypeError: Cannot read property 'toString' of undefined.` This PR will helpful to users at it will tell them the exact problem.
2016-06-07 16:04:52 -05:00
Seth Pollack
909c0f1872 add option to parse input Dates as UTC 2016-02-23 17:02:08 -08:00
Michael Nahkies
3a9f5c3500 wrap entry point to prepareValue to only accept 1 arg 2016-01-27 18:08:46 +13:00
Tim Griesser
cd050334ba Removed various unused vars 2014-04-09 08:46:17 -04:00
Tim Griesser
0565ed6c05 Remove legacy .once events shim 2014-04-08 21:29:51 -04: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
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
Eugene Ware
4662d41972 bind Buffer variables as binary values 2013-09-19 01:50:42 +10:00
bmc
10e6d85266 Add support for JSON data type
requires >= 9.2 of postgres
2013-04-22 10:18:17 -05:00
Candid Dauth
694fc3eb6e Fixing code style to make #238 pass jshint 2013-04-11 00:41:15 +02:00
Candid Dauth
bde871707b Storing timezone-less dates in local time instead of UTC
Issue #225 caused such dates to be read, but not stored in local time.
2013-04-10 23:10:44 +02:00
brianc
c57eee8661 normalize whitespace, add comments, and do a little house cleaning 2013-03-06 10:26:40 -06:00
Andrew Dunstan
c5b88dbff2 make indentation and blocking style consistent. 2013-02-22 09:37:29 -05:00
Andrew Dunstan
a3af2a21cf a visit from the jshint police 2013-02-21 17:45:46 -05:00
Andrew Dunstan
44b15422a0 allow passing JS array as a parameter instead of an array literal where SQL expects an array 2013-02-21 17:32:47 -05:00
Philipp Borgers
22d8538879 fix jshint errors for lib/utils.js 2013-01-24 22:03:02 +01:00
bmc
113b6298e2 use ConnectionParameters with native bindings and remove unused util functions 2013-01-22 23:23:47 -06:00
soletan
d55d145378 fixing support for Unix sockets in native binding
Binding natively connections to Unix sockets failed due to DNS lookups applied on pathname to Unix socket's folder.
2013-01-18 23:58:51 +01:00
Stephen Sugden
5dae2b267f Extract query config normalization into utils 2012-12-16 00:58:30 -06:00
Nate Silva
4b88c82b16 enable IPv6 support when using native bindings 2012-11-03 11:40:36 -07:00
brianc
fa80b4e3fa make data conversion the same between native & javascript 2012-07-11 22:47:02 -05:00
brianc
dd84db367b reduce complexity of test runner 2012-05-30 22:12:14 -05:00
brianc
06585d6e2c require 'util' instead of 'sys' 2011-10-10 19:40:52 -05:00
brianc
aa63f50437 remove custom pool code 2011-08-11 21:30:10 -05:00
brianc
94f670590f support for connecting via hostname with native bindings (using node async dns lookup instead of sync libpq dns) 2011-05-05 19:13:43 -05:00
brianc
b18c981a82 remove unused functions of pool 2011-05-01 21:55:31 -05:00
brianc
0b97f699c5 merge master into topic 2011-03-03 18:31:20 +00:00
bmc
c0ef5296c6 support for connecting via domain socket 2011-03-01 20:35:14 +00:00
Brian Carlson
6a2adc1feb more api compat 2011-02-23 19:40:52 -06:00
brianc
4724444e3d move parseConnectionString utility function into utils 2011-02-04 20:06:52 -06:00
Brian Carlson
ab13d0c1eb initial crack at connection pooling -- still dirty 2010-12-10 17:32:34 -06:00
Brian Carlson
169c6dc3ce Pool object for use in connection pooling 2010-12-09 18:10:42 -06:00