Skip to content

Commit af78f2e

Browse files
committed
Added support for usage with extension of Array.prototype methods(Issue #1653)
1 parent 51e688a commit af78f2e

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ Thin Mode Changes
4444
#) Added support for Oracle Database 23c
4545
:ref:`Implicit Connection Pooling <implicitpool>` in DRCP and PRCP.
4646

47+
#) Added support for usage with extension of Array.prototype methods
48+
See `Issue #1653 <https://github.com/oracle/node-oracledb/issues/1653>`__.
49+
4750
Thick Mode Changes
4851
+++++++++++++++++++
4952

lib/connection.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -927,8 +927,8 @@ class Connection extends EventEmitter {
927927

928928
// process output binds
929929
if (result.outBinds !== undefined) {
930-
for (const key in result.outBinds) {
931-
const val = this._transformOutBind(result.outBinds[key], options);
930+
for (const [key, value] of Object.entries(result.outBinds)) {
931+
const val = this._transformOutBind(value, options);
932932
result.outBinds[key] = val;
933933
}
934934
}
@@ -937,10 +937,9 @@ class Connection extends EventEmitter {
937937
// array size fixed, or, if a result set is not requested, that all rows
938938
// are fetched
939939
if (result.implicitResults) {
940-
for (const key in result.implicitResults) {
941-
const resultSetImpl = result.implicitResults[key];
940+
for (const [key, impl] of Object.entries(result.implicitResults)) {
942941
const resultSet = new ResultSet();
943-
resultSet._setup(this, resultSetImpl);
942+
resultSet._setup(this, impl);
944943
if (options.resultSet) {
945944
result.implicitResults[key] = resultSet;
946945
} else {
@@ -996,8 +995,8 @@ class Connection extends EventEmitter {
996995
if (result.outBinds !== undefined) {
997996
for (let i = 0; i < result.outBinds.length; i++) {
998997
const outBind = result.outBinds[i];
999-
for (const key in outBind) {
1000-
outBind[key] = this._transformOutBind(outBind[key], options);
998+
for (const [key, value] of Object.entries(outBind)) {
999+
outBind[key] = this._transformOutBind(value, options);
10011000
}
10021001
}
10031002
}

lib/thin/sqlnet/ezConnectResolver.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,17 @@ class EZConnectResolver {
214214
let naddr = 0;
215215
// ; groups the user into a ADDRESS_LIST
216216
const addressLists = hostInfo.split(";");
217-
for (const addressList in addressLists) {
217+
for (const addressList of addressLists) {
218218
let addressNodeCount = 0;
219219
const addressListBuilder = new Array();
220-
for (const match of addressLists[addressList].matchAll(HOSTNAMES_PATTERN)) {
220+
for (const match of addressList.matchAll(HOSTNAMES_PATTERN)) {
221221
const hostnames = (match.groups.hostnames).split(',');
222222
let port = match.groups.port;
223223
if (port == null) {
224224
port = '1521'; //default port
225225
}
226-
for (const hname in hostnames) {
227-
addressListBuilder.push(this.getAddrStr(hostnames[hname], port, protocol, proxyInfo));
226+
for (const hname of hostnames) {
227+
addressListBuilder.push(this.getAddrStr(hname, port, protocol, proxyInfo));
228228
addressNodeCount++;
229229
}
230230
}

lib/thin/sqlnet/navNodes.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ class NavAddress extends Address {
486486
if (!net.isIP(this.host)) {
487487
try {
488488
addresses = await dnsPromises.lookup(this.host, options);
489-
for (const addr in addresses) {
489+
for (const addr of addresses) {
490490
const co = new ConnOption();
491491
co.hostname = this.host;
492492
co.port = this.port;
@@ -499,7 +499,7 @@ class NavAddress extends Address {
499499
co.CNdata.push('(address=(protocol=' + this.prot + ')(host=' + this.host + ')(port=' + this.port + '))');
500500
else
501501
co.CNdata.push(this.toString());
502-
co.host = addresses[addr].address;
502+
co.host = addr.address;
503503
co.addr = this.addr;
504504
cs.getcurrentDescription().addConnectOption(co);
505505
}

test/fetchUrowidAsString.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,15 @@ describe('116. fetchUrowidAsString.js', function() {
7373
});
7474

7575
const insertData = async function(connection, tableName) {
76-
for (const element in dataArray) {
77-
const sql = "INSERT INTO " + tableName + "(num) VALUES(" + element + ")";
76+
for (let index = 0; index < dataArray.length; index++) {
77+
const sql = "INSERT INTO " + tableName + "(num) VALUES(" + index + ")";
7878
await connection.execute(sql);
7979
}
8080
};
8181

8282
const updateData = async function(connection, tableName) {
83-
for (const element in dataArray) {
84-
const sql = "UPDATE " + tableName + " T SET content = T.ROWID where num = " + element;
83+
for (let index = 0; index < dataArray.length; index++) {
84+
const sql = "UPDATE " + tableName + " T SET content = T.ROWID where num = " + index;
8585
await connection.execute(sql);
8686
}
8787
};
@@ -442,8 +442,8 @@ describe('116. fetchUrowidAsString.js', function() {
442442
});
443443

444444
async function test1(option, object) {
445-
for (const element in dataArray) {
446-
const sql = "select content,rowid from " + tableName + " where num = " + element;
445+
for (let index = 0; index < dataArray.length; index++) {
446+
const sql = "select content,rowid from " + tableName + " where num = " + index;
447447
const result = await connection.execute(sql, [], option);
448448
let resultVal_1 = result.rows[0][0];
449449
let resultVal_2 = result.rows[0][1];
@@ -458,8 +458,8 @@ describe('116. fetchUrowidAsString.js', function() {
458458
}
459459

460460
async function test2(option, object) {
461-
for (const element in dataArray) {
462-
const sql = "select content,rowid from " + tableName + " where num = " + element;
461+
for (let index = 0; index < dataArray.length; index++) {
462+
const sql = "select content,rowid from " + tableName + " where num = " + index;
463463
const result = await connection.execute(sql, [], option);
464464
const row = await result.resultSet.getRow();
465465
let resultVal_1 = row[0];

0 commit comments

Comments
 (0)