oracledb 6.2.0 → 6.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +1 -1
- package/NOTICE.txt +1 -1
- package/README.md +3 -3
- package/build/Release/oracledb-6.4.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.4.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.4.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.4.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.4.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.4.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.4.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.4.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.4.0-win32-x64.node-buildinfo.txt +1 -0
- package/examples/README.md +29 -8
- package/examples/dbconfig.js +50 -26
- package/examples/example.js +6 -4
- package/lib/aqQueue.js +8 -8
- package/lib/connection.js +121 -9
- package/lib/constants.js +7 -1
- package/lib/dbObject.js +72 -1
- package/lib/errors.js +45 -8
- package/lib/future.js +53 -0
- package/lib/impl/connection.js +56 -0
- package/lib/{thin/protocol → impl/datahandlers}/buffer.js +51 -39
- package/lib/impl/datahandlers/constants.js +105 -0
- package/lib/{thin/protocol → impl/datahandlers}/oson.js +19 -1
- package/lib/impl/datahandlers/vector.js +156 -0
- package/lib/impl/pool.js +14 -3
- package/lib/impl/resultset.js +65 -11
- package/lib/lob.js +22 -6
- package/lib/oracledb.js +47 -8
- package/lib/pool.js +20 -1
- package/lib/poolStatistics.js +3 -1
- package/lib/settings.js +30 -6
- package/lib/sodaDocCursor.js +14 -1
- package/lib/thin/connection.js +146 -146
- package/lib/thin/dbObject.js +49 -3
- package/lib/thin/index.js +1 -1
- package/lib/thin/lob.js +6 -6
- package/lib/thin/pool.js +25 -6
- package/lib/thin/protocol/capabilities.js +6 -2
- package/lib/thin/protocol/constants.js +50 -65
- package/lib/thin/protocol/messages/auth.js +6 -2
- package/lib/thin/protocol/messages/base.js +50 -32
- package/lib/thin/protocol/messages/dataType.js +10 -6
- package/lib/thin/protocol/messages/lobOp.js +7 -8
- package/lib/thin/protocol/messages/withData.js +91 -24
- package/lib/thin/protocol/packet.js +58 -4
- package/lib/thin/protocol/utils.js +1 -1
- package/lib/thin/sqlnet/connStrategy.js +8 -4
- package/lib/thin/sqlnet/constants.js +138 -138
- package/lib/thin/sqlnet/navNodes.js +5 -5
- package/lib/thin/sqlnet/networkSession.js +22 -3
- package/lib/thin/sqlnet/ntTcp.js +7 -7
- package/lib/thin/statement.js +8 -8
- package/lib/thin/statementCache.js +167 -0
- package/lib/thin/util.js +15 -4
- package/lib/transformer.js +13 -4
- package/lib/types.js +17 -2
- package/lib/util.js +37 -0
- package/lib/version.js +2 -2
- package/package.json +1 -1
- package/build/Release/oracledb-6.2.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.2.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.2.0-js-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.2.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.2.0-linux-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.2.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.2.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.2.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.2.0-win32-x64.node-buildinfo.txt +0 -1
|
@@ -27,175 +27,175 @@
|
|
|
27
27
|
|
|
28
28
|
module.exports = {
|
|
29
29
|
// TNS packet types
|
|
30
|
-
NSPTCN
|
|
31
|
-
NSPTAC
|
|
32
|
-
NSPTAK
|
|
33
|
-
NSPTRF
|
|
34
|
-
NSPTRD
|
|
35
|
-
NSPTDA
|
|
36
|
-
NSPTNL
|
|
37
|
-
NSPTAB
|
|
38
|
-
NSPTRS
|
|
39
|
-
NSPTMK
|
|
40
|
-
NSPTAT
|
|
41
|
-
NSPTCNL
|
|
42
|
-
NSPTDD
|
|
43
|
-
NSPTHI
|
|
30
|
+
NSPTCN: 1, // Connect
|
|
31
|
+
NSPTAC: 2, // Accept
|
|
32
|
+
NSPTAK: 3, // Acknowledge
|
|
33
|
+
NSPTRF: 4, // Refuse
|
|
34
|
+
NSPTRD: 5, // Redirect
|
|
35
|
+
NSPTDA: 6, // Data
|
|
36
|
+
NSPTNL: 7, // Null
|
|
37
|
+
NSPTAB: 9, // Abort
|
|
38
|
+
NSPTRS: 11, // Re-send
|
|
39
|
+
NSPTMK: 12, // Marker
|
|
40
|
+
NSPTAT: 13, // Attention
|
|
41
|
+
NSPTCNL: 14, // Control information
|
|
42
|
+
NSPTDD: 15, // data descriptor
|
|
43
|
+
NSPTHI: 19, // Highest legal packet type
|
|
44
44
|
|
|
45
45
|
// Packet Header
|
|
46
|
-
NSPHDLEN
|
|
47
|
-
NSPHDPSM
|
|
48
|
-
NSPHDTYP
|
|
49
|
-
NSPHDFLGS
|
|
50
|
-
NSPHDHSM
|
|
51
|
-
NSPSIZHD
|
|
46
|
+
NSPHDLEN: 0, // Packet length
|
|
47
|
+
NSPHDPSM: 2, // Packet checksum(deprecated in version 3.15 with large sdu support)
|
|
48
|
+
NSPHDTYP: 4, // Packet type
|
|
49
|
+
NSPHDFLGS: 5, // Packet flags
|
|
50
|
+
NSPHDHSM: 6, // Header checksum
|
|
51
|
+
NSPSIZHD: 8, // Packet header size
|
|
52
52
|
|
|
53
53
|
/* Packet flags for NSPHDFLGS */
|
|
54
|
-
NSPFSID
|
|
55
|
-
NSPFRDS
|
|
56
|
-
NSPFRDR
|
|
57
|
-
NSPFLSD
|
|
58
|
-
NO_HEADER_FLAGS
|
|
59
|
-
NSPFSRN
|
|
54
|
+
NSPFSID: 0x01, // SID is given
|
|
55
|
+
NSPFRDS: 0x02, // ReDirect Separation of cnda vs cndo
|
|
56
|
+
NSPFRDR: 0x04, // ReDiRected client Connect (NSPTCN)
|
|
57
|
+
NSPFLSD: 0x20, // packet with large sdu field
|
|
58
|
+
NO_HEADER_FLAGS: 0,
|
|
59
|
+
NSPFSRN: 0x08,
|
|
60
60
|
|
|
61
61
|
// Connect Packet
|
|
62
|
-
NSPCNVSN
|
|
63
|
-
NSPCNLOV
|
|
64
|
-
NSPCNOPT
|
|
65
|
-
NSPCNSDU
|
|
66
|
-
NSPCNTDU
|
|
67
|
-
NSPCNNTC
|
|
68
|
-
NSPCNTNA
|
|
69
|
-
NSPCNONE
|
|
70
|
-
NSPCNLEN
|
|
71
|
-
NSPCNOFF
|
|
72
|
-
NSPCNMXC
|
|
73
|
-
NSPCNFL0
|
|
74
|
-
NSPCNFL1
|
|
75
|
-
NSPCNTMO
|
|
76
|
-
NSPCNTCK
|
|
77
|
-
NSPCNADL
|
|
78
|
-
NSPCNAOF
|
|
79
|
-
NSPCNLSD
|
|
80
|
-
NSPCNLTD
|
|
81
|
-
NSPCNCFL
|
|
82
|
-
NSPCNCFL2
|
|
62
|
+
NSPCNVSN: 8, // My version number
|
|
63
|
+
NSPCNLOV: 10, // Lowest version number I can be compatible with
|
|
64
|
+
NSPCNOPT: 12, // Global service options
|
|
65
|
+
NSPCNSDU: 14, // My SDU size
|
|
66
|
+
NSPCNTDU: 16, // Maximum TDU size
|
|
67
|
+
NSPCNNTC: 18, // NT characterstics
|
|
68
|
+
NSPCNTNA: 20, // Line turnaround value
|
|
69
|
+
NSPCNONE: 22, // The value '1' in my hardware byte order
|
|
70
|
+
NSPCNLEN: 24, // Length of connect data
|
|
71
|
+
NSPCNOFF: 26, // Offset to connect data
|
|
72
|
+
NSPCNMXC: 28, // Maximum connect data you can send me
|
|
73
|
+
NSPCNFL0: 32, // Connect flags
|
|
74
|
+
NSPCNFL1: 33,
|
|
75
|
+
NSPCNTMO: 50, // local connection timeout val
|
|
76
|
+
NSPCNTCK: 52, // local tick size
|
|
77
|
+
NSPCNADL: 54,
|
|
78
|
+
NSPCNAOF: 56, // offset to reconnect tns addr
|
|
79
|
+
NSPCNLSD: 58, // large sdu
|
|
80
|
+
NSPCNLTD: 62, // large tdu
|
|
81
|
+
NSPCNCFL: 66, // compression data
|
|
82
|
+
NSPCNCFL2: 70, // connect flag2
|
|
83
83
|
// NSPCNV310DAT : (NSPCNTMO + 8), start of connect data, V3.10 packet
|
|
84
84
|
// NSPCNV315DAT : (NSPCNCFL + 4),
|
|
85
|
-
NSPCNDAT
|
|
86
|
-
NSPMXCDATA
|
|
85
|
+
NSPCNDAT: 74, // Start connect data
|
|
86
|
+
NSPMXCDATA: 230, // Maximum length of connect data
|
|
87
87
|
// Connect flags (Used mostly by NA)
|
|
88
|
-
NSINAWANTED
|
|
89
|
-
NSINAINTCHG
|
|
88
|
+
NSINAWANTED: 0x01, // Want to use NA
|
|
89
|
+
NSINAINTCHG: 0x02, // Interchange involved
|
|
90
90
|
NSINADISABLEDFORCONNECTION: 0x04, // Disable NA
|
|
91
|
-
NSINANOSERVICES
|
|
92
|
-
NSINAREQUIRED
|
|
93
|
-
NSINAAUTHWANTED
|
|
94
|
-
NSISUPSECRENEG
|
|
91
|
+
NSINANOSERVICES: 0x08, // No NA services linked
|
|
92
|
+
NSINAREQUIRED: 0x10, // NA is required
|
|
93
|
+
NSINAAUTHWANTED: 0x20, // Authentication linked
|
|
94
|
+
NSISUPSECRENEG: 0x80, // bkwrd comp: SUPport SECurity RE-NEG
|
|
95
95
|
// Connect options
|
|
96
|
-
NSGDONTCARE
|
|
97
|
-
NSGHDX
|
|
98
|
-
NSGFDX
|
|
99
|
-
NSGHDRCHKSUM
|
|
100
|
-
NSGPAKCHKSUM
|
|
101
|
-
NSGBROKEN
|
|
102
|
-
NSGUSEVIO
|
|
103
|
-
NSGOSAUTHOK
|
|
104
|
-
NSGSENDATTN
|
|
105
|
-
NSGRECVATTN
|
|
106
|
-
NSGNOATTNPR
|
|
107
|
-
NSGRAW
|
|
108
|
-
TNS_VERSION_DESIRED
|
|
109
|
-
TNS_VERSION_MINIMUM
|
|
110
|
-
TNS_VERSION_MIN_UUID
|
|
111
|
-
TNS_UUID_OFFSET
|
|
96
|
+
NSGDONTCARE: 0x0001, // "don't care"
|
|
97
|
+
NSGHDX: 0x0002, // half-duplex (w/ token management)
|
|
98
|
+
NSGFDX: 0x0004, // full-duplex
|
|
99
|
+
NSGHDRCHKSUM: 0x0008, // checksum on packet header
|
|
100
|
+
NSGPAKCHKSUM: 0x0010, // checksum on entire packet
|
|
101
|
+
NSGBROKEN: 0x0020, // provide broken connection notification
|
|
102
|
+
NSGUSEVIO: 0x0040, // can use Vectored I/O
|
|
103
|
+
NSGOSAUTHOK: 0x0080, // use OS authentication
|
|
104
|
+
NSGSENDATTN: 0x0200, // can send attention
|
|
105
|
+
NSGRECVATTN: 0x0400, // can recv attention
|
|
106
|
+
NSGNOATTNPR: 0x0800, // no attention processing
|
|
107
|
+
NSGRAW: 0x1000, // I/O is direct to/from transport
|
|
108
|
+
TNS_VERSION_DESIRED: 319,
|
|
109
|
+
TNS_VERSION_MINIMUM: 300,
|
|
110
|
+
TNS_VERSION_MIN_UUID: 319,
|
|
111
|
+
TNS_UUID_OFFSET: 45,
|
|
112
112
|
|
|
113
113
|
/* Accept Packet */
|
|
114
|
-
NSPACVSN
|
|
115
|
-
NSPACOPT
|
|
116
|
-
NSPACSDU
|
|
117
|
-
NSPACTDU
|
|
118
|
-
NSPACONE
|
|
119
|
-
NSPACLEN
|
|
120
|
-
NSPACOFF
|
|
121
|
-
NSPACFL0
|
|
122
|
-
NSPACFL1
|
|
123
|
-
NSPACTMO
|
|
124
|
-
NSPACTCK
|
|
125
|
-
NSPACADL
|
|
126
|
-
NSPACAOF
|
|
127
|
-
NSPACLSD
|
|
128
|
-
NSPACLTD
|
|
129
|
-
NSPACCFL
|
|
130
|
-
NSPACFL2
|
|
131
|
-
NSPACV310DAT
|
|
132
|
-
NSPACV315DAT
|
|
114
|
+
NSPACVSN: 8, // connection version
|
|
115
|
+
NSPACOPT: 10, // global service options
|
|
116
|
+
NSPACSDU: 12, // SDU size
|
|
117
|
+
NSPACTDU: 14, // Maximum TDU
|
|
118
|
+
NSPACONE: 16, // The value '1' in my hardware byte order
|
|
119
|
+
NSPACLEN: 18, // connect data length
|
|
120
|
+
NSPACOFF: 20, // offset to connect data
|
|
121
|
+
NSPACFL0: 22, // connect flags
|
|
122
|
+
NSPACFL1: 23,
|
|
123
|
+
NSPACTMO: 24, // connection pool timeout value
|
|
124
|
+
NSPACTCK: 26, // local tick size
|
|
125
|
+
NSPACADL: 28, // reconnect tns address length
|
|
126
|
+
NSPACAOF: 30, // offset to reconnect tns addr
|
|
127
|
+
NSPACLSD: 32, // Large sdu
|
|
128
|
+
NSPACLTD: 36, // Large tdu
|
|
129
|
+
NSPACCFL: 40, // compression flag
|
|
130
|
+
NSPACFL2: 41, // accept flag2 (4 bytes)
|
|
131
|
+
NSPACV310DAT: 32, /* start of accept data, V3.10 packet */
|
|
132
|
+
NSPACV315DAT: 41, // start of accept data, V3.15 packet
|
|
133
133
|
|
|
134
134
|
/* Refuse Packet */
|
|
135
|
-
NSPRFURS
|
|
136
|
-
NSPRFSRS
|
|
137
|
-
NSPRFLEN
|
|
138
|
-
NSPRFDAT
|
|
135
|
+
NSPRFURS: 8, // User (appliction) reason for refusal
|
|
136
|
+
NSPRFSRS: 9, // System (NS) reason for
|
|
137
|
+
NSPRFLEN: 10, // Length of refuse data
|
|
138
|
+
NSPRFDAT: 12, // Start of connect data
|
|
139
139
|
// Compression flags
|
|
140
|
-
NSPACCFON
|
|
141
|
-
NSPACCFAT
|
|
142
|
-
NSPACCFNT
|
|
140
|
+
NSPACCFON: 0x80, // 1st MSB: compression on/off
|
|
141
|
+
NSPACCFAT: 0x40, // 2nd MSB : compression auto
|
|
142
|
+
NSPACCFNT: 0x02, // Second last LSB : compression for non-tcp protocol
|
|
143
143
|
// Accept flag2
|
|
144
|
-
NSPACOOB
|
|
145
|
-
NSGPCHKSCMD
|
|
144
|
+
NSPACOOB: 0x00000001, // OOB support check at connection time
|
|
145
|
+
NSGPCHKSCMD: 0x01000000, // Support for Poll and Check logic
|
|
146
146
|
|
|
147
147
|
/* Redirect packet */
|
|
148
|
-
NSPRDLEN
|
|
149
|
-
NSPRDDAT
|
|
148
|
+
NSPRDLEN: 8, // Length of redirect data
|
|
149
|
+
NSPRDDAT: 10, // Start of connect data
|
|
150
150
|
|
|
151
151
|
/* Data Packet */
|
|
152
|
-
NSPDAFLG
|
|
153
|
-
NSPDADAT
|
|
154
|
-
NSPDAFEOF
|
|
152
|
+
NSPDAFLG: 8, // Data flags
|
|
153
|
+
NSPDADAT: 10, // Start of Data
|
|
154
|
+
NSPDAFEOF: 0x40, // "end of file"
|
|
155
155
|
|
|
156
156
|
/* Marker Packet */
|
|
157
|
-
NSPMKTYP
|
|
158
|
-
NSPMKODT
|
|
159
|
-
NSPMKDAT
|
|
160
|
-
NSPMKTD0
|
|
161
|
-
NSPMKTD1
|
|
162
|
-
NSPMKTAT
|
|
163
|
-
NIQBMARK
|
|
164
|
-
NIQRMARK
|
|
165
|
-
NIQIMARK
|
|
157
|
+
NSPMKTYP: 8, // marker type (see below)
|
|
158
|
+
NSPMKODT: 9, // old (pre-V3.05) data byte
|
|
159
|
+
NSPMKDAT: 10, // data byte
|
|
160
|
+
NSPMKTD0: 0, // data marker - 0 data bytes
|
|
161
|
+
NSPMKTD1: 1, // data marker - 1 data byte
|
|
162
|
+
NSPMKTAT: 2, // Attention Marker
|
|
163
|
+
NIQBMARK: 1, // Break marker
|
|
164
|
+
NIQRMARK: 2, // Reset marker
|
|
165
|
+
NIQIMARK: 3, // Interrupt marker
|
|
166
166
|
|
|
167
167
|
/* Control Packet */
|
|
168
|
-
NSPCTLCMD
|
|
169
|
-
NSPCTLDAT
|
|
170
|
-
NSPCTL_SERR
|
|
171
|
-
NSPCTL_CLRATTN
|
|
168
|
+
NSPCTLCMD: 8, // Control Command length is 2 bytes
|
|
169
|
+
NSPCTLDAT: 10, // Control Data length is specific to the Command type.
|
|
170
|
+
NSPCTL_SERR: 8, // Error Control Command Type
|
|
171
|
+
NSPCTL_CLRATTN: 9, // Clear OOB option
|
|
172
172
|
|
|
173
173
|
/* OPTIONS */
|
|
174
|
-
NSPDFSDULN
|
|
175
|
-
NSPABSSDULN
|
|
176
|
-
NSPMXSDULN
|
|
177
|
-
NSPMNSDULN
|
|
178
|
-
NSPDFTDULN
|
|
179
|
-
NSPMXTDULN
|
|
180
|
-
NSPMNTDULN
|
|
181
|
-
NSFIMM
|
|
174
|
+
NSPDFSDULN: 8192, // default SDU size
|
|
175
|
+
NSPABSSDULN: 2097152, // maximim SDU size
|
|
176
|
+
NSPMXSDULN: 65535, // maximim SDU size
|
|
177
|
+
NSPMNSDULN: 512, // minimum SDU size
|
|
178
|
+
NSPDFTDULN: 2097152, // default TDU size
|
|
179
|
+
NSPMXTDULN: 2097152, // maximum TDU size
|
|
180
|
+
NSPMNTDULN: 255, // minimum TDU size
|
|
181
|
+
NSFIMM: 0x0040, // immediate close
|
|
182
182
|
|
|
183
183
|
/* PARAMETERS */
|
|
184
|
-
DISABLE_OOB_STR
|
|
185
|
-
EXPIRE_TIME
|
|
186
|
-
PEM_WALLET_FILE_NAME
|
|
184
|
+
DISABLE_OOB_STR: 'DISABLE_OOB', // disable OOB parameter
|
|
185
|
+
EXPIRE_TIME: 'EXPIRE_TIME', // expire Time
|
|
186
|
+
PEM_WALLET_FILE_NAME: 'ewallet.pem',
|
|
187
187
|
|
|
188
188
|
/* Get/Set options */
|
|
189
|
-
NT_MOREDATA
|
|
190
|
-
NS_MOREDATA
|
|
191
|
-
SVCNAME
|
|
192
|
-
SERVERTYPE
|
|
193
|
-
REMOTEADDR
|
|
194
|
-
HEALTHCHECK
|
|
195
|
-
CONNCLASS
|
|
196
|
-
PURITY
|
|
197
|
-
SID
|
|
189
|
+
NT_MOREDATA: 1, // More Data in Transport available
|
|
190
|
+
NS_MOREDATA: 2, // More Data available to be read
|
|
191
|
+
SVCNAME: 3, // Service name
|
|
192
|
+
SERVERTYPE: 4, // Server type
|
|
193
|
+
REMOTEADDR: 5, // Remote Address
|
|
194
|
+
HEALTHCHECK: 6, // Health check of connection
|
|
195
|
+
CONNCLASS: 7, // Connection Class
|
|
196
|
+
PURITY: 8, // Purity
|
|
197
|
+
SID: 9, // SID
|
|
198
198
|
|
|
199
199
|
/* FLAGS */
|
|
200
|
-
NSNOBLOCK
|
|
200
|
+
NSNOBLOCK: 0x0001, // Do not block
|
|
201
201
|
};
|
|
@@ -35,10 +35,10 @@ const dnsPromises = dns.promises;
|
|
|
35
35
|
const cInfo = require("../util.js").CLIENT_INFO;
|
|
36
36
|
|
|
37
37
|
const SchemaObjectFactoryInterface = {
|
|
38
|
-
ADDR:0,
|
|
39
|
-
ADDR_LIST:1,
|
|
40
|
-
DESC:2,
|
|
41
|
-
DESC_LIST:3,
|
|
38
|
+
ADDR: 0,
|
|
39
|
+
ADDR_LIST: 1,
|
|
40
|
+
DESC: 2,
|
|
41
|
+
DESC_LIST: 3,
|
|
42
42
|
};
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -451,7 +451,7 @@ const NavSchemaObject = {
|
|
|
451
451
|
CONID: "(CONNECTION_ID="
|
|
452
452
|
};
|
|
453
453
|
const options = {
|
|
454
|
-
all:true,
|
|
454
|
+
all: true,
|
|
455
455
|
};
|
|
456
456
|
/**
|
|
457
457
|
* Class that navigates the address node in the tree.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2024, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -46,6 +46,7 @@ const downHostInstance = require("./connStrategy.js").SOLE_INST_DHCACHE;
|
|
|
46
46
|
|
|
47
47
|
async function getConnectionInfo(userConfig) {
|
|
48
48
|
const connStr = await resolveConnectStr(userConfig.connectString, userConfig.configDir);
|
|
49
|
+
const addressNode = await createNode(connStr);
|
|
49
50
|
let nvpair;
|
|
50
51
|
if (typeof connStr === 'string')
|
|
51
52
|
nvpair = createNVPair(connStr);
|
|
@@ -58,7 +59,7 @@ async function getConnectionInfo(userConfig) {
|
|
|
58
59
|
const sid = findValue(nvpair, ["DESCRIPTION", "CONNECT_DATA", "SID"]);
|
|
59
60
|
const poolPurity = findValue(nvpair, ["DESCRIPTION", "CONNECT_DATA", "POOL_PURITY"]);
|
|
60
61
|
|
|
61
|
-
return [serverVal, connClass, svcname, poolPurity, sid ];
|
|
62
|
+
return [serverVal, connClass, svcname, poolPurity, sid, addressNode ];
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
/**
|
|
@@ -510,7 +511,13 @@ class NetworkSession {
|
|
|
510
511
|
*/
|
|
511
512
|
async connect(userConfig) {
|
|
512
513
|
const connStr = userConfig.connectString ? userConfig.connectString : userConfig.connectionString;
|
|
513
|
-
|
|
514
|
+
let addressNode;
|
|
515
|
+
if (userConfig._connInfo) {
|
|
516
|
+
addressNode = userConfig._connInfo[5];
|
|
517
|
+
addressNode.reset();
|
|
518
|
+
} else {
|
|
519
|
+
addressNode = await resolveAddress(connStr, userConfig.configDir);
|
|
520
|
+
}
|
|
514
521
|
let address;
|
|
515
522
|
try {
|
|
516
523
|
address = await this.getAddress(addressNode, userConfig);
|
|
@@ -523,6 +530,18 @@ class NetworkSession {
|
|
|
523
530
|
await this.connect1(address, addressNode, userConfig);
|
|
524
531
|
}
|
|
525
532
|
|
|
533
|
+
/**
|
|
534
|
+
* Force Disconnect the stream, primarily used
|
|
535
|
+
* to disconnect dead/hung connections.
|
|
536
|
+
*/
|
|
537
|
+
forceDisconnect(err) {
|
|
538
|
+
if (!this.connected) {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
this.ntAdapter.stream.destroy(err);
|
|
542
|
+
this.connected = false;
|
|
543
|
+
}
|
|
544
|
+
|
|
526
545
|
/**
|
|
527
546
|
* Disconnect
|
|
528
547
|
* @param {int} type of disconnect
|
package/lib/thin/sqlnet/ntTcp.js
CHANGED
|
@@ -228,10 +228,10 @@ class NTTCP {
|
|
|
228
228
|
this.doDNMatch = false; //Don't match initial connect
|
|
229
229
|
try {
|
|
230
230
|
secureContext = tls.createSecureContext({
|
|
231
|
-
cert
|
|
232
|
-
key
|
|
231
|
+
cert: this.atts.wallet,
|
|
232
|
+
key: this.atts.wallet,
|
|
233
233
|
passphrase: this.atts.walletPassword,
|
|
234
|
-
ca
|
|
234
|
+
ca: this.atts.wallet,
|
|
235
235
|
});
|
|
236
236
|
} catch (err) {
|
|
237
237
|
errors.throwErr(errors.ERR_TLS_INIT_FAILURE);
|
|
@@ -415,7 +415,7 @@ class NTTCP {
|
|
|
415
415
|
buf: tempBuf.subarray(0, len),
|
|
416
416
|
type: tempBuf[4],
|
|
417
417
|
flags: tempBuf[5],
|
|
418
|
-
num
|
|
418
|
+
num: this.packetNum++
|
|
419
419
|
};
|
|
420
420
|
this.packets.push(packet);
|
|
421
421
|
if (this.readWaiter) {
|
|
@@ -474,10 +474,10 @@ class NTTCP {
|
|
|
474
474
|
this.checkErr();
|
|
475
475
|
this.doDNMatch = true;
|
|
476
476
|
const secureContext = tls.createSecureContext({
|
|
477
|
-
cert
|
|
478
|
-
key
|
|
477
|
+
cert: this.atts.wallet,
|
|
478
|
+
key: this.atts.wallet,
|
|
479
479
|
passphrase: this.atts.walletPassword,
|
|
480
|
-
ca
|
|
480
|
+
ca: this.atts.wallet,
|
|
481
481
|
});
|
|
482
482
|
await this.tlsConnect(secureContext, this.connStream);
|
|
483
483
|
} finally {
|
package/lib/thin/statement.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2022,
|
|
1
|
+
// Copyright (c) 2022, 2024, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -142,7 +142,7 @@ class Parser {
|
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
144
|
inComment = true;
|
|
145
|
-
} else if (
|
|
145
|
+
} else if (ch === '*') {
|
|
146
146
|
exitingComment = true;
|
|
147
147
|
} else if (exitingComment) {
|
|
148
148
|
if (ch === '/') {
|
|
@@ -219,10 +219,10 @@ class Parser {
|
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
221
|
* Single line comments consist of two dashes and all characters up to the
|
|
222
|
-
* next line break. This method is called when
|
|
223
|
-
* and checks for the subsequent dash. If found,
|
|
224
|
-
* is traversed and the current position is updated;
|
|
225
|
-
* current position is left untouched.
|
|
222
|
+
* next line break (or the end of the data). This method is called when
|
|
223
|
+
* the first dash is detected and checks for the subsequent dash. If found,
|
|
224
|
+
* the single line comment is traversed and the current position is updated;
|
|
225
|
+
* otherwise, the current position is left untouched.
|
|
226
226
|
*/
|
|
227
227
|
_parseSingleLineComment() {
|
|
228
228
|
let inComment = false;
|
|
@@ -233,15 +233,15 @@ class Parser {
|
|
|
233
233
|
ch = this.sqlData[pos];
|
|
234
234
|
if (!inComment) {
|
|
235
235
|
if (ch !== '-') {
|
|
236
|
-
|
|
236
|
+
return;
|
|
237
237
|
}
|
|
238
238
|
inComment = true;
|
|
239
239
|
} else if (ch === '\n') {
|
|
240
|
-
this.pos = pos;
|
|
241
240
|
break;
|
|
242
241
|
}
|
|
243
242
|
pos += 1;
|
|
244
243
|
}
|
|
244
|
+
this.pos = pos;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
/**
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// Copyright (c) 2024, Oracle and/or its affiliates.
|
|
2
|
+
|
|
3
|
+
//-----------------------------------------------------------------------------
|
|
4
|
+
//
|
|
5
|
+
// This software is dual-licensed to you under the Universal Permissive License
|
|
6
|
+
// (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
|
|
7
|
+
// 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
|
|
8
|
+
// either license.
|
|
9
|
+
//
|
|
10
|
+
// If you elect to accept the software under the Apache License, Version 2.0,
|
|
11
|
+
// the following applies:
|
|
12
|
+
//
|
|
13
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
// you may not use this file except in compliance with the License.
|
|
15
|
+
// You may obtain a copy of the License at
|
|
16
|
+
//
|
|
17
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
//
|
|
19
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
// See the License for the specific language governing permissions and
|
|
23
|
+
// limitations under the License.
|
|
24
|
+
//
|
|
25
|
+
// Node file defining the StatementCache class used to manage cached statements
|
|
26
|
+
//-----------------------------------------------------------------------------
|
|
27
|
+
|
|
28
|
+
const errors = require("../errors.js");
|
|
29
|
+
const { Statement } = require("./statement");
|
|
30
|
+
|
|
31
|
+
class StatementCache {
|
|
32
|
+
constructor(maxSize) {
|
|
33
|
+
this._cachedStatements = new Map();
|
|
34
|
+
this._maxSize = maxSize;
|
|
35
|
+
this._cursorsToClose = new Set();
|
|
36
|
+
this._openCursors = new Set();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//---------------------------------------------------------------------------
|
|
40
|
+
// _addCursorToClose()
|
|
41
|
+
//
|
|
42
|
+
// Add the statement's cursor to the list of cursors that need to be closed.
|
|
43
|
+
//---------------------------------------------------------------------------
|
|
44
|
+
_addCursorToClose(statement) {
|
|
45
|
+
if (this._cursorsToClose.has(statement.cursorId)) {
|
|
46
|
+
const reason = `attempt to close cursor ${statement.cursorId} twice`;
|
|
47
|
+
errors.throwErr(errors.ERR_INTERNAL, reason);
|
|
48
|
+
}
|
|
49
|
+
if (statement.cursorId != 0) {
|
|
50
|
+
this._cursorsToClose.add(statement.cursorId);
|
|
51
|
+
}
|
|
52
|
+
this._openCursors.delete(statement);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//---------------------------------------------------------------------------
|
|
56
|
+
// _adjustCache()
|
|
57
|
+
// Adjust the cache so that no more than the maximum number of statements
|
|
58
|
+
// are cached by removing least recently used statements
|
|
59
|
+
//---------------------------------------------------------------------------
|
|
60
|
+
_adjustCache() {
|
|
61
|
+
while (this._cachedStatements.size > this._maxSize) {
|
|
62
|
+
const sql = this._cachedStatements.keys().next().value;
|
|
63
|
+
const stmt = this._cachedStatements.get(sql);
|
|
64
|
+
this._cachedStatements.delete(sql);
|
|
65
|
+
if (stmt.inUse) {
|
|
66
|
+
stmt.returnToCache = false;
|
|
67
|
+
} else if (stmt.cursorId !== 0) {
|
|
68
|
+
this._addCursorToClose(stmt);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
//---------------------------------------------------------------------------
|
|
74
|
+
//clearOpenCursors() {
|
|
75
|
+
// Clears the list of open cursors and removes the list of cursors that
|
|
76
|
+
// need to be closed. This is required when a DRCP session change has
|
|
77
|
+
// taken place as the cursor ID values are invalidated.
|
|
78
|
+
//---------------------------------------------------------------------------
|
|
79
|
+
clearOpenCursors() {
|
|
80
|
+
const newOpenCursors = new Set();
|
|
81
|
+
for (const stmt of this._openCursors) {
|
|
82
|
+
stmt.cursorId = 0;
|
|
83
|
+
if (stmt.inUse) {
|
|
84
|
+
newOpenCursors.add(stmt);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
this._openCursors = newOpenCursors;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//---------------------------------------------------------------------------
|
|
91
|
+
// get_statement()
|
|
92
|
+
// Get a statement from the statement cache, or prepare a new statement
|
|
93
|
+
// for use. If a statement is already in use or the statement is not
|
|
94
|
+
// supposed to be cached, a copy will be made (and not returned to the
|
|
95
|
+
// cache).
|
|
96
|
+
//---------------------------------------------------------------------------
|
|
97
|
+
getStatement(sql, cacheStatement = false) {
|
|
98
|
+
let stmt = null;
|
|
99
|
+
if (sql) {
|
|
100
|
+
stmt = this._cachedStatements.get(sql);
|
|
101
|
+
if (!cacheStatement) {
|
|
102
|
+
this._openCursors.add(stmt);
|
|
103
|
+
this._cachedStatements.delete(sql);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (!stmt) {
|
|
107
|
+
stmt = new Statement();
|
|
108
|
+
if (sql) {
|
|
109
|
+
stmt._prepare(sql);
|
|
110
|
+
}
|
|
111
|
+
if (cacheStatement && !stmt.isDdl && this._maxSize > 0) {
|
|
112
|
+
stmt.returnToCache = true;
|
|
113
|
+
this._cachedStatements.set(sql, stmt);
|
|
114
|
+
this._adjustCache();
|
|
115
|
+
}
|
|
116
|
+
this._openCursors.add(stmt);
|
|
117
|
+
} else if (stmt.inUse || !cacheStatement) {
|
|
118
|
+
stmt = stmt._copy();
|
|
119
|
+
this._openCursors.add(stmt);
|
|
120
|
+
} else {
|
|
121
|
+
this._cachedStatements.delete(sql);
|
|
122
|
+
this._cachedStatements.set(sql, stmt);
|
|
123
|
+
}
|
|
124
|
+
stmt.inUse = true;
|
|
125
|
+
return stmt;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
//---------------------------------------------------------------------------
|
|
129
|
+
// returnStatement()
|
|
130
|
+
// Return the statement to the statement cache, if applicable. If the
|
|
131
|
+
// statement must not be returned to the statement cache, add the cursor
|
|
132
|
+
// id to the list of cursor ids to close on the next round trip to the
|
|
133
|
+
// database. Clear all bind variables and fetch variables in order to
|
|
134
|
+
// ensure that unnecessary references are not retained.
|
|
135
|
+
//---------------------------------------------------------------------------
|
|
136
|
+
returnStatement(statement) {
|
|
137
|
+
if (statement.bindInfoList) {
|
|
138
|
+
statement.bindInfoList.forEach(bindInfo => {
|
|
139
|
+
bindInfo.bindVar = null;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (statement.queryVars) {
|
|
143
|
+
statement.queryVars.forEach(queryVar => {
|
|
144
|
+
queryVar.values.fill(null);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (statement.returnToCache) {
|
|
148
|
+
statement.inUse = false;
|
|
149
|
+
} else if (statement.cursorId !== 0) {
|
|
150
|
+
this._addCursorToClose(statement);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
//---------------------------------------------------------------------------
|
|
155
|
+
// writeCursorsToClose()
|
|
156
|
+
// Write the list of cursors to close to the buffer.
|
|
157
|
+
//---------------------------------------------------------------------------
|
|
158
|
+
writeCursorsToClose(buf) {
|
|
159
|
+
buf.writeUB4(this._cursorsToClose.size);
|
|
160
|
+
for (const cursorNum of this._cursorsToClose.keys()) {
|
|
161
|
+
buf.writeUB4(cursorNum);
|
|
162
|
+
}
|
|
163
|
+
this._cursorsToClose.clear();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
module.exports = StatementCache;
|