Skip to content

Commit a020a27

Browse files
committed
Update 6.0.1 development info and pushbug fix and patch for Issue #1554
1 parent 53501d6 commit a020a27

File tree

8 files changed

+45
-46
lines changed

8 files changed

+45
-46
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
# node-oracledb version 6.0.0
1+
# node-oracledb version 6.0.1-dev
2+
3+
**This release is under development and information may be incomplete**
24

35
The node-oracledb add-on for Node.js powers high performance Oracle Database
46
applications. Applications can be written in TypeScript, or directly in
57
JavaScript.
68

7-
Use node-oracledb 6.0.0 to connect Node.js 14.6, or later, to Oracle
9+
Use node-oracledb 6.0.1-dev to connect Node.js 14.6, or later, to Oracle
810
Database. Older versions of node-oracledb may work with older versions of
911
Node.js.
1012

doc/src/release_notes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
node-oracledb Release Notes
66
=============================
77

8+
node-oracledb `v6.0.1 <https://github.com/oracle/node-oracledb/compare/v6.0.0...v6.0.1>`__ (DD MON 2023)
9+
--------------------------------------------------------------------------------------------------------
10+
11+
812
node-oracledb `v6.0.0 <https://github.com/oracle/node-oracledb/compare/v5.5.0...v6.0.0>`__ (24 May 2023)
913
--------------------------------------------------------------------------------------------------------
1014

lib/thin/connection.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -568,40 +568,34 @@ class ThinConnectionImpl extends ConnectionImpl {
568568
}
569569
if (statement.returnToCache) {
570570
statement.inUse = false;
571-
this._adjustStatementCache();
572571
} else if (statement.cursorId !== 0) {
573-
this._addCursorToClose(statement);
572+
this._addCursorToClose(statement.cursorId);
574573
}
575574
}
576575

577576
//---------------------------------------------------------------------------
578577
// Adds the cursors that needs to be closed to the _cursorsToClose set
579578
//---------------------------------------------------------------------------
580-
_addCursorToClose(stmt) {
581-
if (stmt.cursorId > 0 && this._cursorsToClose.has(stmt.cursorId)) {
582-
const reason = `attempt to close cursor ${stmt.cursorId} twice`;
579+
_addCursorToClose(cursorId) {
580+
if (this._cursorsToClose.has(cursorId)) {
581+
const reason = `attempt to close cursor ${cursorId} twice`;
583582
errors.throwErr(errors.ERR_INTERNAL, reason);
584583
}
585-
586-
if (this.statementCache.has(stmt.sql)) {
587-
this.statementCache.delete(stmt.sql);
588-
this._cursorsToClose.add(stmt.cursorId);
589-
} else if (stmt.cursorId > 0) {
590-
this._cursorsToClose.add(stmt.cursorId);
591-
}
584+
this._cursorsToClose.add(cursorId);
592585
}
593586

594587
//---------------------------------------------------------------------------
595588
// Adjusts the statement cache to remove least recently used statements
596589
//---------------------------------------------------------------------------
597590
_adjustStatementCache() {
598-
while (this.statementCache.size >= this.statementCacheSize) {
599-
let stmt = this.statementCache.get(this.statementCache.keys().next().value);
600-
this.statementCache.delete(this.statementCache.keys().next().value);
591+
while (this.statementCache.size > this.statementCacheSize) {
592+
const sql = this.statementCache.keys().next().value;
593+
const stmt = this.statementCache.get(sql);
594+
this.statementCache.delete(sql);
601595
if (stmt.inUse) {
602596
stmt.returnToCache = false;
603597
} else if (stmt.cursorId !== 0) {
604-
this._addCursorToClose(stmt);
598+
this._addCursorToClose(stmt.cursorId);
605599
}
606600
}
607601
}
@@ -902,12 +896,14 @@ class ThinConnectionImpl extends ConnectionImpl {
902896
if (!statement) {
903897
statement = new Statement();
904898
statement._prepare(sql);
905-
if (cacheStatement && this.statementCache.size < this.statementCacheSize && !this._drcpEstablishSession && !statement.isDdl) {
906-
this.statementCache.set(sql, statement);
899+
if (cacheStatement && !this._drcpEstablishSession && !statement.isDdl &&
900+
this.statementCacheSize > 0) {
907901
statement.returnToCache = true;
902+
this.statementCache.set(sql, statement);
908903
this._adjustStatementCache();
909904
}
910-
} else if (statement.inUse || !cacheStatement || this._drcpEstablishSession) {
905+
} else if (statement.inUse || !cacheStatement ||
906+
this._drcpEstablishSession) {
911907
if (!cacheStatement) {
912908
this.statementCache.delete(sql);
913909
statement.returnToCache = false;

lib/thin/protocol/messages/withData.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,8 @@ class MessageWithData extends Message {
111111
this.errorInfo.num = 0;
112112
this.errorOccurred = false;
113113
this.statement.moreRowsToFetch = false;
114-
} else if (this.errorInfo.num === constants.TNS_ERR_VAR_NOT_IN_SELECT_LIST) {
115-
this.connection._addCursorToClose(this.statement);
116-
this.connection.statementCache.delete(this.statement.sql);
117114
} else if (this.errorInfo.num !== 0 && this.errorInfo.cursorId !== 0) {
118-
this.connection._addCursorToClose(this.statement);
115+
this.connection._addCursorToClose(this.statement.cursorId);
119116
this.connection.statementCache.delete(this.statement.sql);
120117
}
121118
if (this.errorInfo.batchErrors) {

lib/thin/statement.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ class Statement {
110110
// Copying existing statement into new statement object required by drcp
111111
//---------------------------------------------------------------------------
112112
_copy() {
113-
let copiedStatement = new Statement();
114-
let bindInfoDict;
113+
const copiedStatement = new Statement();
115114
copiedStatement.sql = this.sql;
116115
copiedStatement.sqlBytes = this.sqlBytes;
117116
copiedStatement.sqlLength = this.sqlLength;
@@ -121,16 +120,16 @@ class Statement {
121120
copiedStatement.isDdl = this.isDdl;
122121
copiedStatement.isReturning = this.isReturning;
123122
copiedStatement.bindInfoList = [];
124-
for (let bindInfo of this.bindInfoList) {
125-
copiedStatement.bindInfoList.push(bindInfo);
123+
for (const bindInfo of this.bindInfoList) {
124+
const newBindInfo = new BindInfo(bindInfo.bindName, bindInfo.isReturnBind);
125+
copiedStatement.bindInfoList.push(newBindInfo);
126126
}
127-
copiedStatement.bindInfoDict = new Map();
128-
bindInfoDict = copiedStatement.bindInfoDict;
129-
for (let bindInfoObj of this.bindInfoList) {
130-
if (bindInfoDict.has(bindInfoObj.bindName)) {
131-
bindInfoDict.get(bindInfoObj.bindName).push(bindInfoObj);
127+
const bindInfoDict = copiedStatement.bindInfoDict = new Map();
128+
for (const bindInfo of copiedStatement.bindInfoList) {
129+
if (bindInfoDict.has(bindInfo.bindName)) {
130+
bindInfoDict.get(bindInfo.bindName).push(bindInfo);
132131
} else {
133-
bindInfoDict.set(bindInfoObj.bindName, [bindInfoObj]);
132+
bindInfoDict.set(bindInfo.bindName, [bindInfo]);
134133
}
135134
}
136135
copiedStatement.returnToCache = false;

lib/transformer.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,15 @@ function transformValueIn(info, value, options) {
151151
types.DB_TYPE_CLOB,
152152
types.DB_TYPE_NCLOB);
153153
if (info.type !== types.DB_TYPE_CLOB &&
154-
info.type !== types.DB_TYPE_NCLOB &&
155-
info.cqn === undefined &&
156-
(info.maxSize === undefined || value.length > info.maxSize)) {
157-
if (info.checkSize) {
158-
errors.throwErr(errors.ERR_MAX_SIZE_TOO_SMALL, info.maxSize,
159-
value.length, options.pos);
154+
info.type !== types.DB_TYPE_NCLOB) {
155+
const valueLen = Buffer.byteLength(value);
156+
if (info.maxSize === undefined || valueLen > info.maxSize) {
157+
if (info.checkSize) {
158+
errors.throwErr(errors.ERR_MAX_SIZE_TOO_SMALL, info.maxSize,
159+
valueLen, options.pos);
160+
}
161+
info.maxSize = valueLen;
160162
}
161-
info.maxSize = value.length;
162163
}
163164
return value;
164165

@@ -193,7 +194,7 @@ function transformValueIn(info, value, options) {
193194
checkType(info, options,
194195
types.DB_TYPE_RAW,
195196
types.DB_TYPE_BLOB);
196-
if (info.type === types.DB_TYPE_RAW && info.cqn === undefined &&
197+
if (info.type === types.DB_TYPE_RAW &&
197198
(info.maxSize === undefined || value.length > info.maxSize)) {
198199
if (info.checkSize) {
199200
errors.throwErr(errors.ERR_MAX_SIZE_TOO_SMALL, info.maxSize,

lib/version.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
module.exports = {
3232
VERSION_MAJOR: 6,
3333
VERSION_MINOR: 0,
34-
VERSION_PATCH: 0,
35-
VERSION_SUFFIX: ''
34+
VERSION_PATCH: 1,
35+
VERSION_SUFFIX: '-dev'
3636
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "oracledb",
3-
"version": "6.0.0",
3+
"version": "6.0.1-dev",
44
"description": "A Node.js module for Oracle Database access from JavaScript and TypeScript",
55
"license": "(Apache-2.0 OR UPL-1.0)",
66
"homepage": "http://oracle.github.io/node-oracledb/",

0 commit comments

Comments
 (0)