simple-oracledb
Advanced tools
Comparing version 1.1.90 to 1.2.1
| Date | Version | Description | | ||
| ----------- | ------- | ----------- | | ||
| 2018-03-20 | v1.1.90 | Maintenance | | ||
| 2018-04-14 | v1.2.1 | Performance improvements for batch operations and pooled connection fetching (#22 and #23) | | ||
| 2017-01-20 | v1.1.57 | connection.run, connection.transaction and oracledb.run actions can now return a promise instead of using a callback | | ||
@@ -5,0 +5,0 @@ | 2017-01-14 | v1.1.56 | pool.run actions now can return a promise instead of using a callback | |
@@ -116,3 +116,4 @@ 'use strict'; | ||
* @param {Number} [poolAttributes.retryInterval=250] - The interval in millies between get connection retry attempts | ||
* @param {Boolean} [poolAttributes.runValidationSQL=true] - True to ensure the connection returned is valid by running a test validation SQL | ||
* @param {Boolean} [poolAttributes.runValidationSQL=true] - True to ensure the connection returned is valid by running a test ping or validation SQL | ||
* @param {Boolean} [poolAttributes.usePingValidation=true] - If runValidationSQL, this flag will define if validation should first attempt to use connection.ping instead of running a SQL | ||
* @param {String} [poolAttributes.validationSQL=SELECT 1 FROM DUAL] - The test SQL to invoke before returning a connection to validate the connection is open | ||
@@ -119,0 +120,0 @@ * @param {AsyncCallback} [callback] - Invoked with an error or the oracle connection pool instance |
@@ -110,2 +110,3 @@ 'use strict'; | ||
* runValidationSQL: true, //True to ensure the connection returned is valid by running a test validation SQL (defaults to true) | ||
* usePingValidation: true, //If runValidationSQL, this flag will define if validation should first attempt to use connection.ping instead of running a SQL | ||
* validationSQL: 'SELECT 1 FROM DUAL', //The test SQL to invoke before returning a connection to validate the connection is open (defaults to 'SELECT 1 FROM DUAL') | ||
@@ -124,2 +125,3 @@ * //any other oracledb pool attributes | ||
* runValidationSQL: true, //True to ensure the connection returned is valid by running a test validation SQL (defaults to true) | ||
* usePingValidation: true, //If runValidationSQL, this flag will define if validation should first attempt to use connection.ping instead of running a SQL | ||
* validationSQL: 'SELECT 1 FROM DUAL', //The test SQL to invoke before returning a connection to validate the connection is open (defaults to 'SELECT 1 FROM DUAL') | ||
@@ -155,3 +157,3 @@ * //any other oracledb pool attributes | ||
} else if (self.poolAttributes.runValidationSQL && self.poolAttributes.validationSQL) { | ||
connection.execute(self.poolAttributes.validationSQL, function onExecuteDone(testError) { | ||
var onPing = function (testError) { | ||
if (testError) { | ||
@@ -170,3 +172,9 @@ debug('Pooled connection validation failed, ', testError.stack); | ||
} | ||
}); | ||
}; | ||
if (self.poolAttributes.usePingValidation && connection.ping && typeof connection.ping === 'function') { | ||
connection.ping(onPing); | ||
} else { | ||
connection.execute(self.poolAttributes.validationSQL, onPing); | ||
} | ||
} else { | ||
@@ -435,2 +443,28 @@ asyncCallback(error, connection); | ||
/** | ||
* Sets the pool attribute defaults. | ||
* | ||
* @function | ||
* @memberof! Pool | ||
* @private | ||
* @param {Object} [poolAttributes] - The connection pool attributes object | ||
* @returns {Object} The modified pool attributes to use for the newly created pool | ||
*/ | ||
function setupPoolAttributes(poolAttributes) { | ||
poolAttributes = poolAttributes || {}; | ||
//set defaults | ||
poolAttributes.retryCount = Math.max(poolAttributes.retryCount || 10, 1); | ||
poolAttributes.retryInterval = poolAttributes.retryInterval || 250; | ||
if (poolAttributes.runValidationSQL === undefined) { | ||
poolAttributes.runValidationSQL = true; | ||
} | ||
if (poolAttributes.usePingValidation === undefined) { | ||
poolAttributes.usePingValidation = true; | ||
} | ||
poolAttributes.validationSQL = poolAttributes.validationSQL || 'SELECT 1 FROM DUAL'; | ||
return poolAttributes; | ||
} | ||
module.exports = { | ||
@@ -447,3 +481,4 @@ /** | ||
* @param {Number} [poolAttributes.retryInterval=250] - The interval in millies between get connection retry attempts | ||
* @param {Boolean} [poolAttributes.runValidationSQL=true] - True to ensure the connection returned is valid by running a test validation SQL | ||
* @param {Boolean} [poolAttributes.runValidationSQL=true] - True to ensure the connection returned is valid by running a test ping or validation SQL | ||
* @param {Boolean} [poolAttributes.usePingValidation=true] - If runValidationSQL, this flag will define if validation should first attempt to use connection.ping instead of running a SQL | ||
* @param {String} [poolAttributes.validationSQL=SELECT 1 FROM DUAL] - The test SQL to invoke before returning a connection to validate the connection is open | ||
@@ -453,11 +488,4 @@ */ | ||
if (pool && (!pool.simplified)) { | ||
pool.poolAttributes = poolAttributes || {}; | ||
//set defaults | ||
pool.poolAttributes.retryCount = Math.max(pool.poolAttributes.retryCount || 10, 1); | ||
pool.poolAttributes.retryInterval = pool.poolAttributes.retryInterval || 250; | ||
if (pool.poolAttributes.runValidationSQL === undefined) { | ||
pool.poolAttributes.runValidationSQL = true; | ||
} | ||
pool.poolAttributes.validationSQL = pool.poolAttributes.validationSQL || 'SELECT 1 FROM DUAL'; | ||
pool.poolAttributes = setupPoolAttributes(poolAttributes); | ||
@@ -464,0 +492,0 @@ var properties = Object.keys(Pool.prototype); |
{ | ||
"name": "simple-oracledb", | ||
"version": "1.1.90", | ||
"version": "1.2.1", | ||
"description": "Extend capabilities of oracledb with simplified API for quicker development.", | ||
@@ -5,0 +5,0 @@ "author": { |
@@ -284,2 +284,3 @@ # simple-oracledb | ||
runValidationSQL: true, //True to ensure the connection returned is valid by running a test validation SQL (defaults to true) | ||
usePingValidation: true, //If runValidationSQL, this flag will define if validation should first attempt to use connection.ping instead of running a SQL | ||
validationSQL: 'SELECT 1 FROM DUAL', //The test SQL to invoke before returning a connection to validate the connection is open (defaults to 'SELECT 1 FROM DUAL') | ||
@@ -298,2 +299,3 @@ //any other oracledb pool attributes | ||
runValidationSQL: true, //True to ensure the connection returned is valid by running a test validation SQL (defaults to true) | ||
usePingValidation: true, //If runValidationSQL, this flag will define if validation should first attempt to use connection.ping instead of running a SQL | ||
validationSQL: 'SELECT 1 FROM DUAL', //The test SQL to invoke before returning a connection to validate the connection is open (defaults to 'SELECT 1 FROM DUAL') | ||
@@ -1149,3 +1151,3 @@ //any other oracledb pool attributes | ||
| ----------- | ------- | ----------- | | ||
| 2018-03-20 | v1.1.90 | Maintenance | | ||
| 2018-04-14 | v1.2.1 | Performance improvements for batch operations and pooled connection fetching (#22 and #23) | | ||
| 2017-01-20 | v1.1.57 | connection.run, connection.transaction and oracledb.run actions can now return a promise instead of using a callback | | ||
@@ -1152,0 +1154,0 @@ | 2017-01-14 | v1.1.56 | pool.run actions now can return a promise instead of using a callback | |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
330226
4270
1198