oracledb 5.4.0 → 6.0.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/CHANGELOG.md +1 -1849
- package/LICENSE.txt +8 -222
- package/NOTICE.txt +1 -1
- package/README.md +38 -30
- package/SECURITY.md +38 -0
- package/THIRD_PARTY_LICENSES.txt +1 -1
- package/build/Release/oracledb-6.0.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.0.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.0.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.0.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.0.0-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 +146 -7
- package/lib/aqEnqOptions.js +59 -7
- package/lib/aqMessage.js +118 -7
- package/lib/aqQueue.js +242 -53
- package/lib/connection.js +1324 -465
- package/lib/constants.js +203 -0
- package/lib/dbObject.js +346 -32
- package/lib/errors.js +781 -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 +156 -68
- package/lib/oracledb.js +1051 -257
- package/lib/pool.js +654 -465
- package/lib/poolStatistics.js +23 -9
- package/lib/queryStream.js +14 -7
- package/lib/resultset.js +292 -171
- package/lib/settings.js +191 -0
- package/lib/sodaCollection.js +214 -201
- package/lib/sodaDatabase.js +107 -71
- package/lib/sodaDocCursor.js +44 -32
- package/lib/sodaDocument.js +76 -14
- package/lib/sodaOperation.js +131 -118
- package/lib/thin/connection.js +1038 -0
- package/lib/thin/dbObject.js +629 -0
- package/lib/thin/index.js +40 -0
- package/lib/thin/lob.js +188 -0
- package/lib/thin/pool.js +481 -0
- package/lib/thin/protocol/buffer.js +1040 -0
- package/lib/thin/protocol/capabilities.js +116 -0
- package/lib/thin/protocol/constants.js +764 -0
- package/lib/thin/protocol/encryptDecrypt.js +185 -0
- package/lib/thin/protocol/messages/auth.js +348 -0
- package/lib/thin/protocol/messages/base.js +475 -0
- package/lib/thin/protocol/messages/commit.js +56 -0
- package/lib/thin/protocol/messages/dataType.js +382 -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 +200 -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 +811 -0
- package/lib/thin/protocol/oson.js +660 -0
- package/lib/thin/protocol/packet.js +520 -0
- package/lib/thin/protocol/protocol.js +202 -0
- package/lib/thin/protocol/utils.js +88 -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 +620 -0
- package/lib/thin/sqlnet/ntTcp.js +525 -0
- package/lib/thin/sqlnet/nvStrToNvPair.js +783 -0
- package/lib/thin/sqlnet/packet.js +405 -0
- package/lib/thin/sqlnet/paramParser.js +205 -0
- package/lib/thin/sqlnet/sessionAtts.js +160 -0
- package/lib/thin/statement.js +301 -0
- package/lib/thin/util.js +289 -0
- package/lib/transformer.js +250 -0
- package/lib/types.js +357 -0
- package/lib/util.js +194 -108
- 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.4.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-5.4.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-5.4.0-linux-x64.node +0 -0
- package/build/Release/oracledb-5.4.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-5.4.0-win32-x64.node +0 -0
- package/build/Release/oracledb-5.4.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,22 @@
|
|
|
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');
|
|
23
34
|
const util = require('util');
|
|
24
35
|
|
|
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
|
-
}
|
|
36
|
+
// This version of node-oracledb works with Node.js 14.6 or later.
|
|
37
|
+
// Note: the checked version is the minimum required for Node-API
|
|
38
|
+
// compatibility. When new Node.js versions are released, older Node.js
|
|
39
|
+
// versions are dropped from the node-oracledb test plan.
|
|
40
|
+
//
|
|
41
|
+
// Keep this code in sync with package/install.js
|
|
42
|
+
const vs = process.version.substring(1).split(".").map(Number);
|
|
43
|
+
errors.assert(vs[0] > 14 || (vs[0] === 14 && vs[1] >= 6),
|
|
44
|
+
errors.ERR_NODE_TOO_OLD, nodbUtil.PACKAGE_JSON_VERSION, "14.6");
|
|
37
45
|
|
|
38
46
|
const AqDeqOptions = require('./aqDeqOptions.js');
|
|
39
47
|
const AqEnqOptions = require('./aqEnqOptions.js');
|
|
@@ -45,151 +53,501 @@ const Lob = require('./lob.js');
|
|
|
45
53
|
const Pool = require('./pool.js');
|
|
46
54
|
const PoolStatistics = require('./poolStatistics.js');
|
|
47
55
|
const ResultSet = require('./resultset.js');
|
|
56
|
+
const settings = require('./settings.js');
|
|
48
57
|
const SodaDatabase = require('./sodaDatabase.js');
|
|
49
58
|
const SodaCollection = require('./sodaCollection.js');
|
|
50
59
|
const SodaDocCursor = require('./sodaDocCursor.js');
|
|
51
60
|
const SodaDocument = require('./sodaDocument.js');
|
|
52
61
|
const SodaOperation = require('./sodaOperation.js');
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
const poolCache = {};
|
|
64
|
+
const tempUsedPoolAliases = {};
|
|
56
65
|
const defaultPoolAlias = 'default';
|
|
57
66
|
|
|
58
|
-
//
|
|
67
|
+
// save arguments for call to initOracleClient()
|
|
68
|
+
let _initOracleClientArgs;
|
|
69
|
+
let _thinDriverInitialized = false;
|
|
59
70
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
|
|
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;
|
|
91
109
|
}
|
|
92
110
|
|
|
111
|
+
// top-level functions
|
|
93
112
|
|
|
94
|
-
|
|
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
|
+
);
|
|
133
|
+
}
|
|
95
134
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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) {
|
|
142
|
+
|
|
143
|
+
// define normalized options (value returned to caller)
|
|
144
|
+
const outOptions = {};
|
|
145
|
+
|
|
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);
|
|
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;
|
|
109
163
|
}
|
|
110
164
|
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
|
|
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;
|
|
115
178
|
}
|
|
116
179
|
|
|
117
|
-
//
|
|
118
|
-
|
|
119
|
-
|
|
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
|
+
}
|
|
120
186
|
|
|
121
|
-
|
|
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;
|
|
192
|
+
}
|
|
122
193
|
|
|
123
|
-
|
|
124
|
-
|
|
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
|
+
}
|
|
200
|
+
|
|
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
|
+
}
|
|
207
|
+
|
|
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;
|
|
330
|
+
}
|
|
331
|
+
|
|
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
|
+
}
|
|
345
|
+
|
|
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
|
+
}
|
|
352
|
+
|
|
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;
|
|
125
419
|
}
|
|
126
420
|
|
|
127
|
-
|
|
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
|
+
}
|
|
128
427
|
|
|
129
|
-
|
|
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
|
+
}
|
|
130
435
|
|
|
131
|
-
|
|
132
|
-
|
|
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;
|
|
133
442
|
}
|
|
134
443
|
|
|
135
|
-
return pool;
|
|
136
444
|
}
|
|
137
445
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
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;
|
|
144
485
|
}
|
|
145
|
-
|
|
486
|
+
|
|
146
487
|
}
|
|
147
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;
|
|
148
495
|
}
|
|
149
496
|
|
|
150
|
-
// Oracledb functions and classes
|
|
151
497
|
|
|
152
498
|
//-----------------------------------------------------------------------------
|
|
153
499
|
// createPool()
|
|
154
|
-
//
|
|
500
|
+
//
|
|
501
|
+
// Create a pool with the specified options and return it to the caller.
|
|
155
502
|
//-----------------------------------------------------------------------------
|
|
156
|
-
async function createPool(
|
|
503
|
+
async function createPool(options) {
|
|
157
504
|
let poolAlias;
|
|
158
505
|
|
|
159
506
|
// check arguments
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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
|
|
170
518
|
&& !poolCache[defaultPoolAlias]
|
|
171
519
|
&& !tempUsedPoolAliases[defaultPoolAlias]) {
|
|
172
520
|
poolAlias = defaultPoolAlias;
|
|
173
521
|
}
|
|
174
522
|
if (poolCache[poolAlias] || tempUsedPoolAliases[poolAlias]) {
|
|
175
|
-
|
|
523
|
+
errors.throwErr(errors.ERR_POOL_WITH_ALIAS_ALREADY_EXISTS, poolAlias);
|
|
176
524
|
}
|
|
177
525
|
|
|
178
|
-
//
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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);
|
|
190
546
|
}
|
|
191
|
-
|
|
192
|
-
|
|
547
|
+
|
|
548
|
+
// initialize the Oracle client, if necessary
|
|
549
|
+
if (_initOracleClientArgs === undefined && !_thinDriverInitialized) {
|
|
550
|
+
_initializeThinDriver();
|
|
193
551
|
}
|
|
194
552
|
|
|
195
553
|
// Need to prevent another call in the same stack from succeeding, otherwise
|
|
@@ -199,166 +557,170 @@ async function createPool(poolAttrs) {
|
|
|
199
557
|
tempUsedPoolAliases[poolAlias] = true;
|
|
200
558
|
}
|
|
201
559
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (adjustedPoolAttrs.accessToken.token === undefined ||
|
|
206
|
-
adjustedPoolAttrs.accessToken.token === '' ||
|
|
207
|
-
adjustedPoolAttrs.accessToken.privateKey === undefined ||
|
|
208
|
-
adjustedPoolAttrs.accessToken.privateKey === '') {
|
|
209
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// cannot set username or password for token based authentication
|
|
213
|
-
if (adjustedPoolAttrs.user !== undefined ||
|
|
214
|
-
adjustedPoolAttrs.password !== undefined) {
|
|
215
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// homogeneous and externalAuth must be set to true for token based
|
|
219
|
-
// authentication
|
|
220
|
-
if (adjustedPoolAttrs.homogeneous === false ||
|
|
221
|
-
adjustedPoolAttrs.externalAuth === false) {
|
|
222
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-085'));
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
adjustedPoolAttrs.token = adjustedPoolAttrs.accessToken.token;
|
|
226
|
-
adjustedPoolAttrs.privateKey =
|
|
227
|
-
adjustedPoolAttrs.accessToken.privateKey;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
if (adjustedPoolAttrs.accessToken === undefined &&
|
|
231
|
-
adjustedPoolAttrs.accessTokenCallback !== undefined) {
|
|
232
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
|
|
233
|
-
}
|
|
234
|
-
|
|
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();
|
|
235
563
|
try {
|
|
236
|
-
|
|
237
|
-
|
|
564
|
+
await pool._impl.create(options);
|
|
565
|
+
} finally {
|
|
238
566
|
if (poolAlias) {
|
|
239
|
-
poolCache[poolAlias] = pool;
|
|
240
|
-
|
|
241
|
-
// It's now safe to remove this alias from the tempUsedPoolAliases.
|
|
242
567
|
delete tempUsedPoolAliases[poolAlias];
|
|
243
568
|
}
|
|
569
|
+
}
|
|
244
570
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
delete poolCache[pool.poolAlias];
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
return pool;
|
|
253
|
-
|
|
254
|
-
} catch (err) {
|
|
255
|
-
|
|
256
|
-
// We need to free this up since the creation of the pool failed.
|
|
257
|
-
if (poolAlias) {
|
|
258
|
-
delete tempUsedPoolAliases[poolAlias];
|
|
259
|
-
}
|
|
571
|
+
if (poolAlias) {
|
|
572
|
+
poolCache[poolAlias] = pool;
|
|
573
|
+
}
|
|
260
574
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
575
|
+
pool._setup(options, poolAlias);
|
|
576
|
+
pool._sessionCallback = sessionCallback;
|
|
577
|
+
pool.on('_afterPoolClose', () => {
|
|
578
|
+
if (pool.poolAlias) {
|
|
579
|
+
delete poolCache[pool.poolAlias];
|
|
264
580
|
}
|
|
581
|
+
});
|
|
265
582
|
|
|
266
|
-
|
|
267
|
-
}
|
|
583
|
+
return pool;
|
|
268
584
|
}
|
|
269
585
|
|
|
270
586
|
|
|
271
587
|
//-----------------------------------------------------------------------------
|
|
272
588
|
// getConnection()
|
|
273
|
-
//
|
|
589
|
+
//
|
|
590
|
+
// Gets either a standalone connection, or a connection from a pool (stored in
|
|
591
|
+
// the pool cache).
|
|
274
592
|
//-----------------------------------------------------------------------------
|
|
275
593
|
async function getConnection(a1) {
|
|
276
|
-
let
|
|
594
|
+
let options = {};
|
|
277
595
|
let poolAlias;
|
|
278
|
-
let connAttrs = {};
|
|
279
596
|
|
|
280
|
-
//
|
|
281
|
-
|
|
597
|
+
// determine if the connection should be acquired from a pool
|
|
598
|
+
errors.assertArgCount(arguments, 0, 1);
|
|
282
599
|
if (arguments.length == 0) {
|
|
283
600
|
poolAlias = defaultPoolAlias;
|
|
601
|
+
} else if (typeof a1 === 'string') {
|
|
602
|
+
poolAlias = a1;
|
|
284
603
|
} else {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
}
|
|
294
|
-
}
|
|
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);
|
|
295
612
|
}
|
|
296
613
|
|
|
297
|
-
//
|
|
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
|
+
|
|
298
645
|
if (poolAlias) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
return await pool.getConnection(connAttrs);
|
|
646
|
+
errors.assertParamValue(typeof poolAlias === 'string' ||
|
|
647
|
+
typeof poolAlias === 'number', 1);
|
|
648
|
+
}
|
|
304
649
|
|
|
305
|
-
|
|
306
|
-
} else {
|
|
307
|
-
if (connAttrs.accessToken !== undefined) {
|
|
308
|
-
// token and privateKey must be set for token based
|
|
309
|
-
// authentication
|
|
310
|
-
if (connAttrs.accessToken.token === undefined ||
|
|
311
|
-
connAttrs.accessToken.token === '' ||
|
|
312
|
-
connAttrs.accessToken.privateKey === undefined ||
|
|
313
|
-
connAttrs.accessToken.privateKey === '') {
|
|
314
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
|
|
315
|
-
}
|
|
650
|
+
poolAlias = poolAlias || defaultPoolAlias;
|
|
316
651
|
|
|
317
|
-
|
|
318
|
-
if (connAttrs.user !== undefined ||
|
|
319
|
-
connAttrs.password !== undefined) {
|
|
320
|
-
throw new Error(nodbUtil.getErrorMessage('NJS-084'));
|
|
321
|
-
}
|
|
652
|
+
pool = poolCache[poolAlias];
|
|
322
653
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
654
|
+
if (!pool) {
|
|
655
|
+
errors.throwErr(errors.ERR_POOL_WITH_ALIAS_NOT_FOUND, poolAlias);
|
|
656
|
+
}
|
|
327
657
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
connAttrs.accessToken.privateKey;
|
|
331
|
-
}
|
|
658
|
+
return pool;
|
|
659
|
+
}
|
|
332
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;
|
|
333
686
|
try {
|
|
334
|
-
|
|
687
|
+
oracledbCLib.initOracleClient(options, impl, settings);
|
|
335
688
|
} catch (err) {
|
|
336
|
-
|
|
337
|
-
|
|
689
|
+
const newErr = errors.transformErr(err);
|
|
690
|
+
if (newErr.code === "DPI-1047") {
|
|
691
|
+
newErr.message += "\n" + nodbUtil.getInstallHelp();
|
|
338
692
|
}
|
|
339
|
-
throw
|
|
693
|
+
throw newErr;
|
|
340
694
|
}
|
|
695
|
+
_initOracleClientArgs = arg1 || {};
|
|
696
|
+
} else if (!util.isDeepStrictEqual(_initOracleClientArgs, options)) {
|
|
697
|
+
errors.throwErr(errors.ERR_INIT_ORACLE_CLIENT_ARGS);
|
|
341
698
|
}
|
|
699
|
+
|
|
700
|
+
// driver mode initialization
|
|
701
|
+
// _initOracleClientArgs is populated and thin connection not created
|
|
702
|
+
settings.thin = false;
|
|
342
703
|
}
|
|
343
704
|
|
|
344
705
|
|
|
345
706
|
//-----------------------------------------------------------------------------
|
|
346
707
|
// shutdown()
|
|
347
|
-
//
|
|
708
|
+
//
|
|
709
|
+
// Shuts down the database.
|
|
348
710
|
//-----------------------------------------------------------------------------
|
|
349
711
|
async function shutdown(a1, a2) {
|
|
350
712
|
let connAttr = {};
|
|
351
|
-
let shutdownMode =
|
|
713
|
+
let shutdownMode = constants.SHUTDOWN_MODE_DEFAULT;
|
|
352
714
|
|
|
353
715
|
// verify the number and types of arguments
|
|
354
|
-
|
|
716
|
+
errors.assertArgCount(arguments, 0, 2);
|
|
355
717
|
if (arguments.length == 2) {
|
|
356
|
-
|
|
357
|
-
|
|
718
|
+
errors.assertParamValue(typeof a1 === 'object', 1);
|
|
719
|
+
errors.assertParamValue(typeof a2 === 'number', 2);
|
|
358
720
|
connAttr = a1;
|
|
359
721
|
shutdownMode = a2;
|
|
360
722
|
} else if (arguments.length == 1) {
|
|
361
|
-
|
|
723
|
+
errors.assertParamValue(typeof a1 === 'object', 1);
|
|
362
724
|
connAttr = a1;
|
|
363
725
|
}
|
|
364
726
|
|
|
@@ -370,7 +732,7 @@ async function shutdown(a1, a2) {
|
|
|
370
732
|
connectString: connAttr.connectString,
|
|
371
733
|
connectionString: connAttr.connectionString,
|
|
372
734
|
externalAuth: connAttr.externalAuth,
|
|
373
|
-
privilege:
|
|
735
|
+
privilege: constants.SYSOPER
|
|
374
736
|
};
|
|
375
737
|
|
|
376
738
|
const conn = await this.getConnection(dbConfig);
|
|
@@ -386,21 +748,22 @@ async function shutdown(a1, a2) {
|
|
|
386
748
|
|
|
387
749
|
//-----------------------------------------------------------------------------
|
|
388
750
|
// startup()
|
|
389
|
-
//
|
|
751
|
+
//
|
|
752
|
+
// Starts up the database.
|
|
390
753
|
//-----------------------------------------------------------------------------
|
|
391
754
|
async function startup(a1, a2) {
|
|
392
755
|
let connAttr = {};
|
|
393
756
|
let startupAttr = {};
|
|
394
757
|
|
|
395
758
|
// verify the number and types of arguments
|
|
396
|
-
|
|
759
|
+
errors.assertArgCount(arguments, 0, 2);
|
|
397
760
|
if (arguments.length == 2) {
|
|
398
|
-
|
|
399
|
-
|
|
761
|
+
errors.assertParamValue(typeof a1 === 'object', 1);
|
|
762
|
+
errors.assertParamValue(typeof a2 === 'object', 2);
|
|
400
763
|
connAttr = a1;
|
|
401
764
|
startupAttr = a2;
|
|
402
765
|
} else if (arguments.length == 1) {
|
|
403
|
-
|
|
766
|
+
errors.assertParamValue(typeof a1 === 'object', 1);
|
|
404
767
|
connAttr = a1;
|
|
405
768
|
}
|
|
406
769
|
|
|
@@ -426,30 +789,461 @@ async function startup(a1, a2) {
|
|
|
426
789
|
await conn.close();
|
|
427
790
|
}
|
|
428
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
|
+
},
|
|
429
1061
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
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
|
+
};
|