42 Commits

Author SHA1 Message Date
Sami Koskimäki
45f5ffbad0 Use wrapIdentifier in columnInfo. fixes #2402 (#2405)
* Make postgres client wrapIdentifierImpl independent of `this` context

 * Also fixes a bug where only single digit indices were accepted.

* add customWrapIdentifier helper for client

 * customWrapIdentifier is one more level of abstraction for the wrapIdentifier "pipeline"
   that allows the custom wrapIdentifier to be called without calling the `wrapIdentifierImpl`

* bufix: use custom wrapIdentifier in columnInfo. fixes #2402
2018-01-03 00:05:48 +02:00
Mikael Lepistö
c0ac1077b6
More pool tests and test on borrow default (#2341)
* Test pool eviction when DB closes connection

* Added couple of tests for how pool works and added testOnBorrow to defaults
2017-11-19 18:43:28 +02:00
Mikael Lepistö
e405d669a6
Fixed passing connection errors directly to the query (#2336)
* Fixed passing connection errors directly to the query

* Added missing use strict and fixed select to be oracle compatible.

* Fixed dialect name which is mixed in different configs

* Oracledb didnt have database config attribute
2017-11-17 21:03:43 +02:00
Mikael Lepistö
9658c78d4f Post processing hook for query result (#2261) 2017-10-12 18:16:15 +03:00
Mikael Lepistö
15639d03db Build native sql for a dialect without to string (#2237)
* Exposed also positionBinding method to client base class and refactored calls to em

* Added toSQL().toNative() getter which returns dialect specfic sql and bindings.

* Refactored toSQL method implementation
2017-09-27 13:12:40 +03:00
Mikael Lepistö
b5d93f10b1 Configuration option to allow override/hook to identifier wrapping code (#2217) 2017-09-08 14:58:59 +03:00
Jonathan Stewmon
9122cbf6df upgrade generic-pool to 3.1.7 (#2208)
* Upgrade generic-pool to v3.1.7 (Attempt)

* Remove callback from pool create function

* Fix ESLint

* Send whole poolConfig to generic-pool (for idleTimeoutMillis etc)

* fix compatibility issues with generic-pool v3
- restore Client.poolDefaults to allow dialect overrides
- connection validators should always resolve with a boolean
- rely on generic pool acquire timeouts to avoid unhandled rejections
- simplify promise usage, avoiding Promise constructor anti-pattern
- enable testOnBorrow in docker tests to evict broken connections
- enable docker tests on Darwin
- enable docker tests for mysql2 dialect

* validate timeout settings and to 60s

* simplify Client.destroy promise handling

* return destroyRawConnection promise from dialects
2017-09-06 22:51:29 +03:00
guanghui
a7639c34af fix incorrect parameter name (#2068) 2017-05-16 13:17:19 +03:00
wubzz
10a6505bec Must always clear the timeout for handling 'acquireConnectionTimeout', even if an error occurs. Fixes #1973 (#1974) 2017-03-15 22:43:37 +01:00
wubzz
a4bfee7751 Ensure that 'client' is provided in knex config object (#1822)
* Ensure that 'client' is provided in knex config object

* sqlite3 columncompiler: Assign 'modifiers' --after-- super() call.

* oracle columncompiler: Assign 'modifiers' --after-- super() call.
2016-12-11 18:23:44 +02:00
Tim Griesser
3a3cad9f88 Fix #1694 2016-10-09 14:33:51 -04:00
Tim Griesser
1413aa057a Add DEBUG=knex:bindings for #1557 2016-09-16 16:04:11 -04:00
Tim Griesser
7069ce509e Revert to generic pool (#1665) 2016-09-13 18:12:23 -04:00
Tim Griesser
53c5984a3b Simplify transaction classes 2016-09-12 18:45:35 -04:00
Tim Griesser
30342c32ae Simplify formatter use 2016-09-12 18:27:30 -04:00
Tim Griesser
ee217ce2a1 Fix PG string escaping behavior (#1661)
* Modify test suite to test #1602
We shouldn’t be testing the “default” client class. Replace any
usages with postgresql

* Simplify knex.raw, deprecate global Knex.raw usage

* Remove unused bluebird shim

* Remove old / unused test comments

* Don't capture Pool2 error event

* Fix pg string escaping & parameterization #1602, #1548
2016-09-12 18:01:47 -04:00
Tim Griesser
6fa485302b Bluebird cleanup (#1618)
* Reference Bluebird directly, Remove deprecated .exec method
* Remove outdated bench scripts
* Remove old .jshintrc file
2016-08-09 17:23:07 -04:00
Byron Wong
d42dba05ce share code for throwing not implemented error 2016-05-27 14:47:12 -07:00
Byron Wong
ea5cbec4e7 Kill queries after timeout for MySQL 2016-05-26 12:00:47 -07:00
Rhys van der Waerden
e7a42abbb2 Merge branch 'master' into feature/eslint
# Conflicts:
#	src/client.js
#	src/dialects/mssql/transaction.js
#	src/dialects/oracle/transaction.js
#	src/runner.js
#	src/transaction.js
2016-05-18 21:30:59 +10:00
Rhys van der Waerden
2acd6e5daa Make spaces in import braces consistent
`import {module}` -> `import { module }`
2016-05-18 20:22:50 +10:00
Rhys van der Waerden
06e3447440 Remove duplicate spaces in assignments.
These were previously horizontally aligned. The esnext conversion disrupted them all.
2016-05-18 19:59:24 +10:00
Rhys van der Waerden
eedd263c8a Merge pull request #1394 from devinivy/acquire-timeout
Abort request for connection from pool upon knex timeout
2016-05-17 10:50:13 +10:00
Rhys van der Waerden
3846b7182c Make codebase conform to ESLint rules
Just a couple of changes.
2016-05-17 01:01:34 +10:00
Mikael Lepistö
9114bdd8b3 Changed implementation of replacing undefined with DEFAULT already in query compiler for every dialect. 2016-05-12 10:24:42 +03:00
Devin Ivy
3d9327a2f4 Abort request for connection from pool upon knex timeout. Closes #1382 2016-05-09 14:02:01 -04:00
wubzz
fa125712da A default ping fn in default pool settings, and silently ignore errors when querying 'ROLLBACK' on a dead connection by using Promise.Timeout. 2016-04-02 16:35:27 +02:00
wubzz
3a925c30e1 Ensure events are triggered on the builder as well as the client. 2016-03-24 19:12:29 +01:00
wubzz
7f4813f59b Changes to Bluebird usage according to 3.0 changelog 2016-03-15 20:52:42 +01:00
wubzz
f37824a11e Fix indentation? 2016-03-15 18:12:36 +01:00
wubzz
1d27fb8550 Update lodash from 3.7.0 -> 4.6.0 2016-03-15 18:11:13 +01:00
wubzz
0a5fa372c9 Fixed indentation, arrow fn in place of bind 2016-01-28 21:15:23 +01:00
wubzz
9c3bf330d9 Add a new event 'query-error' for when an error occurs. 2016-01-28 19:57:26 +01:00
Brian Black
56d808fe0a set SqlString for base client 2015-11-29 18:44:12 -05:00
Brian Black
cee729cad0 Properly escape single quotes in postgres 2015-11-29 18:44:12 -05:00
Brian Black
c6230568cd SqlString is now per-dialect 2015-11-29 18:44:12 -05:00
Mikael Lepistö
30d42ebab9 Replace undefined with DEFAULT by default and NULL with separate configuration option. 2015-11-14 19:46:34 +02:00
Mikael Lepistö
0c74f786a5 Optionally use DEFAULT instead of NULL when translating undefined to SQL value. 2015-11-14 19:46:34 +02:00
Tim Griesser
f54bb0f77e Fixing #823, regression from #822 2015-05-14 00:43:04 -04:00
Tim Griesser
054be46068 Fix #822, pool: {max: 0} should not init pooling 2015-05-13 15:20:01 -04:00
Tim Griesser
521a6f9e97 Remove use strict, assumed in ES6 2015-05-09 14:01:19 -04:00
Tim Griesser
7e884cb325 Babel src -> lib, remove gulp 2015-05-09 13:58:18 -04:00