Skip to content

Commit dc0fabb

Browse files
committed
Pool and error optimizations and standardizations
1 parent aba59f4 commit dc0fabb

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

lib/errors.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ messages.set(ERR_UNSUPPORTED_VERIFIER_TYPE, // NJS-116
355355
messages.set(ERR_INVALID_PRIVATE_KEY, // NJS-117
356356
'invalid private key. Headers and footers are not allowed');
357357
messages.set(ERR_THIN_CONNECTION_ALREADY_CREATED, // NJS-118
358-
'node-oracledb Thick mode cannot be used because a Thin mode connection has already been created');
358+
'node-oracledb Thick mode cannot be enabled because a Thin mode connection has already been created');
359359
messages.set(ERR_UNSUPPORTED_CONVERSION, // NJS-119
360360
'conversion from type %s to type %s is not supported');
361361
messages.set(ERR_FETCH_TYPE_HANDLER_RETURN_VALUE, // NJS-120

lib/oracledb.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,10 @@ async function _verifyOptions(options, inCreatePool) {
373373
outOptions.queueTimeout = options.queueTimeout;
374374
}
375375

376-
// queueMax must be an integer >= 0
376+
// queueMax must be an integer >= -1
377377
if (options.queueMax !== undefined) {
378378
errors.assertParamPropValue(Number.isInteger(options.queueMax) &&
379-
options.queueMax >= 0, 1, "queueMax");
379+
options.queueMax >= -1, 1, "queueMax");
380380
outOptions.queueMax = options.queueMax;
381381
}
382382

test/pool.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,45 @@ describe('2. pool.js', function() {
502502
await pool.close(0);
503503
});
504504

505+
it('2.8.6 queueMax range check, queueMax -1', async function() {
506+
const config = {...dbConfig,
507+
poolMin : 1,
508+
poolMax : 1,
509+
poolIncrement : 0,
510+
queueMax : -1
511+
};
512+
const pool = await oracledb.createPool(config);
513+
const conn = await pool.getConnection();
514+
await conn.close();
515+
await pool.close(0);
516+
});
517+
518+
it('2.8.7 queueMax range check, queueMax -2 out of range', async function() {
519+
const config = {...dbConfig,
520+
poolMin : 1,
521+
poolMax : 1,
522+
poolIncrement : 0,
523+
queueMax : -2
524+
};
525+
await assert.rejects(
526+
async () => await oracledb.createPool(config),
527+
/NJS-007:/
528+
);
529+
});
530+
531+
it('2.8.8 queueMax range check, queueMax -0.5 not an integer', async function() {
532+
const config = {...dbConfig,
533+
poolMin : 1,
534+
poolMax : 1,
535+
poolIncrement : 0,
536+
queueMax : -1.5
537+
};
538+
await assert.rejects(
539+
async () => await oracledb.createPool(config),
540+
/NJS-007:/
541+
);
542+
});
543+
505544
});
506545

507546
describe('2.9 _enableStats & _logStats functionality', function() {

0 commit comments

Comments
 (0)