Skip to content

Commit 622c44a

Browse files
committed
Update code to connect to Oracle Database 23ai Cloud Free Database
1 parent ea431d3 commit 622c44a

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

lib/thin/protocol/capabilities.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,31 @@ const errors = require('../../errors');
3636
*/
3737
class Capabilities {
3838

39-
constructor(protocolVersion) {
40-
this.protocolVersion = protocolVersion;
39+
constructor(nscon) {
40+
this.protocolVersion = nscon.sAtts.version;
4141
this.ttcFieldVersion = constants.TNS_CCAP_FIELD_VERSION_MAX;
4242
this.supports12cLogon = true;
4343
this.supportsOob = false;
4444
this.nCharsetId = constants.TNS_CHARSET_UTF16;
4545
this.compileCaps = Buffer.alloc(constants.TNS_CCAP_MAX);
4646
this.runtimeCaps = Buffer.alloc(constants.TNS_RCAP_MAX);
47-
this.initCompileCaps();
47+
this.initCompileCaps(nscon);
4848
this.initRuntimeCaps();
4949
this.maxStringSize = 0;
5050
}
5151

52-
adjustForServerCompileCaps(serverCaps) {
52+
adjustForServerCompileCaps(serverCaps, nscon) {
5353
if (serverCaps[constants.TNS_CCAP_FIELD_VERSION] < this.ttcFieldVersion) {
5454
this.ttcFieldVersion = serverCaps[constants.TNS_CCAP_FIELD_VERSION];
5555
this.compileCaps[constants.TNS_CCAP_FIELD_VERSION] =
5656
this.ttcFieldVersion;
5757
}
58-
if (this.ttcFieldVersion < constants.TNS_CCAP_FIELD_VERSION_23_4 ||
59-
!(serverCaps[constants.TNS_CCAP_TTC4] &
60-
constants.TNS_CCAP_END_OF_REQUEST)) {
61-
// TTIDONE used only from 23.4 onwards
58+
if ((this.ttcFieldVersion < constants.TNS_CCAP_FIELD_VERSION_23_4
59+
&& nscon.endOfRequestSupport)) {
60+
// endOfRequestSupport used only from 23.4 onwards and not for 23.3
6261
this.compileCaps[constants.TNS_CCAP_TTC4]
6362
^= constants.TNS_CCAP_END_OF_REQUEST;
63+
nscon.endOfRequestSupport = false;
6464
}
6565
}
6666

@@ -72,7 +72,7 @@ class Capabilities {
7272
}
7373
}
7474

75-
initCompileCaps() {
75+
initCompileCaps(nscon) {
7676
this.compileCaps[constants.TNS_CCAP_SQL_VERSION] =
7777
constants.TNS_CCAP_SQL_VERSION_MAX;
7878
this.compileCaps[constants.TNS_CCAP_LOGON_TYPES] =
@@ -110,8 +110,10 @@ class Capabilities {
110110
this.compileCaps[constants.TNS_CCAP_CLIENT_FN] =
111111
constants.TNS_CCAP_CLIENT_FN_MAX;
112112
this.compileCaps[constants.TNS_CCAP_TTC4] =
113-
constants.TNS_CCAP_INBAND_NOTIFICATION |
114-
constants.TNS_CCAP_END_OF_REQUEST;
113+
constants.TNS_CCAP_INBAND_NOTIFICATION;
114+
if (nscon.endOfRequestSupport) {
115+
this.compileCaps[constants.TNS_CCAP_TTC4] |= constants.TNS_CCAP_END_OF_REQUEST;
116+
}
115117
this.compileCaps[constants.TNS_CCAP_CTB_FEATURE_BACKPORT] =
116118
constants.TNS_CCAP_CTB_IMPLICIT_POOL;
117119
this.compileCaps[constants.TNS_CCAP_TTC5] =

lib/thin/protocol/messages/protocol.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,7 @@ class ProtocolMessage extends Message {
7676
const serverCompileCaps = buf.readBytesWithLength();
7777
if (serverCompileCaps) {
7878
this.serverCompileCaps = Buffer.from(serverCompileCaps);
79-
buf.caps.adjustForServerCompileCaps(this.serverCompileCaps);
80-
81-
// use endOfRequestSupport only from 23.4 onwards
82-
if (buf.caps.ttcFieldVersion < constants.TNS_CCAP_FIELD_VERSION_23_4) {
83-
this.connection.nscon.endOfRequestSupport = false;
84-
}
79+
buf.caps.adjustForServerCompileCaps(this.serverCompileCaps, this.connection.nscon);
8580

8681
// Set the maximum OSON field name size
8782
if (buf.caps.ttcFieldVersion >= constants.TNS_CCAP_FIELD_VERSION_23_1) {

lib/thin/protocol/protocol.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Protocol {
4949
* Compile and Runtime capabilities negotiated with Server
5050
* @type {object}
5151
*/
52-
this.caps = new Capabilities(conn.nscon.sAtts.version);
52+
this.caps = new Capabilities(conn.nscon);
5353
this.writeBuf = new WritePacket(conn.nscon, this.caps, this);
5454
this.readBuf = new ReadPacket(conn.nscon, this.caps);
5555
this.callTimeout = 0;

lib/thin/sqlnet/constants.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ module.exports = {
107107
NSGRAW: 0x1000, // I/O is direct to/from transport
108108
TNS_VERSION_DESIRED: 319,
109109
TNS_VERSION_MINIMUM: 300,
110-
TNS_VERSION_MIN_UUID: 319,
111110
TNS_VERSION_MIN_DATA_FLAGS: 318,
111+
TNS_VERSION_MIN_END_OF_RESPONSE: 319,
112112
TNS_UUID_OFFSET: 45,
113113

114114
/* Accept Packet */

lib/thin/sqlnet/networkSession.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ class NetworkSession {
360360
break;
361361
case constants.NSPTAC: /* ACCEPT */
362362
Packet.AcceptPacket(packet, this.sAtts);
363-
if (packet.flags & constants.TNS_ACCEPT_FLAG_HAS_END_OF_REQUEST) {
363+
if (this.sAtts.version >= constants.TNS_VERSION_MIN_END_OF_RESPONSE
364+
&& (packet.flags & constants.TNS_ACCEPT_FLAG_HAS_END_OF_REQUEST)) {
364365
this.endOfRequestSupport = true;
365366
}
366367
if (packet.flags & constants.TNS_ACCEPT_FLAG_FAST_AUTH) {

0 commit comments

Comments
 (0)