Accept an sql object as an input parameter for connection.execute() (Issue #1629)

This commit is contained in:
Sharad Chandran R 2024-02-05 15:36:47 +05:30
parent cb47c0658e
commit 86ce4d4ef7
2 changed files with 30 additions and 10 deletions

View File

@ -13,6 +13,13 @@ node-oracledb `v6.4.0 <https://github.com/oracle/node-oracledb/compare/v6.3.0...
Common Changes
++++++++++++++
#) Accept an object as an input parameter for :meth:`connection.execute()`
as per GitHub user request.
See `Issue #1629 <https://github.com/oracle/node-oracledb/issues/1629>`__.
This object is returned from the 3rd party ``sql-template-tag`` module and
exposes statement and values properties to retrieve sql string
and bind values.
#) Added new extended :ref:`metadata <execmetadata>` information attribute
``isOson`` for a fetched column.
@ -44,14 +51,16 @@ Thin Mode Changes
unless the number of batch errors is a multiple of 65536; instead,
the number of batch errors returned is modulo 65536.
#) Updated pool functionality to scan and remove idle connections from
beginning of free connection list. This will ensure removal of all idle
connections present in free connection list.
#) Updated connection pool to scan and remove idle connections from
the beginning of the free connection list. This will ensure removal of all
idle connections present in the free connection list.
`Issue #1633 <https://github.com/oracle/node-oracledb/issues/1633>`__.
Thick Mode Changes
++++++++++++++++++
#) Internal code and memory optimization changes for Advanced Queuing.
node-oracledb `v6.3.0 <https://github.com/oracle/node-oracledb/compare/v6.2.0...v6.3.0>`__ (21 Dec 2023)
--------------------------------------------------------------------------------------------------------

View File

@ -847,13 +847,24 @@ class Connection extends EventEmitter {
let options = {};
// process arguments
errors.assertArgCount(arguments, 1, 3);
errors.assertParamValue(typeof sql === 'string', 1);
if (arguments.length >= 2) {
binds = await this._processExecuteBinds(a2);
}
if (arguments.length == 3) {
options = this._verifyExecOpts(a3, false);
if (nodbUtil.isObject(sql) && typeof sql.statement === 'string') {
errors.assertArgCount(arguments, 1, 2);
if (sql.values) {
binds = await this._processExecuteBinds(sql.values);
}
sql = sql.statement;
if (arguments.length == 2) {
options = this._verifyExecOpts(a2, false);
}
} else {
errors.assertArgCount(arguments, 1, 3);
errors.assertParamValue(typeof sql === 'string', 1);
if (arguments.length >= 2) {
binds = await this._processExecuteBinds(a2);
}
if (arguments.length == 3) {
options = this._verifyExecOpts(a3, false);
}
}
this._addDefaultsToExecOpts(options);
errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);