oracledb 5.5.0 → 6.0.1
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/CHANGELOG.md +1 -1875
- package/LICENSE.txt +8 -222
- package/NOTICE.txt +1 -1
- package/README.md +38 -30
- package/SECURITY.md +38 -0
- package/build/Release/oracledb-6.0.1-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.0.1-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.1-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.1-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.0.1-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.1-linux-x64.node +0 -0
- package/build/Release/oracledb-6.0.1-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.1-win32-x64.node +0 -0
- package/build/Release/oracledb-6.0.1-win32-x64.node-buildinfo.txt +1 -0
- package/examples/README.md +113 -0
- package/examples/dbconfig.js +100 -0
- package/examples/example.js +156 -0
- package/index.js +26 -0
- package/lib/aqDeqOptions.js +148 -8
- package/lib/aqEnqOptions.js +59 -7
- package/lib/aqMessage.js +118 -7
- package/lib/aqQueue.js +243 -53
- package/lib/connection.js +1326 -465
- package/lib/constants.js +203 -0
- package/lib/dbObject.js +346 -32
- package/lib/errors.js +785 -0
- package/lib/impl/aqDeqOptions.js +197 -0
- package/lib/impl/aqEnqOptions.js +89 -0
- package/lib/impl/aqMessage.js +134 -0
- package/lib/impl/aqQueue.js +81 -0
- package/lib/impl/connection.js +529 -0
- package/lib/impl/dbObject.js +159 -0
- package/lib/impl/index.js +59 -0
- package/lib/impl/lob.js +85 -0
- package/lib/impl/pool.js +195 -0
- package/lib/impl/resultset.js +223 -0
- package/lib/impl/sodaCollection.js +174 -0
- package/lib/impl/sodaDatabase.js +81 -0
- package/lib/impl/sodaDocCursor.js +63 -0
- package/lib/impl/sodaDocument.js +98 -0
- package/lib/impl/sodaOperation.js +109 -0
- package/lib/lob.js +157 -68
- package/lib/oracledb.js +1047 -345
- package/lib/pool.js +654 -465
- package/lib/poolStatistics.js +24 -9
- package/lib/queryStream.js +16 -8
- package/lib/resultset.js +291 -183
- package/lib/settings.js +191 -0
- package/lib/sodaCollection.js +214 -201
- package/lib/sodaDatabase.js +108 -71
- package/lib/sodaDocCursor.js +44 -32
- package/lib/sodaDocument.js +76 -14
- package/lib/sodaOperation.js +131 -118
- package/lib/thin/connection.js +1043 -0
- package/lib/thin/dbObject.js +630 -0
- package/lib/thin/index.js +40 -0
- package/lib/thin/lob.js +189 -0
- package/lib/thin/pool.js +481 -0
- package/lib/thin/protocol/buffer.js +1043 -0
- package/lib/thin/protocol/capabilities.js +121 -0
- package/lib/thin/protocol/constants.js +765 -0
- package/lib/thin/protocol/encryptDecrypt.js +185 -0
- package/lib/thin/protocol/messages/auth.js +349 -0
- package/lib/thin/protocol/messages/base.js +476 -0
- package/lib/thin/protocol/messages/commit.js +56 -0
- package/lib/thin/protocol/messages/dataType.js +391 -0
- package/lib/thin/protocol/messages/execute.js +312 -0
- package/lib/thin/protocol/messages/fetch.js +60 -0
- package/lib/thin/protocol/messages/index.js +53 -0
- package/lib/thin/protocol/messages/lobOp.js +201 -0
- package/lib/thin/protocol/messages/logOff.js +53 -0
- package/lib/thin/protocol/messages/ping.js +56 -0
- package/lib/thin/protocol/messages/protocol.js +78 -0
- package/lib/thin/protocol/messages/rollback.js +56 -0
- package/lib/thin/protocol/messages/sessionRelease.js +60 -0
- package/lib/thin/protocol/messages/withData.js +812 -0
- package/lib/thin/protocol/oson.js +661 -0
- package/lib/thin/protocol/packet.js +519 -0
- package/lib/thin/protocol/protocol.js +202 -0
- package/lib/thin/protocol/utils.js +89 -0
- package/lib/thin/resultSet.js +122 -0
- package/lib/thin/sqlnet/connStrategy.js +175 -0
- package/lib/thin/sqlnet/constants.js +199 -0
- package/lib/thin/sqlnet/ezConnectResolver.js +488 -0
- package/lib/thin/sqlnet/navNodes.js +870 -0
- package/lib/thin/sqlnet/networkSession.js +621 -0
- package/lib/thin/sqlnet/ntTcp.js +527 -0
- package/lib/thin/sqlnet/nvStrToNvPair.js +783 -0
- package/lib/thin/sqlnet/packet.js +405 -0
- package/lib/thin/sqlnet/paramParser.js +206 -0
- package/lib/thin/sqlnet/sessionAtts.js +160 -0
- package/lib/thin/statement.js +300 -0
- package/lib/thin/util.js +289 -0
- package/lib/transformer.js +252 -0
- package/lib/types.js +357 -0
- package/lib/util.js +196 -110
- package/lib/version.js +36 -0
- package/package/README.md +33 -30
- package/package/install.js +89 -64
- package/package/prunebinaries.js +60 -12
- package/package.json +3 -3
- package/build/Release/oracledb-5.5.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-5.5.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-5.5.0-linux-x64.node +0 -0
- package/build/Release/oracledb-5.5.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-5.5.0-win32-x64.node +0 -0
- package/build/Release/oracledb-5.5.0-win32-x64.node-buildinfo.txt +0 -1
package/lib/oracledb.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
// Copyright (c) 2015,
|
|
1
|
+
// Copyright (c) 2015, 2023, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
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.
|
|
7
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.
|
|
8
15
|
// You may obtain a copy of the License at
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
16
|
//
|
|
11
|
-
//
|
|
12
|
-
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
13
|
-
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
|
14
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.
|
|
15
22
|
// See the License for the specific language governing permissions and
|
|
16
23
|
// limitations under the License.
|
|
17
24
|
//
|
|
@@ -19,21 +26,23 @@
|
|
|
19
26
|
|
|
20
27
|
'use strict';
|
|
21
28
|
|
|
29
|
+
const constants = require('./constants.js');
|
|
22
30
|
const nodbUtil = require('./util.js');
|
|
31
|
+
const errors = require('./errors.js');
|
|
32
|
+
const types = require('./types.js');
|
|
33
|
+
const impl = require('./impl');
|
|
34
|
+
const process = require('process');
|
|
23
35
|
const util = require('util');
|
|
24
36
|
|
|
25
|
-
// This version of node-oracledb works with Node.js
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
//
|
|
29
|
-
//
|
|
30
|
-
//
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} else if ((vs[0] === 10 && vs[1] < 16)) {
|
|
35
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-069', nodbUtil.PACKAGE_JSON_VERSION, "10.16"));
|
|
36
|
-
}
|
|
37
|
+
// This version of node-oracledb works with Node.js 14.6 or later.
|
|
38
|
+
// Note: the checked version is the minimum required for Node-API
|
|
39
|
+
// compatibility. When new Node.js versions are released, older Node.js
|
|
40
|
+
// versions are dropped from the node-oracledb test plan.
|
|
41
|
+
//
|
|
42
|
+
// Keep this code in sync with package/install.js
|
|
43
|
+
const vs = process.version.substring(1).split(".").map(Number);
|
|
44
|
+
errors.assert(vs[0] > 14 || (vs[0] === 14 && vs[1] >= 6),
|
|
45
|
+
errors.ERR_NODE_TOO_OLD, nodbUtil.PACKAGE_JSON_VERSION, "14.6");
|
|
37
46
|
|
|
38
47
|
const AqDeqOptions = require('./aqDeqOptions.js');
|
|
39
48
|
const AqEnqOptions = require('./aqEnqOptions.js');
|
|
@@ -45,205 +54,500 @@ const Lob = require('./lob.js');
|
|
|
45
54
|
const Pool = require('./pool.js');
|
|
46
55
|
const PoolStatistics = require('./poolStatistics.js');
|
|
47
56
|
const ResultSet = require('./resultset.js');
|
|
57
|
+
const settings = require('./settings.js');
|
|
48
58
|
const SodaDatabase = require('./sodaDatabase.js');
|
|
49
59
|
const SodaCollection = require('./sodaCollection.js');
|
|
50
60
|
const SodaDocCursor = require('./sodaDocCursor.js');
|
|
51
61
|
const SodaDocument = require('./sodaDocument.js');
|
|
52
62
|
const SodaOperation = require('./sodaOperation.js');
|
|
53
63
|
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
const poolCache = {};
|
|
65
|
+
const tempUsedPoolAliases = {};
|
|
56
66
|
const defaultPoolAlias = 'default';
|
|
57
67
|
|
|
58
|
-
//
|
|
68
|
+
// save arguments for call to initOracleClient()
|
|
69
|
+
let _initOracleClientArgs;
|
|
70
|
+
let _thinDriverInitialized = false;
|
|
59
71
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
nodeInfo
|
|
85
|
-
|
|
86
|
-
|
|
72
|
+
// Load the Oracledb binary
|
|
73
|
+
function _initCLib() {
|
|
74
|
+
/*global __non_webpack_require__*/ // quieten eslint
|
|
75
|
+
const requireBinary = (typeof __non_webpack_require__ === 'function') ? __non_webpack_require__ : require; // See Issue 1156
|
|
76
|
+
|
|
77
|
+
const binaryLocations = [
|
|
78
|
+
'../' + nodbUtil.RELEASE_DIR + '/' + nodbUtil.BINARY_FILE, // pre-built binary
|
|
79
|
+
'../' + nodbUtil.RELEASE_DIR + '/' + 'oracledb.node', // binary built from source
|
|
80
|
+
'../build/Debug/oracledb.node', // debug binary
|
|
81
|
+
// Paths for Webpack.
|
|
82
|
+
// Note: to use node-oracledb Thick mode, you will need a Webpack copy plugin to
|
|
83
|
+
// copy 'node_modules/oracledb/build/' to the output directory,
|
|
84
|
+
// see https://github.com/oracle/node-oracledb/issues/1156
|
|
85
|
+
// If you want to use only node-oracledb Thin mode, a copy plugin is not needed.
|
|
86
|
+
'./node_modules/oracledb/' + nodbUtil.RELEASE_DIR + '/' + nodbUtil.BINARY_FILE,
|
|
87
|
+
'./node_modules/oracledb/' + nodbUtil.RELEASE_DIR + '/' + 'oracledb.node'
|
|
88
|
+
];
|
|
89
|
+
let oracledbCLib;
|
|
90
|
+
for (let i = 0; i < binaryLocations.length; i++) {
|
|
91
|
+
try {
|
|
92
|
+
oracledbCLib = requireBinary(binaryLocations[i]);
|
|
93
|
+
break;
|
|
94
|
+
} catch (err) {
|
|
95
|
+
if (err.code !== 'MODULE_NOT_FOUND' || i == binaryLocations.length - 1) {
|
|
96
|
+
let nodeInfo;
|
|
97
|
+
if (err.code === 'MODULE_NOT_FOUND') {
|
|
98
|
+
// A binary was not found in any of the search directories.
|
|
99
|
+
// Note this message may not be accurate for Webpack users since Webpack changes __dirname
|
|
100
|
+
nodeInfo = `\n Looked for ${binaryLocations.map(x => require('path').resolve(__dirname, x)).join(', ')}\n ${nodbUtil.getInstallURL()}\n`;
|
|
101
|
+
} else {
|
|
102
|
+
nodeInfo = `\n Node.js require('oracledb') error was:\n ${err.message}\n ${nodbUtil.getInstallHelp()}\n`;
|
|
103
|
+
}
|
|
104
|
+
errors.throwErr(errors.ERR_CANNOT_LOAD_BINARY, nodeInfo);
|
|
87
105
|
}
|
|
88
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-045', nodeInfo));
|
|
89
106
|
}
|
|
90
107
|
}
|
|
108
|
+
return oracledbCLib;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// top-level functions
|
|
112
|
+
|
|
113
|
+
function _initializeThinDriver() {
|
|
114
|
+
require('./thin');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//---------------------------------------------------------------------------
|
|
118
|
+
// _isPrivilege()
|
|
119
|
+
//
|
|
120
|
+
// Returns a boolean indicating if the supplied value is a valid privilege.
|
|
121
|
+
//---------------------------------------------------------------------------
|
|
122
|
+
function _isPrivilege(value) {
|
|
123
|
+
return (
|
|
124
|
+
value === constants.SYSASM ||
|
|
125
|
+
value === constants.SYSBACKUP ||
|
|
126
|
+
value === constants.SYSDBA ||
|
|
127
|
+
value === constants.SYSDG ||
|
|
128
|
+
value === constants.SYSKM ||
|
|
129
|
+
value === constants.SYSOPER ||
|
|
130
|
+
value === constants.SYSPRELIM ||
|
|
131
|
+
value === constants.SYSRAC
|
|
132
|
+
);
|
|
91
133
|
}
|
|
92
134
|
|
|
135
|
+
//-----------------------------------------------------------------------------
|
|
136
|
+
// _verifyOptions()
|
|
137
|
+
//
|
|
138
|
+
// Verify that the values passed by the user for connection and pool creation
|
|
139
|
+
// options are acceptable. Performs any transformations that are necessary.
|
|
140
|
+
//-----------------------------------------------------------------------------
|
|
141
|
+
async function _verifyOptions(options, inCreatePool) {
|
|
93
142
|
|
|
94
|
-
|
|
143
|
+
// define normalized options (value returned to caller)
|
|
144
|
+
const outOptions = {};
|
|
95
145
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
146
|
+
// only one of "user" and "username" may be specified (and must be strings)
|
|
147
|
+
if (options.user !== undefined) {
|
|
148
|
+
errors.assertParamPropValue(typeof options.user === 'string', 1, "user");
|
|
149
|
+
outOptions.user = options.user;
|
|
150
|
+
}
|
|
151
|
+
if (options.username !== undefined) {
|
|
152
|
+
errors.assert(outOptions.user === undefined, errors.ERR_DBL_USER);
|
|
153
|
+
errors.assertParamPropValue(typeof options.username === 'string', 1,
|
|
154
|
+
"username");
|
|
155
|
+
outOptions.user = options.username;
|
|
100
156
|
}
|
|
101
157
|
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
this.startup = nodbUtil.callbackify(startup).bind(_oracledb);
|
|
108
|
-
this.initOracleClient = this.initOracleClient.bind(_oracledb);
|
|
109
|
-
this._accessTokenHandler = this._accessTokenHandler.bind(_oracledb);
|
|
158
|
+
// password must be a string
|
|
159
|
+
if (options.password !== undefined) {
|
|
160
|
+
errors.assertParamPropValue(typeof options.password === 'string', 1,
|
|
161
|
+
"password");
|
|
162
|
+
outOptions.password = options.password;
|
|
110
163
|
}
|
|
111
164
|
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
165
|
+
// only one of "connectString" and "connectionString" may be specified (and
|
|
166
|
+
// must be strings)
|
|
167
|
+
if (options.connectString !== undefined) {
|
|
168
|
+
errors.assertParamPropValue(typeof options.connectString === 'string', 1,
|
|
169
|
+
"connectString");
|
|
170
|
+
outOptions.connectString = options.connectString;
|
|
171
|
+
}
|
|
172
|
+
if (options.connectionString !== undefined) {
|
|
173
|
+
errors.assert(outOptions.connectString === undefined,
|
|
174
|
+
errors.ERR_DBL_CONNECT_STRING);
|
|
175
|
+
errors.assertParamPropValue(typeof options.connectionString === 'string',
|
|
176
|
+
1, "connectionString");
|
|
177
|
+
outOptions.connectString = options.connectionString;
|
|
116
178
|
}
|
|
117
179
|
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
result = await result;
|
|
125
|
-
}
|
|
180
|
+
// wallet password must be string
|
|
181
|
+
if (options.walletPassword !== undefined) {
|
|
182
|
+
errors.assertParamPropValue(typeof options.walletPassword === 'string', 1,
|
|
183
|
+
"walletPassword");
|
|
184
|
+
outOptions.walletPassword = options.walletPassword;
|
|
185
|
+
}
|
|
126
186
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
187
|
+
//wallet location must be a string
|
|
188
|
+
if (options.walletLocation !== undefined) {
|
|
189
|
+
errors.assertParamPropValue(typeof options.walletLocation === 'string', 1,
|
|
190
|
+
"walletLocation");
|
|
191
|
+
outOptions.walletLocation = options.walletLocation;
|
|
132
192
|
}
|
|
133
193
|
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
|
|
194
|
+
// edition must be a string
|
|
195
|
+
if (options.edition !== undefined) {
|
|
196
|
+
errors.assertParamPropValue(typeof options.edition === 'string', 1,
|
|
197
|
+
"edition");
|
|
198
|
+
outOptions.edition = options.edition;
|
|
199
|
+
}
|
|
137
200
|
|
|
138
|
-
|
|
201
|
+
// stmtCacheSize must be an integer (>= 0)
|
|
202
|
+
if (options.stmtCacheSize !== undefined) {
|
|
203
|
+
errors.assertParamPropValue(Number.isInteger(options.stmtCacheSize) &&
|
|
204
|
+
options.stmtCacheSize >= 0, 1, "stmtCacheSize");
|
|
205
|
+
outOptions.stmtCacheSize = options.stmtCacheSize;
|
|
206
|
+
}
|
|
139
207
|
|
|
140
|
-
|
|
141
|
-
|
|
208
|
+
// externalAuth must be a boolean
|
|
209
|
+
outOptions.externalAuth = settings.externalAuth;
|
|
210
|
+
if (options.externalAuth !== undefined) {
|
|
211
|
+
errors.assertParamPropValue(typeof options.externalAuth === 'boolean', 1,
|
|
212
|
+
"externalAuth");
|
|
213
|
+
outOptions.externalAuth = options.externalAuth;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// events must be a boolean
|
|
217
|
+
if (options.events !== undefined) {
|
|
218
|
+
errors.assertParamPropValue(typeof options.events === 'boolean', 1,
|
|
219
|
+
"events");
|
|
220
|
+
outOptions.events = options.events;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// poolAlias must be a string
|
|
224
|
+
if (options.poolAlias !== undefined) {
|
|
225
|
+
errors.assertParamPropValue(typeof options.poolAlias === 'string' &&
|
|
226
|
+
options.poolAlias.length > 0, 1, "poolAlias");
|
|
227
|
+
outOptions.poolAlias = options.poolAlias;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// configDir must be a string
|
|
231
|
+
if (options.configDir !== undefined) {
|
|
232
|
+
errors.assertParamPropValue(typeof options.configDir === 'string',
|
|
233
|
+
1, "configDir");
|
|
234
|
+
outOptions.configDir = options.configDir;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// sslServerServerCertDN must be a string
|
|
238
|
+
if (options.sslServerCertDN !== undefined) {
|
|
239
|
+
errors.assertParamPropValue(typeof options.sslServerCertDN === 'string',
|
|
240
|
+
1, "sslServerCertDN");
|
|
241
|
+
outOptions.sslServerCertDN = options.sslServerCertDN;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// sslServerServerDNMatch must be a boolean
|
|
245
|
+
if (options.sslServerDNMatch !== undefined) {
|
|
246
|
+
errors.assertParamPropValue(typeof options.sslServerDNMatch === 'boolean',
|
|
247
|
+
1, "sslServerDNMatch");
|
|
248
|
+
outOptions.sslServerDNMatch = options.sslServerDNMatch;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// httpsProxy must be a string
|
|
252
|
+
if (options.httpsProxy !== undefined) {
|
|
253
|
+
errors.assertParamPropValue(typeof options.httpsProxy === 'string',
|
|
254
|
+
1, "httpsProxy");
|
|
255
|
+
outOptions.httpsProxy = options.httpsProxy;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// httpsProxyPort must be an integer (>= 0)
|
|
259
|
+
if (options.httpsProxyPort !== undefined) {
|
|
260
|
+
errors.assertParamPropValue(Number.isInteger(options.httpsProxyPort) &&
|
|
261
|
+
options.httpsProxyPort >= 0, 1, "httpsProxyPort");
|
|
262
|
+
outOptions.httpsProxyPort = options.httpsProxyPort;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
//retryCount must be an integer (>=0)
|
|
266
|
+
if (options.retryCount !== undefined) {
|
|
267
|
+
errors.assertParamPropValue(Number.isInteger(options.retryCount) &&
|
|
268
|
+
options.retryCount >= 0, 1, "retryCount");
|
|
269
|
+
outOptions.retryCount = options.retryCount;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
//retryDelay must be an integer (>=0)
|
|
273
|
+
if (options.retryDelay !== undefined) {
|
|
274
|
+
errors.assertParamPropValue(Number.isInteger(options.retryDelay) &&
|
|
275
|
+
options.retryDelay >= 0, 1, "retryDelay");
|
|
276
|
+
outOptions.retryDelay = options.retryDelay;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// connectTimeout must be an integer (>= 0)
|
|
280
|
+
if (options.connectTimeout !== undefined) {
|
|
281
|
+
errors.assertParamPropValue(Number.isInteger(options.connectTimeout) &&
|
|
282
|
+
options.connectTimeout >= 0, 1, "connectTimeout");
|
|
283
|
+
outOptions.connectTimeout = options.connectTimeout;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// transportConnectTimeout must be an integer (>= 0)
|
|
287
|
+
if (options.transportConnectTimeout !== undefined) {
|
|
288
|
+
errors.assertParamPropValue(Number.isInteger(options.transportConnectTimeout) &&
|
|
289
|
+
options.transportConnectTimeout >= 0, 1, "transportConnectTimeout");
|
|
290
|
+
outOptions.transportConnectTimeout = options.transportConnectTimeout;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// expireTime must be an integer (>= 0)
|
|
294
|
+
if (options.expireTime !== undefined) {
|
|
295
|
+
errors.assertParamPropValue(Number.isInteger(options.expireTime) &&
|
|
296
|
+
options.expireTime >= 0, 1, "expireTime");
|
|
297
|
+
outOptions.expireTime = options.expireTime;
|
|
298
|
+
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// sdu must be an integer (> 0)
|
|
302
|
+
if (options.sdu !== undefined) {
|
|
303
|
+
errors.assertParamPropValue(Number.isInteger(options.sdu) &&
|
|
304
|
+
options.sdu > 0, 1, "sdu");
|
|
305
|
+
outOptions.sdu = options.sdu;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// connectionIdPrefix must be a string
|
|
309
|
+
if (options.connectionIdPrefix !== undefined) {
|
|
310
|
+
errors.assertParamPropValue(typeof options.connectionIdPrefix === 'string',
|
|
311
|
+
1, "connectionIdPrefix");
|
|
312
|
+
outOptions.connectionIdPrefix = options.connectionIdPrefix;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// check pool specific options
|
|
316
|
+
if (inCreatePool) {
|
|
317
|
+
|
|
318
|
+
// poolMax must be an integer > 0
|
|
319
|
+
if (options.poolMax !== undefined) {
|
|
320
|
+
errors.assertParamPropValue(Number.isInteger(options.poolMax) &&
|
|
321
|
+
options.poolMax > 0, 1, "poolMax");
|
|
322
|
+
outOptions.poolMax = options.poolMax;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// poolMaxPerShard must be an integer >= 0
|
|
326
|
+
if (options.poolMaxPerShard !== undefined) {
|
|
327
|
+
errors.assertParamPropValue(Number.isInteger(options.poolMaxPerShard) &&
|
|
328
|
+
options.poolMaxPerShard >= 0, 1, "poolMaxPerShard");
|
|
329
|
+
outOptions.poolMaxPerShard = options.poolMaxPerShard;
|
|
142
330
|
}
|
|
143
331
|
|
|
144
|
-
|
|
332
|
+
// poolMin must be an integer >= 0
|
|
333
|
+
if (options.poolMin !== undefined) {
|
|
334
|
+
errors.assertParamPropValue(Number.isInteger(options.poolMin) &&
|
|
335
|
+
options.poolMin >= 0, 1, "poolMin");
|
|
336
|
+
outOptions.poolMin = options.poolMin;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// poolIncrement must be an integer >= 0
|
|
340
|
+
if (options.poolIncrement !== undefined) {
|
|
341
|
+
errors.assertParamPropValue(Number.isInteger(options.poolIncrement) &&
|
|
342
|
+
options.poolIncrement >= 0, 1, "poolIncrement");
|
|
343
|
+
outOptions.poolIncrement = options.poolIncrement;
|
|
344
|
+
}
|
|
145
345
|
|
|
146
|
-
|
|
346
|
+
// poolTimeout must be an integer >= 0
|
|
347
|
+
if (options.poolTimeout !== undefined) {
|
|
348
|
+
errors.assertParamPropValue(Number.isInteger(options.poolTimeout) &&
|
|
349
|
+
options.poolTimeout >= 0, 1, "poolTimeout");
|
|
350
|
+
outOptions.poolTimeout = options.poolTimeout;
|
|
351
|
+
}
|
|
147
352
|
|
|
148
|
-
|
|
149
|
-
|
|
353
|
+
// poolPingInterval must be an integer
|
|
354
|
+
if (options.poolPingInterval !== undefined) {
|
|
355
|
+
errors.assertParamPropValue(Number.isInteger(options.poolPingInterval) &&
|
|
356
|
+
options.poolPingInterval >= -2147483648 &&
|
|
357
|
+
options.poolPingInterval <= 2147483647, 1, "poolPingInterval");
|
|
358
|
+
outOptions.poolPingInterval = options.poolPingInterval;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// homogeneous must be a boolean (and defaults to True)
|
|
362
|
+
outOptions.homogeneous = true;
|
|
363
|
+
if (options.homogeneous !== undefined) {
|
|
364
|
+
errors.assertParamPropValue(typeof options.homogeneous === 'boolean', 1,
|
|
365
|
+
"homogeneous");
|
|
366
|
+
outOptions.homogeneous = options.homogeneous;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// queueTimeout must be an integer >= 0
|
|
370
|
+
if (options.queueTimeout !== undefined) {
|
|
371
|
+
errors.assertParamPropValue(Number.isInteger(options.queueTimeout) &&
|
|
372
|
+
options.queueTimeout >= 0, 1, "queueTimeout");
|
|
373
|
+
outOptions.queueTimeout = options.queueTimeout;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// queueMax must be an integer
|
|
377
|
+
if (options.queueMax !== undefined) {
|
|
378
|
+
errors.assertParamPropValue(Number.isInteger(options.queueMax), 1,
|
|
379
|
+
"queueMax");
|
|
380
|
+
outOptions.queueMax = options.queueMax;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// sodaMetaDataCache must be a boolean (and defaults to True)
|
|
384
|
+
outOptions.sodaMetaDataCache = false;
|
|
385
|
+
if (options.sodaMetaDataCache !== undefined) {
|
|
386
|
+
errors.assertParamPropValue(typeof options.sodaMetaDataCache ===
|
|
387
|
+
'boolean', 1, "sodaMetaDataCache");
|
|
388
|
+
outOptions.sodaMetaDataCache = options.sodaMetaDataCache;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// sessionCallback must be a function or a string
|
|
392
|
+
if (options.sessionCallback !== undefined) {
|
|
393
|
+
errors.assertParamPropValue(typeof options.sessionCallback === 'string' ||
|
|
394
|
+
typeof options.sessionCallback === 'function', 1, "sessionCallback");
|
|
395
|
+
outOptions.sessionCallback = options.sessionCallback;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
// enableStatistics must be a boolean (_enableStats is DEPRECATED)
|
|
399
|
+
outOptions.enableStatistics = false;
|
|
400
|
+
if (options.enableStatistics !== undefined) {
|
|
401
|
+
errors.assertParamPropValue(typeof options.enableStatistics ===
|
|
402
|
+
'boolean', 1, "enableStatistics");
|
|
403
|
+
outOptions.enableStatistics = options.enableStatistics;
|
|
404
|
+
}
|
|
405
|
+
if (!outOptions.enableStatistics && options._enableStats !== undefined) {
|
|
406
|
+
errors.assertParamPropValue(typeof options._enableStats === 'boolean', 1,
|
|
407
|
+
"_enableStats");
|
|
408
|
+
outOptions.enableStatistics = options._enableStats;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// check connection creation specific options
|
|
412
|
+
} else {
|
|
413
|
+
|
|
414
|
+
// newPassword must be a string
|
|
415
|
+
if (options.newPassword !== undefined) {
|
|
416
|
+
errors.assertParamPropValue(typeof options.newPassword === 'string', 1,
|
|
417
|
+
"newPassword");
|
|
418
|
+
outOptions.newPassword = options.newPassword;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// privilege must be one of a set of named constants
|
|
422
|
+
if (options.privilege !== undefined) {
|
|
423
|
+
errors.assertParamPropValue(_isPrivilege(options.privilege), 1,
|
|
424
|
+
"privilege");
|
|
425
|
+
outOptions.privilege = options.privilege;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// shardingKey must be an array of values
|
|
429
|
+
if (options.shardingKey !== undefined) {
|
|
430
|
+
const value = options.shardingKey;
|
|
431
|
+
errors.assertParamPropValue(nodbUtil.isShardingKey(value), 1,
|
|
432
|
+
"shardingKey");
|
|
433
|
+
outOptions.shardingKey = options.shardingKey;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// superShardingKey must be an array of values
|
|
437
|
+
if (options.superShardingKey !== undefined) {
|
|
438
|
+
const value = options.superShardingKey;
|
|
439
|
+
errors.assertParamPropValue(nodbUtil.isShardingKey(value), 1,
|
|
440
|
+
"superShardingKey");
|
|
441
|
+
outOptions.superShardingKey = options.superShardingKey;
|
|
150
442
|
}
|
|
151
443
|
|
|
152
|
-
return pool;
|
|
153
444
|
}
|
|
154
445
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
446
|
+
// check access token
|
|
447
|
+
if (options.accessToken !== undefined) {
|
|
448
|
+
|
|
449
|
+
// cannot set username or password for token based authentication
|
|
450
|
+
errors.assert(outOptions.user === undefined &&
|
|
451
|
+
outOptions.password === undefined, errors.ERR_TOKEN_BASED_AUTH);
|
|
452
|
+
|
|
453
|
+
// homogenous (for pool) and externalAuth (both) must be set
|
|
454
|
+
if (inCreatePool) {
|
|
455
|
+
errors.assert(outOptions.homogeneous && outOptions.externalAuth,
|
|
456
|
+
errors.ERR_POOL_TOKEN_BASED_AUTH);
|
|
457
|
+
} else {
|
|
458
|
+
errors.assert(outOptions.externalAuth, errors.ERR_CONN_TOKEN_BASED_AUTH);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// check the token is valid
|
|
462
|
+
let accessToken;
|
|
463
|
+
if (typeof options.accessToken === 'function') {
|
|
464
|
+
outOptions.accessTokenFn = options.accessToken;
|
|
465
|
+
accessToken = await options.accessToken(false);
|
|
466
|
+
if (!nodbUtil.isTokenValid(accessToken)) {
|
|
467
|
+
accessToken = await options.accessToken(true);
|
|
468
|
+
}
|
|
469
|
+
} else {
|
|
470
|
+
accessToken = options.accessToken;
|
|
471
|
+
}
|
|
472
|
+
errors.assert(nodbUtil.isTokenValid(accessToken),
|
|
473
|
+
errors.ERR_TOKEN_HAS_EXPIRED);
|
|
474
|
+
if (accessToken.privateKey !== undefined) {
|
|
475
|
+
errors.assert(nodbUtil.isPrivateKeyValid(accessToken),
|
|
476
|
+
errors.ERR_INVALID_PRIVATE_KEY);
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// store token and privatekey
|
|
480
|
+
if (typeof accessToken === 'string') {
|
|
481
|
+
outOptions.token = accessToken;
|
|
482
|
+
} else {
|
|
483
|
+
outOptions.token = accessToken.token;
|
|
484
|
+
outOptions.privateKey = accessToken.privateKey;
|
|
161
485
|
}
|
|
162
|
-
|
|
486
|
+
|
|
163
487
|
}
|
|
164
488
|
|
|
489
|
+
// Check external Auth config
|
|
490
|
+
if (outOptions.token === undefined && outOptions.externalAuth && (outOptions.user || outOptions.password)) {
|
|
491
|
+
errors.throwErr(errors.ERR_WRONG_CRED_FOR_EXTAUTH);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
return outOptions;
|
|
165
495
|
}
|
|
166
496
|
|
|
167
|
-
// Oracledb functions and classes
|
|
168
497
|
|
|
169
498
|
//-----------------------------------------------------------------------------
|
|
170
499
|
// createPool()
|
|
171
|
-
//
|
|
500
|
+
//
|
|
501
|
+
// Create a pool with the specified options and return it to the caller.
|
|
172
502
|
//-----------------------------------------------------------------------------
|
|
173
|
-
async function createPool(
|
|
503
|
+
async function createPool(options) {
|
|
174
504
|
let poolAlias;
|
|
175
505
|
|
|
176
506
|
// check arguments
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
507
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
508
|
+
errors.assertParamValue(nodbUtil.isObject(options), 1);
|
|
509
|
+
options = await _verifyOptions(options, true);
|
|
510
|
+
const sessionCallback = options.sessionCallback;
|
|
511
|
+
if (typeof sessionCallback === 'function')
|
|
512
|
+
delete options.sessionCallback;
|
|
513
|
+
|
|
514
|
+
// determine pool alias
|
|
515
|
+
if (options.poolAlias !== undefined) {
|
|
516
|
+
poolAlias = options.poolAlias;
|
|
517
|
+
} else if (options.poolAlias === undefined
|
|
187
518
|
&& !poolCache[defaultPoolAlias]
|
|
188
519
|
&& !tempUsedPoolAliases[defaultPoolAlias]) {
|
|
189
520
|
poolAlias = defaultPoolAlias;
|
|
190
521
|
}
|
|
191
522
|
if (poolCache[poolAlias] || tempUsedPoolAliases[poolAlias]) {
|
|
192
|
-
|
|
523
|
+
errors.throwErr(errors.ERR_POOL_WITH_ALIAS_ALREADY_EXISTS, poolAlias);
|
|
193
524
|
}
|
|
194
525
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
526
|
+
// add defaults to options, if needed
|
|
527
|
+
settings.addToOptions(options,
|
|
528
|
+
"connectionClass",
|
|
529
|
+
"edition",
|
|
530
|
+
"events",
|
|
531
|
+
"externalAuth",
|
|
532
|
+
"stmtCacheSize",
|
|
533
|
+
"poolMax",
|
|
534
|
+
"poolMaxPerShard",
|
|
535
|
+
"poolMin",
|
|
536
|
+
"poolIncrement",
|
|
537
|
+
"poolTimeout",
|
|
538
|
+
"poolPingInterval",
|
|
539
|
+
"queueMax",
|
|
540
|
+
"queueTimeout");
|
|
541
|
+
|
|
542
|
+
// poolMax must be greater than or equal to poolMin
|
|
543
|
+
if (options.poolMin > options.poolMax) {
|
|
544
|
+
errors.throwErr(errors.ERR_INVALID_NUMBER_OF_CONNECTIONS, options.poolMax,
|
|
545
|
+
options.poolMin);
|
|
208
546
|
}
|
|
209
547
|
|
|
210
|
-
//
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
// layer will wait for a connection to be returned; ordinarily since the
|
|
214
|
-
// JavaScript layer never calls the C layer to get a connection unless one is
|
|
215
|
-
// known to be available, this should not be needed, but in some cases (such
|
|
216
|
-
// as when the maximum for a particular shard is specified) this may not be
|
|
217
|
-
// known, so this prevents an unnecessarily long wait from taking place
|
|
218
|
-
const adjustedPoolAttrs = Object.defineProperties({},
|
|
219
|
-
Object.getOwnPropertyDescriptors(poolAttrs));
|
|
220
|
-
if (typeof poolAttrs.sessionCallback === 'function') {
|
|
221
|
-
delete adjustedPoolAttrs.sessionCallback;
|
|
222
|
-
}
|
|
223
|
-
if (adjustedPoolAttrs.queueTimeout === undefined) {
|
|
224
|
-
adjustedPoolAttrs.queueTimeout = this.queueTimeout;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// token based authentication
|
|
228
|
-
if (poolAttrs.accessToken !== undefined) {
|
|
229
|
-
// accessTokenCallback is depricated from node-oracledb 5.5
|
|
230
|
-
if (poolAttrs.accessTokenCallback !== undefined &&
|
|
231
|
-
typeof poolAttrs.accessToken === 'function') {
|
|
232
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-088'));
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
let accessToken;
|
|
236
|
-
if (typeof poolAttrs.accessToken === 'function') {
|
|
237
|
-
adjustedPoolAttrs.accessTokenCallback = poolAttrs.accessToken;
|
|
238
|
-
accessToken = await poolAttrs.accessToken(false);
|
|
239
|
-
|
|
240
|
-
if (_isTokenExpired(accessToken)) {
|
|
241
|
-
accessToken = await poolAttrs.accessToken(true);
|
|
242
|
-
}
|
|
243
|
-
} else {
|
|
244
|
-
accessToken = poolAttrs.accessToken;
|
|
245
|
-
}
|
|
246
|
-
_checkToken(accessToken, adjustedPoolAttrs);
|
|
548
|
+
// initialize the Oracle client, if necessary
|
|
549
|
+
if (_initOracleClientArgs === undefined && !_thinDriverInitialized) {
|
|
550
|
+
_initializeThinDriver();
|
|
247
551
|
}
|
|
248
552
|
|
|
249
553
|
// Need to prevent another call in the same stack from succeeding, otherwise
|
|
@@ -253,132 +557,170 @@ async function createPool(poolAttrs) {
|
|
|
253
557
|
tempUsedPoolAliases[poolAlias] = true;
|
|
254
558
|
}
|
|
255
559
|
|
|
560
|
+
// create the pool, ensuring that the temporary pool alias cache is removed
|
|
561
|
+
// once this has completed (either successfully or unsuccessfully)
|
|
562
|
+
const pool = new Pool();
|
|
256
563
|
try {
|
|
257
|
-
|
|
258
|
-
|
|
564
|
+
await pool._impl.create(options);
|
|
565
|
+
} finally {
|
|
259
566
|
if (poolAlias) {
|
|
260
|
-
poolCache[poolAlias] = pool;
|
|
261
|
-
|
|
262
|
-
// It's now safe to remove this alias from the tempUsedPoolAliases.
|
|
263
567
|
delete tempUsedPoolAliases[poolAlias];
|
|
264
568
|
}
|
|
569
|
+
}
|
|
265
570
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
delete poolCache[pool.poolAlias];
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
return pool;
|
|
274
|
-
|
|
275
|
-
} catch (err) {
|
|
276
|
-
|
|
277
|
-
// We need to free this up since the creation of the pool failed.
|
|
278
|
-
if (poolAlias) {
|
|
279
|
-
delete tempUsedPoolAliases[poolAlias];
|
|
280
|
-
}
|
|
571
|
+
if (poolAlias) {
|
|
572
|
+
poolCache[poolAlias] = pool;
|
|
573
|
+
}
|
|
281
574
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
575
|
+
pool._setup(options, poolAlias);
|
|
576
|
+
pool._sessionCallback = sessionCallback;
|
|
577
|
+
pool.on('_afterPoolClose', () => {
|
|
578
|
+
if (pool.poolAlias) {
|
|
579
|
+
delete poolCache[pool.poolAlias];
|
|
285
580
|
}
|
|
581
|
+
});
|
|
286
582
|
|
|
287
|
-
|
|
288
|
-
}
|
|
583
|
+
return pool;
|
|
289
584
|
}
|
|
290
585
|
|
|
291
586
|
|
|
292
587
|
//-----------------------------------------------------------------------------
|
|
293
588
|
// getConnection()
|
|
294
|
-
//
|
|
589
|
+
//
|
|
590
|
+
// Gets either a standalone connection, or a connection from a pool (stored in
|
|
591
|
+
// the pool cache).
|
|
295
592
|
//-----------------------------------------------------------------------------
|
|
296
593
|
async function getConnection(a1) {
|
|
297
|
-
let
|
|
594
|
+
let options = {};
|
|
298
595
|
let poolAlias;
|
|
299
|
-
let connAttrs = {};
|
|
300
596
|
|
|
301
|
-
//
|
|
302
|
-
|
|
597
|
+
// determine if the connection should be acquired from a pool
|
|
598
|
+
errors.assertArgCount(arguments, 0, 1);
|
|
303
599
|
if (arguments.length == 0) {
|
|
304
600
|
poolAlias = defaultPoolAlias;
|
|
601
|
+
} else if (typeof a1 === 'string') {
|
|
602
|
+
poolAlias = a1;
|
|
305
603
|
} else {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
}
|
|
604
|
+
options = a1;
|
|
605
|
+
errors.assertParamValue(nodbUtil.isObject(options), 1);
|
|
606
|
+
poolAlias = options.poolAlias;
|
|
607
|
+
}
|
|
608
|
+
if (poolAlias) {
|
|
609
|
+
const pool = poolCache[poolAlias];
|
|
610
|
+
errors.assert(pool, errors.ERR_POOL_WITH_ALIAS_NOT_FOUND, poolAlias);
|
|
611
|
+
return await pool.getConnection(options);
|
|
316
612
|
}
|
|
317
613
|
|
|
318
|
-
//
|
|
614
|
+
// create a standalone connection
|
|
615
|
+
options = await _verifyOptions(options, false);
|
|
616
|
+
settings.addToOptions(options,
|
|
617
|
+
"connectionClass",
|
|
618
|
+
"edition",
|
|
619
|
+
"events",
|
|
620
|
+
"externalAuth",
|
|
621
|
+
"stmtCacheSize");
|
|
622
|
+
if (_initOracleClientArgs === undefined && !settings.thinDriverInitialized) {
|
|
623
|
+
_initializeThinDriver();
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
const conn = new Connection();
|
|
627
|
+
conn._impl = new impl.ConnectionImpl();
|
|
628
|
+
await conn._impl.connect(options);
|
|
629
|
+
if (_initOracleClientArgs === undefined) {
|
|
630
|
+
settings.thinDriverInitialized = true;
|
|
631
|
+
}
|
|
632
|
+
return conn;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
//-----------------------------------------------------------------------------
|
|
636
|
+
// getPool()
|
|
637
|
+
//
|
|
638
|
+
// Returns a pool for the given alias.
|
|
639
|
+
//-----------------------------------------------------------------------------
|
|
640
|
+
function getPool(poolAlias) {
|
|
641
|
+
let pool;
|
|
642
|
+
|
|
643
|
+
errors.assertArgCount(arguments, 0, 1);
|
|
644
|
+
|
|
319
645
|
if (poolAlias) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
return await pool.getConnection(connAttrs);
|
|
646
|
+
errors.assertParamValue(typeof poolAlias === 'string' ||
|
|
647
|
+
typeof poolAlias === 'number', 1);
|
|
648
|
+
}
|
|
325
649
|
|
|
326
|
-
|
|
327
|
-
} else {
|
|
328
|
-
if (connAttrs.accessToken !== undefined) {
|
|
329
|
-
// cannot set username or password for token based authentication
|
|
330
|
-
if (connAttrs.user !== undefined ||
|
|
331
|
-
connAttrs.password !== undefined) {
|
|
332
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
|
|
333
|
-
}
|
|
650
|
+
poolAlias = poolAlias || defaultPoolAlias;
|
|
334
651
|
|
|
335
|
-
|
|
336
|
-
if (connAttrs.externalAuth === false) {
|
|
337
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-086'));
|
|
338
|
-
}
|
|
652
|
+
pool = poolCache[poolAlias];
|
|
339
653
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
654
|
+
if (!pool) {
|
|
655
|
+
errors.throwErr(errors.ERR_POOL_WITH_ALIAS_NOT_FOUND, poolAlias);
|
|
656
|
+
}
|
|
343
657
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
347
|
-
} else {
|
|
348
|
-
accessToken = connAttrs.accessToken;
|
|
349
|
-
}
|
|
350
|
-
_checkToken(accessToken, connAttrs);
|
|
351
|
-
}
|
|
658
|
+
return pool;
|
|
659
|
+
}
|
|
352
660
|
|
|
661
|
+
//-----------------------------------------------------------------------------
|
|
662
|
+
// initOracleClient()
|
|
663
|
+
//
|
|
664
|
+
// Initializes the Oracle Client.
|
|
665
|
+
//-----------------------------------------------------------------------------
|
|
666
|
+
function initOracleClient(arg1) {
|
|
667
|
+
let options = {};
|
|
668
|
+
errors.assertArgCount(arguments, 0, 1);
|
|
669
|
+
if (arg1 !== undefined) {
|
|
670
|
+
errors.assertParamValue(nodbUtil.isObject(arg1), 1);
|
|
671
|
+
options = {...arg1};
|
|
672
|
+
errors.assertParamPropString(options, 1, "libDir");
|
|
673
|
+
errors.assertParamPropString(options, 1, "configDir");
|
|
674
|
+
errors.assertParamPropString(options, 1, "errorUrl");
|
|
675
|
+
errors.assertParamPropString(options, 1, "driverName");
|
|
676
|
+
}
|
|
677
|
+
if (settings.thinDriverInitialized) {
|
|
678
|
+
errors.throwErr(errors.ERR_THIN_CONNECTION_ALREADY_CREATED);
|
|
679
|
+
}
|
|
680
|
+
if (_initOracleClientArgs === undefined) {
|
|
681
|
+
const oracledbCLib = _initCLib();
|
|
682
|
+
if (options.driverName === undefined)
|
|
683
|
+
options.driverName = constants.DEFAULT_DRIVER_NAME + " thk";
|
|
684
|
+
if (options.errorUrl === undefined)
|
|
685
|
+
options.errorUrl = constants.DEFAULT_ERROR_URL;
|
|
353
686
|
try {
|
|
354
|
-
|
|
687
|
+
oracledbCLib.initOracleClient(options, impl, settings);
|
|
355
688
|
} catch (err) {
|
|
356
|
-
|
|
357
|
-
|
|
689
|
+
const newErr = errors.transformErr(err);
|
|
690
|
+
if (newErr.code === "DPI-1047") {
|
|
691
|
+
newErr.message += "\n" + nodbUtil.getInstallHelp();
|
|
358
692
|
}
|
|
359
|
-
throw
|
|
693
|
+
throw newErr;
|
|
360
694
|
}
|
|
695
|
+
_initOracleClientArgs = arg1 || {};
|
|
696
|
+
} else if (!util.isDeepStrictEqual(_initOracleClientArgs, options)) {
|
|
697
|
+
errors.throwErr(errors.ERR_INIT_ORACLE_CLIENT_ARGS);
|
|
361
698
|
}
|
|
699
|
+
|
|
700
|
+
// driver mode initialization
|
|
701
|
+
// _initOracleClientArgs is populated and thin connection not created
|
|
702
|
+
settings.thin = false;
|
|
362
703
|
}
|
|
363
704
|
|
|
364
705
|
|
|
365
706
|
//-----------------------------------------------------------------------------
|
|
366
707
|
// shutdown()
|
|
367
|
-
//
|
|
708
|
+
//
|
|
709
|
+
// Shuts down the database.
|
|
368
710
|
//-----------------------------------------------------------------------------
|
|
369
711
|
async function shutdown(a1, a2) {
|
|
370
712
|
let connAttr = {};
|
|
371
|
-
let shutdownMode =
|
|
713
|
+
let shutdownMode = constants.SHUTDOWN_MODE_DEFAULT;
|
|
372
714
|
|
|
373
715
|
// verify the number and types of arguments
|
|
374
|
-
|
|
716
|
+
errors.assertArgCount(arguments, 0, 2);
|
|
375
717
|
if (arguments.length == 2) {
|
|
376
|
-
|
|
377
|
-
|
|
718
|
+
errors.assertParamValue(typeof a1 === 'object', 1);
|
|
719
|
+
errors.assertParamValue(typeof a2 === 'number', 2);
|
|
378
720
|
connAttr = a1;
|
|
379
721
|
shutdownMode = a2;
|
|
380
722
|
} else if (arguments.length == 1) {
|
|
381
|
-
|
|
723
|
+
errors.assertParamValue(typeof a1 === 'object', 1);
|
|
382
724
|
connAttr = a1;
|
|
383
725
|
}
|
|
384
726
|
|
|
@@ -390,7 +732,7 @@ async function shutdown(a1, a2) {
|
|
|
390
732
|
connectString: connAttr.connectString,
|
|
391
733
|
connectionString: connAttr.connectionString,
|
|
392
734
|
externalAuth: connAttr.externalAuth,
|
|
393
|
-
privilege:
|
|
735
|
+
privilege: constants.SYSOPER
|
|
394
736
|
};
|
|
395
737
|
|
|
396
738
|
const conn = await this.getConnection(dbConfig);
|
|
@@ -406,21 +748,22 @@ async function shutdown(a1, a2) {
|
|
|
406
748
|
|
|
407
749
|
//-----------------------------------------------------------------------------
|
|
408
750
|
// startup()
|
|
409
|
-
//
|
|
751
|
+
//
|
|
752
|
+
// Starts up the database.
|
|
410
753
|
//-----------------------------------------------------------------------------
|
|
411
754
|
async function startup(a1, a2) {
|
|
412
755
|
let connAttr = {};
|
|
413
756
|
let startupAttr = {};
|
|
414
757
|
|
|
415
758
|
// verify the number and types of arguments
|
|
416
|
-
|
|
759
|
+
errors.assertArgCount(arguments, 0, 2);
|
|
417
760
|
if (arguments.length == 2) {
|
|
418
|
-
|
|
419
|
-
|
|
761
|
+
errors.assertParamValue(typeof a1 === 'object', 1);
|
|
762
|
+
errors.assertParamValue(typeof a2 === 'object', 2);
|
|
420
763
|
connAttr = a1;
|
|
421
764
|
startupAttr = a2;
|
|
422
765
|
} else if (arguments.length == 1) {
|
|
423
|
-
|
|
766
|
+
errors.assertParamValue(typeof a1 === 'object', 1);
|
|
424
767
|
connAttr = a1;
|
|
425
768
|
}
|
|
426
769
|
|
|
@@ -446,102 +789,461 @@ async function startup(a1, a2) {
|
|
|
446
789
|
await conn.close();
|
|
447
790
|
}
|
|
448
791
|
|
|
792
|
+
// module exports
|
|
793
|
+
module.exports = {
|
|
794
|
+
|
|
795
|
+
// classes
|
|
796
|
+
AqDeqOptions,
|
|
797
|
+
AqEnqOptions,
|
|
798
|
+
AqMessage,
|
|
799
|
+
AqQueue,
|
|
800
|
+
BaseDbObject,
|
|
801
|
+
Connection,
|
|
802
|
+
Lob,
|
|
803
|
+
Pool,
|
|
804
|
+
PoolStatistics,
|
|
805
|
+
ResultSet,
|
|
806
|
+
SodaDatabase,
|
|
807
|
+
SodaCollection,
|
|
808
|
+
SodaDocCursor,
|
|
809
|
+
SodaDocument,
|
|
810
|
+
SodaOperation,
|
|
811
|
+
|
|
812
|
+
// top-level functions
|
|
813
|
+
getConnection: nodbUtil.callbackify(getConnection),
|
|
814
|
+
createPool: nodbUtil.callbackify(createPool),
|
|
815
|
+
getPool,
|
|
816
|
+
initOracleClient,
|
|
817
|
+
shutdown: nodbUtil.callbackify(shutdown),
|
|
818
|
+
startup: nodbUtil.callbackify(startup),
|
|
819
|
+
|
|
820
|
+
// CQN operation codes
|
|
821
|
+
CQN_OPCODE_ALL_OPS: constants.CQN_OPCODE_ALL_OPS,
|
|
822
|
+
CQN_OPCODE_ALL_ROWS: constants.CQN_OPCODE_ALL_ROWS,
|
|
823
|
+
CQN_OPCODE_ALTER: constants.CQN_OPCODE_ALTER,
|
|
824
|
+
CQN_OPCODE_DELETE: constants.CQN_OPCODE_DELETE,
|
|
825
|
+
CQN_OPCODE_DROP: constants.CQN_OPCODE_DROP,
|
|
826
|
+
CQN_OPCODE_INSERT: constants.CQN_OPCODE_INSERT,
|
|
827
|
+
CQN_OPCODE_UPDATE: constants.CQN_OPCODE_UPDATE,
|
|
828
|
+
|
|
829
|
+
// database types
|
|
830
|
+
DB_TYPE_BFILE: types.DB_TYPE_BFILE,
|
|
831
|
+
DB_TYPE_BINARY_DOUBLE: types.DB_TYPE_BINARY_DOUBLE,
|
|
832
|
+
DB_TYPE_BINARY_FLOAT: types.DB_TYPE_BINARY_FLOAT,
|
|
833
|
+
DB_TYPE_BINARY_INTEGER: types.DB_TYPE_BINARY_INTEGER,
|
|
834
|
+
DB_TYPE_BLOB: types.DB_TYPE_BLOB,
|
|
835
|
+
DB_TYPE_BOOLEAN: types.DB_TYPE_BOOLEAN,
|
|
836
|
+
DB_TYPE_CHAR: types.DB_TYPE_CHAR,
|
|
837
|
+
DB_TYPE_CLOB: types.DB_TYPE_CLOB,
|
|
838
|
+
DB_TYPE_CURSOR: types.DB_TYPE_CURSOR,
|
|
839
|
+
DB_TYPE_DATE: types.DB_TYPE_DATE,
|
|
840
|
+
DB_TYPE_INTERVAL_DS: types.DB_TYPE_INTERVAL_DS,
|
|
841
|
+
DB_TYPE_INTERVAL_YM: types.DB_TYPE_INTERVAL_YM,
|
|
842
|
+
DB_TYPE_JSON: types.DB_TYPE_JSON,
|
|
843
|
+
DB_TYPE_LONG: types.DB_TYPE_LONG,
|
|
844
|
+
DB_TYPE_LONG_NVARCHAR: types.DB_TYPE_LONG_NVARCHAR,
|
|
845
|
+
DB_TYPE_LONG_RAW: types.DB_TYPE_LONG_RAW,
|
|
846
|
+
DB_TYPE_NCHAR: types.DB_TYPE_NCHAR,
|
|
847
|
+
DB_TYPE_NCLOB: types.DB_TYPE_NCLOB,
|
|
848
|
+
DB_TYPE_NUMBER: types.DB_TYPE_NUMBER,
|
|
849
|
+
DB_TYPE_NVARCHAR: types.DB_TYPE_NVARCHAR,
|
|
850
|
+
DB_TYPE_OBJECT: types.DB_TYPE_OBJECT,
|
|
851
|
+
DB_TYPE_RAW: types.DB_TYPE_RAW,
|
|
852
|
+
DB_TYPE_ROWID: types.DB_TYPE_ROWID,
|
|
853
|
+
DB_TYPE_TIMESTAMP: types.DB_TYPE_TIMESTAMP,
|
|
854
|
+
DB_TYPE_TIMESTAMP_LTZ: types.DB_TYPE_TIMESTAMP_LTZ,
|
|
855
|
+
DB_TYPE_TIMESTAMP_TZ: types.DB_TYPE_TIMESTAMP_TZ,
|
|
856
|
+
DB_TYPE_VARCHAR: types.DB_TYPE_VARCHAR,
|
|
857
|
+
|
|
858
|
+
// fetchInfo type defaulting
|
|
859
|
+
DEFAULT: constants.DEFAULT,
|
|
860
|
+
|
|
861
|
+
// statement types
|
|
862
|
+
STMT_TYPE_UNKNOWN: constants.STMT_TYPE_UNKNOWN,
|
|
863
|
+
STMT_TYPE_SELECT: constants.STMT_TYPE_SELECT,
|
|
864
|
+
STMT_TYPE_UPDATE: constants.STMT_TYPE_UPDATE,
|
|
865
|
+
STMT_TYPE_DELETE: constants.STMT_TYPE_DELETE,
|
|
866
|
+
STMT_TYPE_INSERT: constants.STMT_TYPE_INSERT,
|
|
867
|
+
STMT_TYPE_CREATE: constants.STMT_TYPE_CREATE,
|
|
868
|
+
STMT_TYPE_DROP: constants.STMT_TYPE_DROP,
|
|
869
|
+
STMT_TYPE_ALTER: constants.STMT_TYPE_ALTER,
|
|
870
|
+
STMT_TYPE_BEGIN: constants.STMT_TYPE_BEGIN,
|
|
871
|
+
STMT_TYPE_DECLARE: constants.STMT_TYPE_DECLARE,
|
|
872
|
+
STMT_TYPE_CALL: constants.STMT_TYPE_CALL,
|
|
873
|
+
STMT_TYPE_EXPLAIN_PLAN: constants.STMT_TYPE_EXPLAIN_PLAN,
|
|
874
|
+
STMT_TYPE_MERGE: constants.STMT_TYPE_MERGE,
|
|
875
|
+
STMT_TYPE_ROLLBACK: constants.STMT_TYPE_ROLLBACK,
|
|
876
|
+
STMT_TYPE_COMMIT: constants.STMT_TYPE_COMMIT,
|
|
877
|
+
|
|
878
|
+
// shutdown modes
|
|
879
|
+
SHUTDOWN_MODE_DEFAULT: constants.SHUTDOWN_MODE_DEFAULT,
|
|
880
|
+
SHUTDOWN_MODE_TRANSACTIONAL: constants.SHUTDOWN_MODE_TRANSACTIONAL,
|
|
881
|
+
SHUTDOWN_MODE_TRANSACTIONAL_LOCAL:
|
|
882
|
+
constants.SHUTDOWN_MODE_TRANSACTIONAL_LOCAL,
|
|
883
|
+
SHUTDOWN_MODE_IMMEDIATE: constants.SHUTDOWN_MODE_IMMEDIATE,
|
|
884
|
+
SHUTDOWN_MODE_ABORT: constants.SHUTDOWN_MODE_ABORT,
|
|
885
|
+
SHUTDOWN_MODE_FINAL: constants.SHUTDOWN_MODE_FINAL,
|
|
886
|
+
|
|
887
|
+
// startup modes
|
|
888
|
+
STARTUP_MODE_DEFAULT: constants.STARTUP_MODE_DEFAULT,
|
|
889
|
+
STARTUP_MODE_FORCE: constants.STARTUP_MODE_FORCE,
|
|
890
|
+
STARTUP_MODE_RESTRICT: constants.STARTUP_MODE_RESTRICT,
|
|
891
|
+
|
|
892
|
+
// subscription event types
|
|
893
|
+
SUBSCR_EVENT_TYPE_SHUTDOWN: constants.SUBSCR_EVENT_TYPE_SHUTDOWN,
|
|
894
|
+
SUBSCR_EVENT_TYPE_SHUTDOWN_ANY: constants.SUBSCR_EVENT_TYPE_SHUTDOWN_ANY,
|
|
895
|
+
SUBSCR_EVENT_TYPE_STARTUP: constants.SUBSCR_EVENT_TYPE_STARTUP,
|
|
896
|
+
SUBSCR_EVENT_TYPE_DEREG: constants.SUBSCR_EVENT_TYPE_DEREG,
|
|
897
|
+
SUBSCR_EVENT_TYPE_OBJ_CHANGE: constants.SUBSCR_EVENT_TYPE_OBJ_CHANGE,
|
|
898
|
+
SUBSCR_EVENT_TYPE_QUERY_CHANGE: constants.SUBSCR_EVENT_TYPE_QUERY_CHANGE,
|
|
899
|
+
SUBSCR_EVENT_TYPE_AQ: constants.SUBSCR_EVENT_TYPE_AQ,
|
|
900
|
+
|
|
901
|
+
// subscription grouping classes
|
|
902
|
+
SUBSCR_GROUPING_CLASS_TIME: constants.SUBSCR_GROUPING_CLASS_TIME,
|
|
903
|
+
|
|
904
|
+
// subscription grouping types
|
|
905
|
+
SUBSCR_GROUPING_TYPE_SUMMARY: constants.SUBSCR_GROUPING_TYPE_SUMMARY,
|
|
906
|
+
SUBSCR_GROUPING_TYPE_LAST: constants.SUBSCR_GROUPING_TYPE_LAST,
|
|
907
|
+
|
|
908
|
+
// subscription namespaces
|
|
909
|
+
SUBSCR_NAMESPACE_AQ: constants.SUBSCR_NAMESPACE_AQ,
|
|
910
|
+
SUBSCR_NAMESPACE_DBCHANGE: constants.SUBSCR_NAMESPACE_DBCHANGE,
|
|
911
|
+
|
|
912
|
+
// subscription quality of service flags
|
|
913
|
+
SUBSCR_QOS_BEST_EFFORT: constants.SUBSCR_QOS_BEST_EFFORT,
|
|
914
|
+
SUBSCR_QOS_DEREG_NFY: constants.SUBSCR_QOS_DEREG_NFY,
|
|
915
|
+
SUBSCR_QOS_QUERY: constants.SUBSCR_QOS_QUERY,
|
|
916
|
+
SUBSCR_QOS_RELIABLE: constants.SUBSCR_QOS_RELIABLE,
|
|
917
|
+
SUBSCR_QOS_ROWIDS: constants.SUBSCR_QOS_ROWIDS,
|
|
918
|
+
|
|
919
|
+
// privileges
|
|
920
|
+
SYSASM: constants.SYSASM,
|
|
921
|
+
SYSBACKUP: constants.SYSBACKUP,
|
|
922
|
+
SYSDBA: constants.SYSDBA,
|
|
923
|
+
SYSDG: constants.SYSDG,
|
|
924
|
+
SYSKM: constants.SYSKM,
|
|
925
|
+
SYSOPER: constants.SYSOPER,
|
|
926
|
+
SYSPRELIM: constants.SYSPRELIM,
|
|
927
|
+
SYSRAC: constants.SYSRAC,
|
|
928
|
+
|
|
929
|
+
// bind directions
|
|
930
|
+
BIND_IN: constants.BIND_IN,
|
|
931
|
+
BIND_INOUT: constants.BIND_INOUT,
|
|
932
|
+
BIND_OUT: constants.BIND_OUT,
|
|
933
|
+
|
|
934
|
+
// outFormat values
|
|
935
|
+
OUT_FORMAT_ARRAY: constants.OUT_FORMAT_ARRAY,
|
|
936
|
+
OUT_FORMAT_OBJECT: constants.OUT_FORMAT_OBJECT,
|
|
937
|
+
|
|
938
|
+
// SODA collection creation modes
|
|
939
|
+
SODA_COLL_MAP_MODE: constants.SODA_COLL_MAP_MODE,
|
|
940
|
+
|
|
941
|
+
// pool statuses
|
|
942
|
+
POOL_STATUS_OPEN: constants.POOL_STATUS_OPEN,
|
|
943
|
+
POOL_STATUS_DRAINING: constants.POOL_STATUS_DRAINING,
|
|
944
|
+
POOL_STATUS_CLOSED: constants.POOL_STATUS_CLOSED,
|
|
945
|
+
POOL_STATUS_RECONFIGURING: constants.POOL_STATUS_RECONFIGURING,
|
|
946
|
+
|
|
947
|
+
// AQ dequeue wait options
|
|
948
|
+
AQ_DEQ_NO_WAIT: constants.AQ_DEQ_NO_WAIT,
|
|
949
|
+
AQ_DEQ_WAIT_FOREVER: constants.AQ_DEQ_WAIT_FOREVER,
|
|
950
|
+
|
|
951
|
+
// AQ dequeue modes
|
|
952
|
+
AQ_DEQ_MODE_BROWSE: constants.AQ_DEQ_MODE_BROWSE,
|
|
953
|
+
AQ_DEQ_MODE_LOCKED: constants.AQ_DEQ_MODE_LOCKED,
|
|
954
|
+
AQ_DEQ_MODE_REMOVE: constants.AQ_DEQ_MODE_REMOVE,
|
|
955
|
+
AQ_DEQ_MODE_REMOVE_NO_DATA: constants.AQ_DEQ_MODE_REMOVE_NO_DATA,
|
|
956
|
+
|
|
957
|
+
// AQ dequeue navigation flags
|
|
958
|
+
AQ_DEQ_NAV_FIRST_MSG: constants.AQ_DEQ_NAV_FIRST_MSG,
|
|
959
|
+
AQ_DEQ_NAV_NEXT_TRANSACTION: constants.AQ_DEQ_NAV_NEXT_TRANSACTION,
|
|
960
|
+
AQ_DEQ_NAV_NEXT_MSG: constants.AQ_DEQ_NAV_NEXT_MSG,
|
|
961
|
+
|
|
962
|
+
// AQ message delivery modes
|
|
963
|
+
AQ_MSG_DELIV_MODE_PERSISTENT: constants.AQ_MSG_DELIV_MODE_PERSISTENT,
|
|
964
|
+
AQ_MSG_DELIV_MODE_BUFFERED: constants.AQ_MSG_DELIV_MODE_BUFFERED,
|
|
965
|
+
AQ_MSG_DELIV_MODE_PERSISTENT_OR_BUFFERED:
|
|
966
|
+
constants.AQ_MSG_DELIV_MODE_PERSISTENT_OR_BUFFERED,
|
|
967
|
+
|
|
968
|
+
// AQ message states
|
|
969
|
+
AQ_MSG_STATE_READY: constants.AQ_MSG_STATE_READY,
|
|
970
|
+
AQ_MSG_STATE_WAITING: constants.AQ_MSG_STATE_WAITING,
|
|
971
|
+
AQ_MSG_STATE_PROCESSED: constants.AQ_MSG_STATE_PROCESSED,
|
|
972
|
+
AQ_MSG_STATE_EXPIRED: constants.AQ_MSG_STATE_EXPIRED,
|
|
973
|
+
|
|
974
|
+
// AQ visibility flags
|
|
975
|
+
AQ_VISIBILITY_IMMEDIATE: constants.AQ_VISIBILITY_IMMEDIATE,
|
|
976
|
+
AQ_VISIBILITY_ON_COMMIT: constants.AQ_VISIBILITY_ON_COMMIT,
|
|
977
|
+
|
|
978
|
+
// TPC/XA begin flags Constants
|
|
979
|
+
TPC_BEGIN_JOIN: constants.TPC_BEGIN_JOIN,
|
|
980
|
+
TPC_BEGIN_NEW: constants.TPC_BEGIN_NEW,
|
|
981
|
+
TPC_BEGIN_PROMOTE: constants.TPC_BEGIN_PROMOTE,
|
|
982
|
+
TPC_BEGIN_RESUME: constants.TPC_BEGIN_RESUME,
|
|
983
|
+
|
|
984
|
+
// TPC/XA two-phase commit flags
|
|
985
|
+
TPC_END_NORMAL: constants.TPC_END_NORMAL,
|
|
986
|
+
TPC_END_SUSPEND: constants.TPC_END_SUSPEND,
|
|
987
|
+
|
|
988
|
+
// database type aliases
|
|
989
|
+
BLOB: types.DB_TYPE_BLOB,
|
|
990
|
+
BUFFER: types.DB_TYPE_RAW,
|
|
991
|
+
CLOB: types.DB_TYPE_CLOB,
|
|
992
|
+
CURSOR: types.DB_TYPE_CURSOR,
|
|
993
|
+
DATE: types.DB_TYPE_TIMESTAMP,
|
|
994
|
+
NCLOB: types.DB_TYPE_NCLOB,
|
|
995
|
+
NUMBER: types.DB_TYPE_NUMBER,
|
|
996
|
+
STRING: types.DB_TYPE_VARCHAR,
|
|
997
|
+
|
|
998
|
+
// outFormat aliases
|
|
999
|
+
ARRAY: constants.OUT_FORMAT_ARRAY,
|
|
1000
|
+
OBJECT: constants.OUT_FORMAT_OBJECT,
|
|
1001
|
+
|
|
1002
|
+
// property getters
|
|
1003
|
+
get autoCommit() {
|
|
1004
|
+
return settings.autoCommit;
|
|
1005
|
+
},
|
|
1006
|
+
|
|
1007
|
+
get connectionClass() {
|
|
1008
|
+
return settings.connectionClass;
|
|
1009
|
+
},
|
|
1010
|
+
|
|
1011
|
+
get dbObjectAsPojo() {
|
|
1012
|
+
return settings.dbObjectAsPojo;
|
|
1013
|
+
},
|
|
1014
|
+
|
|
1015
|
+
get edition() {
|
|
1016
|
+
return settings.edition;
|
|
1017
|
+
},
|
|
1018
|
+
|
|
1019
|
+
get errorOnConcurrentExecute() {
|
|
1020
|
+
return settings.errorOnConcurrentExecute;
|
|
1021
|
+
},
|
|
1022
|
+
|
|
1023
|
+
get events() {
|
|
1024
|
+
return settings.events;
|
|
1025
|
+
},
|
|
1026
|
+
|
|
1027
|
+
get externalAuth() {
|
|
1028
|
+
return settings.externalAuth;
|
|
1029
|
+
},
|
|
1030
|
+
|
|
1031
|
+
get fetchArraySize() {
|
|
1032
|
+
return settings.fetchArraySize;
|
|
1033
|
+
},
|
|
1034
|
+
|
|
1035
|
+
get fetchAsBuffer() {
|
|
1036
|
+
return settings.fetchAsBuffer;
|
|
1037
|
+
},
|
|
1038
|
+
|
|
1039
|
+
get fetchAsString() {
|
|
1040
|
+
return settings.fetchAsString;
|
|
1041
|
+
},
|
|
1042
|
+
|
|
1043
|
+
get fetchTypeHandler() {
|
|
1044
|
+
return settings.fetchTypeHandler;
|
|
1045
|
+
},
|
|
1046
|
+
|
|
1047
|
+
get lobPrefetchSize() {
|
|
1048
|
+
return settings.lobPrefetchSize;
|
|
1049
|
+
},
|
|
1050
|
+
|
|
1051
|
+
get maxRows() {
|
|
1052
|
+
return settings.maxRows;
|
|
1053
|
+
},
|
|
1054
|
+
|
|
1055
|
+
get oracleClientVersion() {
|
|
1056
|
+
if (_initOracleClientArgs === undefined) {
|
|
1057
|
+
errors.throwNotImplemented("getting the Oracle Client version");
|
|
1058
|
+
}
|
|
1059
|
+
return settings.oracleClientVersion;
|
|
1060
|
+
},
|
|
449
1061
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
1062
|
+
get oracleClientVersionString() {
|
|
1063
|
+
if (_initOracleClientArgs === undefined) {
|
|
1064
|
+
errors.throwNotImplemented("getting the Oracle Client version");
|
|
1065
|
+
}
|
|
1066
|
+
return settings.oracleClientVersionString;
|
|
1067
|
+
},
|
|
1068
|
+
|
|
1069
|
+
get outFormat() {
|
|
1070
|
+
return settings.outFormat;
|
|
1071
|
+
},
|
|
1072
|
+
|
|
1073
|
+
get poolIncrement() {
|
|
1074
|
+
return settings.poolIncrement;
|
|
1075
|
+
},
|
|
1076
|
+
|
|
1077
|
+
get poolMax() {
|
|
1078
|
+
return settings.poolMax;
|
|
1079
|
+
},
|
|
1080
|
+
|
|
1081
|
+
get poolMaxPerShard() {
|
|
1082
|
+
return settings.poolMaxPerShard;
|
|
1083
|
+
},
|
|
1084
|
+
|
|
1085
|
+
get poolMin() {
|
|
1086
|
+
return settings.poolMin;
|
|
1087
|
+
},
|
|
1088
|
+
|
|
1089
|
+
get poolPingInterval() {
|
|
1090
|
+
return settings.poolPingInterval;
|
|
1091
|
+
},
|
|
1092
|
+
|
|
1093
|
+
get poolTimeout() {
|
|
1094
|
+
return settings.poolTimeout;
|
|
1095
|
+
},
|
|
1096
|
+
|
|
1097
|
+
get prefetchRows() {
|
|
1098
|
+
return settings.prefetchRows;
|
|
1099
|
+
},
|
|
1100
|
+
|
|
1101
|
+
get stmtCacheSize() {
|
|
1102
|
+
return settings.stmtCacheSize;
|
|
1103
|
+
},
|
|
1104
|
+
|
|
1105
|
+
get thin() {
|
|
1106
|
+
return settings.thin;
|
|
1107
|
+
},
|
|
1108
|
+
|
|
1109
|
+
get version() {
|
|
1110
|
+
return constants.VERSION_MAJOR * 10000 + constants.VERSION_MINOR * 100 +
|
|
1111
|
+
constants.VERSION_PATCH;
|
|
1112
|
+
},
|
|
1113
|
+
|
|
1114
|
+
get versionString() {
|
|
1115
|
+
return constants.VERSION_STRING;
|
|
1116
|
+
},
|
|
1117
|
+
|
|
1118
|
+
get versionSuffix() {
|
|
1119
|
+
return constants.VERSION_SUFFIX;
|
|
1120
|
+
},
|
|
1121
|
+
|
|
1122
|
+
// property setters
|
|
1123
|
+
set autoCommit(value) {
|
|
1124
|
+
errors.assertPropValue(typeof value === 'boolean', "autoCommit");
|
|
1125
|
+
settings.autoCommit = value;
|
|
1126
|
+
},
|
|
1127
|
+
|
|
1128
|
+
set connectionClass(value) {
|
|
1129
|
+
errors.assertPropValue(typeof value === 'string', "connectionClass");
|
|
1130
|
+
settings.connectionClass = value;
|
|
1131
|
+
},
|
|
1132
|
+
|
|
1133
|
+
set dbObjectAsPojo(value) {
|
|
1134
|
+
errors.assertPropValue(typeof value === 'boolean', "dbObjectAsPojo");
|
|
1135
|
+
settings.dbObjectAsPojo = value;
|
|
1136
|
+
},
|
|
1137
|
+
|
|
1138
|
+
set edition(value) {
|
|
1139
|
+
errors.assertPropValue(typeof value === 'string', "edition");
|
|
1140
|
+
settings.edition = value;
|
|
1141
|
+
},
|
|
1142
|
+
|
|
1143
|
+
set errorOnConcurrentExecute(value) {
|
|
1144
|
+
errors.assertPropValue(typeof value === 'boolean',
|
|
1145
|
+
"errorOnConcurrentExecute");
|
|
1146
|
+
settings.errorOnConcurrentExecute = value;
|
|
1147
|
+
},
|
|
1148
|
+
|
|
1149
|
+
set events(value) {
|
|
1150
|
+
errors.assertPropValue(typeof value === 'boolean', "events");
|
|
1151
|
+
settings.events = value;
|
|
1152
|
+
},
|
|
1153
|
+
|
|
1154
|
+
set externalAuth(value) {
|
|
1155
|
+
errors.assertPropValue(typeof value === 'boolean', "externalAuth");
|
|
1156
|
+
settings.externalAuth = value;
|
|
1157
|
+
},
|
|
1158
|
+
|
|
1159
|
+
set fetchArraySize(value) {
|
|
1160
|
+
errors.assertPropValue(Number.isInteger(value) && value > 0,
|
|
1161
|
+
"fetchArraySize");
|
|
1162
|
+
settings.fetchArraySize = value;
|
|
1163
|
+
},
|
|
1164
|
+
|
|
1165
|
+
set fetchAsBuffer(value) {
|
|
1166
|
+
errors.assertPropValue(Array.isArray(value), "fetchAsBuffer");
|
|
1167
|
+
settings.createFetchTypeMap(settings.fetchAsString, value);
|
|
1168
|
+
settings.fetchAsBuffer = value;
|
|
1169
|
+
},
|
|
1170
|
+
|
|
1171
|
+
set fetchAsString(value) {
|
|
1172
|
+
errors.assertPropValue(Array.isArray(value), "fetchAsString");
|
|
1173
|
+
settings.createFetchTypeMap(value, settings.fetchAsBuffer);
|
|
1174
|
+
settings.fetchAsString = value;
|
|
1175
|
+
},
|
|
1176
|
+
|
|
1177
|
+
set fetchTypeHandler(value) {
|
|
1178
|
+
if (value !== undefined) {
|
|
1179
|
+
errors.assertPropValue(typeof value === 'function', "fetchTypeHandler");
|
|
1180
|
+
}
|
|
1181
|
+
settings.fetchTypeHandler = value;
|
|
1182
|
+
},
|
|
1183
|
+
|
|
1184
|
+
set lobPrefetchSize(value) {
|
|
1185
|
+
errors.assertPropValue(Number.isInteger(value) && value >= 0,
|
|
1186
|
+
"lobPrefetchSize");
|
|
1187
|
+
settings.lobPrefetchSize = value;
|
|
1188
|
+
},
|
|
1189
|
+
|
|
1190
|
+
set maxRows(value) {
|
|
1191
|
+
errors.assertPropValue(Number.isInteger(value) && value >= 0, "maxRows");
|
|
1192
|
+
settings.maxRows = value;
|
|
1193
|
+
},
|
|
1194
|
+
|
|
1195
|
+
set outFormat(value) {
|
|
1196
|
+
if (value !== constants.OUT_FORMAT_ARRAY &&
|
|
1197
|
+
value !== constants.OUT_FORMAT_OBJECT) {
|
|
1198
|
+
errors.throwErr(errors.ERR_INVALID_PROPERTY_VALUE, "outFormat");
|
|
1199
|
+
}
|
|
1200
|
+
settings.outFormat = value;
|
|
1201
|
+
},
|
|
1202
|
+
|
|
1203
|
+
set poolIncrement(value) {
|
|
1204
|
+
errors.assertPropValue(Number.isInteger(value) && value >= 0,
|
|
1205
|
+
"poolIncrement");
|
|
1206
|
+
settings.poolIncrement = value;
|
|
1207
|
+
},
|
|
1208
|
+
|
|
1209
|
+
set poolMax(value) {
|
|
1210
|
+
errors.assertPropValue(Number.isInteger(value) && value >= 0, "poolMax");
|
|
1211
|
+
settings.poolMax = value;
|
|
1212
|
+
},
|
|
1213
|
+
|
|
1214
|
+
set poolMaxPerShard(value) {
|
|
1215
|
+
errors.assertPropValue(Number.isInteger(value) && value >= 0,
|
|
1216
|
+
"poolMaxPerShard");
|
|
1217
|
+
settings.poolMaxPerShard = value;
|
|
1218
|
+
},
|
|
1219
|
+
|
|
1220
|
+
set poolMin(value) {
|
|
1221
|
+
errors.assertPropValue(Number.isInteger(value) && value >= 0, "poolMin");
|
|
1222
|
+
settings.poolMin = value;
|
|
1223
|
+
},
|
|
1224
|
+
|
|
1225
|
+
set poolPingInterval(value) {
|
|
1226
|
+
errors.assertPropValue(Number.isInteger(value) && value < 2 ** 31 &&
|
|
1227
|
+
value >= (-2) ** 31, "poolPingInterval");
|
|
1228
|
+
settings.poolPingInterval = value;
|
|
1229
|
+
},
|
|
1230
|
+
|
|
1231
|
+
set poolTimeout(value) {
|
|
1232
|
+
errors.assertPropValue(Number.isInteger(value) && value >= 0,
|
|
1233
|
+
"poolTimeout");
|
|
1234
|
+
settings.poolTimeout = value;
|
|
1235
|
+
},
|
|
1236
|
+
|
|
1237
|
+
set prefetchRows(value) {
|
|
1238
|
+
errors.assertPropValue(Number.isInteger(value) && value >= 0,
|
|
1239
|
+
"prefetchRows");
|
|
1240
|
+
settings.prefetchRows = value;
|
|
1241
|
+
},
|
|
1242
|
+
|
|
1243
|
+
set stmtCacheSize(value) {
|
|
1244
|
+
errors.assertPropValue(Number.isInteger(value) && value >= 0,
|
|
1245
|
+
"stmtCacheSize");
|
|
1246
|
+
settings.stmtCacheSize = value;
|
|
1247
|
+
},
|
|
1248
|
+
|
|
1249
|
+
};
|