oracledb 5.5.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 -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.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 +1047 -345
- package/lib/pool.js +654 -465
- package/lib/poolStatistics.js +23 -9
- package/lib/queryStream.js +14 -7
- package/lib/resultset.js +291 -183
- 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 -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/errors.js
ADDED
|
@@ -0,0 +1,781 @@
|
|
|
1
|
+
// Copyright (c) 2022, 2023, Oracle and/or its affiliates.
|
|
2
|
+
|
|
3
|
+
//-----------------------------------------------------------------------------
|
|
4
|
+
//
|
|
5
|
+
// This software is dual-licensed to you under the Universal Permissive License
|
|
6
|
+
// (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
|
|
7
|
+
// 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
|
|
8
|
+
// either license.
|
|
9
|
+
//
|
|
10
|
+
// If you elect to accept the software under the Apache License, Version 2.0,
|
|
11
|
+
// the following applies:
|
|
12
|
+
//
|
|
13
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
// you may not use this file except in compliance with the License.
|
|
15
|
+
// You may obtain a copy of the License at
|
|
16
|
+
//
|
|
17
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
|
18
|
+
//
|
|
19
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
20
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
21
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
22
|
+
// See the License for the specific language governing permissions and
|
|
23
|
+
// limitations under the License.
|
|
24
|
+
//
|
|
25
|
+
//-----------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
'use strict';
|
|
28
|
+
|
|
29
|
+
const util = require('util');
|
|
30
|
+
|
|
31
|
+
// define error prefix for all messages
|
|
32
|
+
const ERR_PREFIX = "NJS";
|
|
33
|
+
|
|
34
|
+
// define error number constants (used in JavaScript library)
|
|
35
|
+
const ERR_INVALID_POOL = 2;
|
|
36
|
+
const ERR_INVALID_CONNECTION = 3;
|
|
37
|
+
const ERR_INVALID_PROPERTY_VALUE = 4;
|
|
38
|
+
const ERR_INVALID_PARAMETER_VALUE = 5;
|
|
39
|
+
const ERR_INVALID_PROPERTY_VALUE_IN_PARAM = 7;
|
|
40
|
+
const ERR_INVALID_NUMBER_OF_PARAMETERS = 9;
|
|
41
|
+
const ERR_UNSUPPORTED_DATA_TYPE = 10;
|
|
42
|
+
const ERR_BIND_VALUE_AND_TYPE_MISMATCH = 11;
|
|
43
|
+
const ERR_INVALID_BIND_DATA_TYPE = 12;
|
|
44
|
+
const ERR_INVALID_BIND_DIRECTION = 13;
|
|
45
|
+
const ERR_NO_TYPE_FOR_CONVERSION = 15;
|
|
46
|
+
const ERR_INSUFFICIENT_BUFFER_FOR_BINDS = 16;
|
|
47
|
+
const ERR_BUSY_RS = 17;
|
|
48
|
+
const ERR_INVALID_RS = 18;
|
|
49
|
+
const ERR_NOT_A_QUERY = 19;
|
|
50
|
+
const ERR_INVALID_TYPE_FOR_CONVERSION = 21;
|
|
51
|
+
const ERR_INVALID_LOB = 22;
|
|
52
|
+
const ERR_BUSY_LOB = 23;
|
|
53
|
+
const ERR_INSUFFICIENT_MEMORY = 24;
|
|
54
|
+
const ERR_INVALID_TYPE_FOR_ARRAY_BIND = 34;
|
|
55
|
+
const ERR_REQUIRED_MAX_ARRAY_SIZE = 35;
|
|
56
|
+
const ERR_INVALID_ARRAY_SIZE = 36;
|
|
57
|
+
const ERR_INCOMPATIBLE_TYPE_ARRAY_BIND = 37;
|
|
58
|
+
const ERR_CONN_REQUEST_TIMEOUT = 40;
|
|
59
|
+
const ERR_CANNOT_CONVERT_RS_TO_STREAM = 41;
|
|
60
|
+
const ERR_CANNOT_INVOKE_RS_METHODS = 42;
|
|
61
|
+
const ERR_RS_ALREADY_CONVERTED = 43;
|
|
62
|
+
const ERR_INVALID_BIND_UNIT = 44;
|
|
63
|
+
const ERR_CANNOT_LOAD_BINARY = 45;
|
|
64
|
+
const ERR_POOL_WITH_ALIAS_ALREADY_EXISTS = 46;
|
|
65
|
+
const ERR_POOL_WITH_ALIAS_NOT_FOUND = 47;
|
|
66
|
+
const ERR_INCOMPATIBLE_TYPE_ARRAY_INDEX_BIND = 52;
|
|
67
|
+
const ERR_MIXED_BIND = 55;
|
|
68
|
+
const ERR_MISSING_MAX_SIZE_BY_POS = 56;
|
|
69
|
+
const ERR_MISSING_MAX_SIZE_BY_NAME = 57;
|
|
70
|
+
const ERR_MAX_SIZE_TOO_SMALL = 58;
|
|
71
|
+
const ERR_MISSING_TYPE_BY_POS = 59;
|
|
72
|
+
const ERR_MISSING_TYPE_BY_NAME = 60;
|
|
73
|
+
const ERR_INVALID_SUBSCR = 61;
|
|
74
|
+
const ERR_MISSING_SUBSCR_CALLBACK = 62;
|
|
75
|
+
const ERR_MISSING_SUBSCR_SQL = 63;
|
|
76
|
+
const ERR_POOL_CLOSING = 64;
|
|
77
|
+
const ERR_POOL_CLOSED = 65;
|
|
78
|
+
const ERR_INVALID_SODA_DOC_CURSOR = 66;
|
|
79
|
+
const ERR_NO_BINARY_AVAILABLE = 67;
|
|
80
|
+
const ERR_INVALID_ERR_NUM = 68;
|
|
81
|
+
const ERR_NODE_TOO_OLD = 69;
|
|
82
|
+
const ERR_INVALID_AQ_MESSAGE = 70;
|
|
83
|
+
const ERR_DBL_CONNECT_STRING = 75;
|
|
84
|
+
const ERR_QUEUE_MAX_EXCEEDED = 76;
|
|
85
|
+
const ERR_UNSUPPORTED_DATA_TYPE_IN_JSON = 78;
|
|
86
|
+
const ERR_DBL_USER = 80;
|
|
87
|
+
const ERR_CONCURRENT_OPS = 81;
|
|
88
|
+
const ERR_POOL_RECONFIGURING = 82;
|
|
89
|
+
const ERR_POOL_STATISTICS_DISABLED = 83;
|
|
90
|
+
const ERR_TOKEN_BASED_AUTH = 84;
|
|
91
|
+
const ERR_POOL_TOKEN_BASED_AUTH = 85;
|
|
92
|
+
const ERR_CONN_TOKEN_BASED_AUTH = 86;
|
|
93
|
+
const ERR_TOKEN_HAS_EXPIRED = 87;
|
|
94
|
+
const ERR_NOT_IMPLEMENTED = 89;
|
|
95
|
+
const ERR_INIT_ORACLE_CLIENT_ARGS = 90;
|
|
96
|
+
const ERR_MISSING_FILE = 91;
|
|
97
|
+
const ERR_INVALID_NUMBER_OF_CONNECTIONS = 92;
|
|
98
|
+
const ERR_EXEC_MODE_ONLY_FOR_DML = 95;
|
|
99
|
+
const ERR_INVALID_BIND_NAME = 97;
|
|
100
|
+
const ERR_WRONG_NUMBER_OF_POSITIONAL_BINDS = 98;
|
|
101
|
+
const ERR_BUFFER_LENGTH_INSUFFICIENT = 99;
|
|
102
|
+
const ERR_NCHAR_CS_NOT_SUPPORTED = 100;
|
|
103
|
+
const ERR_MISSING_CREDENTIALS = 101;
|
|
104
|
+
const ERR_UNEXPECTED_END_OF_DATA = 102;
|
|
105
|
+
const ERR_UNEXPECTED_MESSAGE_TYPE = 103;
|
|
106
|
+
const ERR_POOL_HAS_BUSY_CONNECTIONS = 104;
|
|
107
|
+
const ERR_NAN_VALUE = 105;
|
|
108
|
+
const ERR_INTERNAL = 106;
|
|
109
|
+
const ERR_INVALID_REF_CURSOR = 107;
|
|
110
|
+
const ERR_LOB_CLOSED = 108;
|
|
111
|
+
const ERR_INVALID_TYPE_NUM = 109;
|
|
112
|
+
const ERR_INVALID_ORACLE_TYPE_NUM = 110;
|
|
113
|
+
const ERR_UNEXPECTED_NEGATIVE_INTEGER = 111;
|
|
114
|
+
const ERR_INTEGER_TOO_LARGE = 112;
|
|
115
|
+
const ERR_UNEXPECTED_DATA = 113;
|
|
116
|
+
const ERR_OSON_FIELD_NAME_LIMITATION = 114;
|
|
117
|
+
const ERR_ORACLE_NUMBER_NO_REPR = 115;
|
|
118
|
+
const ERR_UNSUPPORTED_VERIFIER_TYPE = 116;
|
|
119
|
+
const ERR_INVALID_PRIVATE_KEY = 117;
|
|
120
|
+
const ERR_THIN_CONNECTION_ALREADY_CREATED = 118;
|
|
121
|
+
const ERR_UNSUPPORTED_CONVERSION = 119;
|
|
122
|
+
const ERR_FETCH_TYPE_HANDLER_RETURN_VALUE = 120;
|
|
123
|
+
const ERR_FETCH_TYPE_HANDLER_TYPE = 121;
|
|
124
|
+
const ERR_FETCH_TYPE_HANDLER_CONVERTER = 122;
|
|
125
|
+
const ERR_CALL_TIMEOUT_EXCEEDED = 123;
|
|
126
|
+
const ERR_EMPTY_CONNECT_STRING = 125;
|
|
127
|
+
const ERR_OSON_VERSION_NOT_SUPPORTED = 126;
|
|
128
|
+
const ERR_UNKOWN_SERVER_SIDE_PIGGYBACK = 127;
|
|
129
|
+
const ERR_UNKNOWN_COLUMN_TYPE_NAME = 128;
|
|
130
|
+
const ERR_INVALID_OBJECT_TYPE_NAME = 129;
|
|
131
|
+
const ERR_TDS_TYPE_NOT_SUPPORTED = 130;
|
|
132
|
+
const ERR_INVALID_COLL_INDEX_SET = 131;
|
|
133
|
+
const ERR_INVALID_COLL_INDEX_GET = 132;
|
|
134
|
+
const ERR_DELETE_ELEMENTS_OF_VARRAY = 133;
|
|
135
|
+
const ERR_WRONG_VALUE_FOR_DBOBJECT_ATTR = 134;
|
|
136
|
+
const ERR_WRONG_VALUE_FOR_DBOBJECT_ELEM = 135;
|
|
137
|
+
const ERR_WRONG_CRED_FOR_EXTAUTH = 136;
|
|
138
|
+
const ERR_MISSING_BIND_VALUE = 137;
|
|
139
|
+
|
|
140
|
+
// Oracle Net layer errors start from 500
|
|
141
|
+
const ERR_CONNECTION_CLOSED = 500;
|
|
142
|
+
const ERR_CONNECTION_LOSTCONTACT = 501;
|
|
143
|
+
const ERR_CONNECTION_INCOMPLETE = 503;
|
|
144
|
+
const ERR_PROXY_CONNECTION_FAILURE = 504;
|
|
145
|
+
const ERR_TLS_INIT_FAILURE = 505;
|
|
146
|
+
const ERR_TLS_AUTH_FAILURE = 506;
|
|
147
|
+
const ERR_TLS_DNMATCH_FAILURE = 507;
|
|
148
|
+
const ERR_TLS_HOSTMATCH_FAILURE = 508;
|
|
149
|
+
const ERR_INVALID_PACKET = 509;
|
|
150
|
+
const ERR_CONNECTION_TIMEDOUT = 510;
|
|
151
|
+
const ERR_CONNECTION_REFUSED = 511;
|
|
152
|
+
const ERR_INVALID_CONNECT_STRING_PARAMETERS = 512;
|
|
153
|
+
const ERR_CONNECTION_INBAND = 513;
|
|
154
|
+
const ERR_INVALID_CONNECT_STRING_SYNTAX = 514;
|
|
155
|
+
const ERR_INVALID_EZCONNECT_SYNTAX = 515;
|
|
156
|
+
const ERR_NO_CONFIG_DIR = 516;
|
|
157
|
+
const ERR_TNS_ENTRY_NOT_FOUND = 517;
|
|
158
|
+
const ERR_INVALID_SERVICE_NAME = 518;
|
|
159
|
+
const ERR_INVALID_SID = 519;
|
|
160
|
+
const ERR_TNS_NAMES_FILE_MISSING = 520;
|
|
161
|
+
const ERR_CONNECTION_EOF = 521;
|
|
162
|
+
|
|
163
|
+
// define mapping for ODPI-C errors that need to be wrapped with NJS errors
|
|
164
|
+
const adjustErrorXref = new Map();
|
|
165
|
+
adjustErrorXref.set("DPI-1010", ERR_CONNECTION_CLOSED);
|
|
166
|
+
adjustErrorXref.set("DPI-1024", [ERR_INVALID_COLL_INDEX_GET, 'at index ([0-9]+) does']);
|
|
167
|
+
adjustErrorXref.set("DPI-1040", ERR_LOB_CLOSED);
|
|
168
|
+
adjustErrorXref.set("DPI-1044", ERR_ORACLE_NUMBER_NO_REPR);
|
|
169
|
+
adjustErrorXref.set("DPI-1055", ERR_NAN_VALUE);
|
|
170
|
+
adjustErrorXref.set("DPI-1063", ERR_EXEC_MODE_ONLY_FOR_DML);
|
|
171
|
+
adjustErrorXref.set("DPI-1067", [ERR_CALL_TIMEOUT_EXCEEDED, "call timeout of ([0-9]+) ms"]);
|
|
172
|
+
adjustErrorXref.set("DPI-1080", ERR_CONNECTION_CLOSED);
|
|
173
|
+
adjustErrorXref.set("OCI-22303", [ERR_INVALID_OBJECT_TYPE_NAME, 'type "([^"]*"."[^"]*)"']);
|
|
174
|
+
adjustErrorXref.set("OCI-22164", ERR_DELETE_ELEMENTS_OF_VARRAY);
|
|
175
|
+
adjustErrorXref.set("OCI-22165", [ERR_INVALID_COLL_INDEX_SET, /index \[([0-9]+)\] must be in the range of \[([0-9]+)\] to \[([0-9]+)\]/]);
|
|
176
|
+
adjustErrorXref.set("ORA-00028", ERR_CONNECTION_CLOSED);
|
|
177
|
+
adjustErrorXref.set("ORA-00600", ERR_CONNECTION_CLOSED);
|
|
178
|
+
adjustErrorXref.set("ORA-24338", ERR_INVALID_REF_CURSOR);
|
|
179
|
+
adjustErrorXref.set("ORA-24422", ERR_POOL_HAS_BUSY_CONNECTIONS);
|
|
180
|
+
adjustErrorXref.set("ORA-25708", ERR_TOKEN_HAS_EXPIRED);
|
|
181
|
+
|
|
182
|
+
// define mapping for error messages
|
|
183
|
+
const messages = new Map();
|
|
184
|
+
messages.set(ERR_INVALID_POOL, // NJS-002
|
|
185
|
+
'invalid pool');
|
|
186
|
+
messages.set(ERR_INVALID_CONNECTION, // NJS-003
|
|
187
|
+
'invalid connection');
|
|
188
|
+
messages.set(ERR_INVALID_PROPERTY_VALUE, // NJS-004
|
|
189
|
+
'invalid value for property "%s"');
|
|
190
|
+
messages.set(ERR_INVALID_PARAMETER_VALUE, // NJS-005
|
|
191
|
+
'invalid value for parameter %d');
|
|
192
|
+
messages.set(ERR_INVALID_PROPERTY_VALUE_IN_PARAM, // NJS-007
|
|
193
|
+
'invalid value for "%s" in parameter %d');
|
|
194
|
+
messages.set(ERR_INVALID_NUMBER_OF_PARAMETERS, // NJS-009
|
|
195
|
+
'invalid number of parameters');
|
|
196
|
+
// used in C -- keep synchronized!
|
|
197
|
+
messages.set(ERR_UNSUPPORTED_DATA_TYPE, // NJS-010
|
|
198
|
+
'unsupported data type %d in column %d');
|
|
199
|
+
messages.set(ERR_BIND_VALUE_AND_TYPE_MISMATCH, // NJS-011
|
|
200
|
+
'encountered bind value and type mismatch');
|
|
201
|
+
messages.set(ERR_INVALID_BIND_DATA_TYPE, // NJS-012
|
|
202
|
+
'encountered invalid bind data type in parameter %d');
|
|
203
|
+
messages.set(ERR_INVALID_BIND_DIRECTION, // NJS-013
|
|
204
|
+
'invalid bind direction');
|
|
205
|
+
messages.set(ERR_NO_TYPE_FOR_CONVERSION, // NJS-015
|
|
206
|
+
'type was not specified for conversion');
|
|
207
|
+
// used in C -- keep synchronized!
|
|
208
|
+
messages.set(ERR_INSUFFICIENT_BUFFER_FOR_BINDS, // NJS-016
|
|
209
|
+
'buffer is too small for OUT binds');
|
|
210
|
+
messages.set(ERR_BUSY_RS, // NJS-017
|
|
211
|
+
'concurrent operations on ResultSet are not allowed');
|
|
212
|
+
messages.set(ERR_INVALID_RS, // NJS-018
|
|
213
|
+
'invalid ResultSet');
|
|
214
|
+
messages.set(ERR_NOT_A_QUERY, // NJS-019
|
|
215
|
+
'ResultSet cannot be returned for non-query statements');
|
|
216
|
+
messages.set(ERR_INVALID_TYPE_FOR_CONVERSION, // NJS-021
|
|
217
|
+
'invalid type for conversion specified');
|
|
218
|
+
messages.set(ERR_INVALID_LOB, // NJS-022
|
|
219
|
+
'invalid Lob');
|
|
220
|
+
messages.set(ERR_BUSY_LOB, // NJS-023
|
|
221
|
+
'concurrent operations on a Lob are not allowed');
|
|
222
|
+
// used in C -- keep synchronized!
|
|
223
|
+
messages.set(ERR_INSUFFICIENT_MEMORY, // NJS-024
|
|
224
|
+
'memory allocation failed');
|
|
225
|
+
messages.set(ERR_INVALID_TYPE_FOR_ARRAY_BIND, // NJS-034
|
|
226
|
+
'data type is unsupported for array bind');
|
|
227
|
+
messages.set(ERR_REQUIRED_MAX_ARRAY_SIZE, // NJS-035
|
|
228
|
+
'maxArraySize is required for IN OUT array bind');
|
|
229
|
+
messages.set(ERR_INVALID_ARRAY_SIZE, // NJS-036
|
|
230
|
+
'length of given array is greater than "maxArraySize"');
|
|
231
|
+
messages.set(ERR_INCOMPATIBLE_TYPE_ARRAY_BIND, // NJS-037
|
|
232
|
+
'invalid data type at array index %d for bind ":%s"');
|
|
233
|
+
messages.set(ERR_CONN_REQUEST_TIMEOUT, // NJS-040
|
|
234
|
+
'connection request timeout. Request exceeded "queueTimeout" of %d');
|
|
235
|
+
messages.set(ERR_CANNOT_CONVERT_RS_TO_STREAM, // NJS-041
|
|
236
|
+
'cannot convert ResultSet to QueryStream after invoking methods');
|
|
237
|
+
messages.set(ERR_CANNOT_INVOKE_RS_METHODS, // NJS-042
|
|
238
|
+
'cannot invoke ResultSet methods after converting to QueryStream');
|
|
239
|
+
messages.set(ERR_RS_ALREADY_CONVERTED, // NJS-043
|
|
240
|
+
'ResultSet already converted to QueryStream');
|
|
241
|
+
messages.set(ERR_INVALID_BIND_UNIT, // NJS-044
|
|
242
|
+
'bind object must contain one of the following attributes: "dir", "type", "maxSize", or "val"');
|
|
243
|
+
messages.set(ERR_CANNOT_LOAD_BINARY, // NJS-045
|
|
244
|
+
'cannot load a node-oracledb Thick mode binary for Node.js. Please try using Thin mode. %s');
|
|
245
|
+
messages.set(ERR_POOL_WITH_ALIAS_ALREADY_EXISTS, // NJS-046
|
|
246
|
+
'pool alias "%s" already exists in the connection pool cache');
|
|
247
|
+
messages.set(ERR_POOL_WITH_ALIAS_NOT_FOUND, // NJS-047
|
|
248
|
+
'pool alias "%s" not found in connection pool cache');
|
|
249
|
+
messages.set(ERR_INCOMPATIBLE_TYPE_ARRAY_INDEX_BIND, // NJS-052
|
|
250
|
+
'invalid data type at array index %d for bind position %d');
|
|
251
|
+
messages.set(ERR_MIXED_BIND, // NJS-055
|
|
252
|
+
'binding by position and name cannot be mixed');
|
|
253
|
+
messages.set(ERR_MISSING_MAX_SIZE_BY_POS, // NJS-056
|
|
254
|
+
'maxSize for bind position %d must be specified and be greater than zero');
|
|
255
|
+
messages.set(ERR_MISSING_MAX_SIZE_BY_NAME, // NJS-057
|
|
256
|
+
'maxSize for bind "%s" must be specified and greater than zero');
|
|
257
|
+
messages.set(ERR_MAX_SIZE_TOO_SMALL, // NJS-058
|
|
258
|
+
'maxSize of %d is too small for value of length %d in row %d');
|
|
259
|
+
messages.set(ERR_MISSING_TYPE_BY_POS, // NJS-059
|
|
260
|
+
'type must be specified for bind position %d');
|
|
261
|
+
messages.set(ERR_MISSING_TYPE_BY_NAME, // NJS-060
|
|
262
|
+
'type must be specified for bind "%s"');
|
|
263
|
+
messages.set(ERR_INVALID_SUBSCR, // NJS-061
|
|
264
|
+
'invalid subscription');
|
|
265
|
+
messages.set(ERR_MISSING_SUBSCR_CALLBACK, // NJS-062
|
|
266
|
+
'subscription notification callback missing');
|
|
267
|
+
messages.set(ERR_MISSING_SUBSCR_SQL, // NJS-063
|
|
268
|
+
'subscription notification SQL missing');
|
|
269
|
+
messages.set(ERR_POOL_CLOSING, // NJS-064
|
|
270
|
+
'connection pool is closing');
|
|
271
|
+
messages.set(ERR_POOL_CLOSED, // NJS-065
|
|
272
|
+
'connection pool was closed');
|
|
273
|
+
messages.set(ERR_INVALID_SODA_DOC_CURSOR, // NJS-066
|
|
274
|
+
'invalid SODA document cursor');
|
|
275
|
+
messages.set(ERR_NO_BINARY_AVAILABLE, // NJS-067
|
|
276
|
+
'a pre-built node-oracledb Thick mode binary was not found for %s');
|
|
277
|
+
messages.set(ERR_INVALID_ERR_NUM, // NJS-068
|
|
278
|
+
'invalid error number %d supplied');
|
|
279
|
+
messages.set(ERR_NODE_TOO_OLD, // NJS-069
|
|
280
|
+
'node-oracledb %s requires Node.js %s or later');
|
|
281
|
+
messages.set(ERR_INVALID_AQ_MESSAGE, // NJS-070
|
|
282
|
+
'message must be a string, buffer, database object or an object containing a payload property which itself is a string, buffer or database object');
|
|
283
|
+
messages.set(ERR_DBL_CONNECT_STRING, // NJS-075
|
|
284
|
+
'only one of "connectString" and "connectionString" can be used');
|
|
285
|
+
messages.set(ERR_QUEUE_MAX_EXCEEDED, // NJS-076
|
|
286
|
+
'connection request rejected. Pool queue length "queueMax" %d reached');
|
|
287
|
+
// used in C -- keep synchronized!
|
|
288
|
+
messages.set(ERR_UNSUPPORTED_DATA_TYPE_IN_JSON, // NJS-078
|
|
289
|
+
'unsupported data type %d in JSON value');
|
|
290
|
+
messages.set(ERR_DBL_USER, // NJS-080
|
|
291
|
+
'only one of "user" and "username" can be used');
|
|
292
|
+
messages.set(ERR_CONCURRENT_OPS, // NJS-081
|
|
293
|
+
'concurrent operations on a connection are disabled');
|
|
294
|
+
messages.set(ERR_POOL_RECONFIGURING, // NJS-082
|
|
295
|
+
'connection pool is being reconfigured');
|
|
296
|
+
messages.set(ERR_POOL_STATISTICS_DISABLED, // NJS-083
|
|
297
|
+
'pool statistics are not enabled');
|
|
298
|
+
messages.set(ERR_TOKEN_BASED_AUTH, // NJS-084
|
|
299
|
+
'invalid access token');
|
|
300
|
+
messages.set(ERR_POOL_TOKEN_BASED_AUTH, // NJS-085
|
|
301
|
+
'invalid connection pool configuration with token-based authentication. The "homogeneous" and "externalAuth" attributes must be set to true');
|
|
302
|
+
messages.set(ERR_CONN_TOKEN_BASED_AUTH, // NJS-086
|
|
303
|
+
'invalid standalone configuration with token-based authentication. The "externalAuth" attribute must be set to true');
|
|
304
|
+
messages.set(ERR_TOKEN_HAS_EXPIRED, // NJS-087
|
|
305
|
+
'access token has expired');
|
|
306
|
+
messages.set(ERR_NOT_IMPLEMENTED, // NJS-089
|
|
307
|
+
'%s is not supported by node-oracledb in Thin mode');
|
|
308
|
+
messages.set(ERR_INIT_ORACLE_CLIENT_ARGS, // NJS-090
|
|
309
|
+
'initOracleClient() was already called with different arguments');
|
|
310
|
+
messages.set(ERR_MISSING_FILE, // NJS-091
|
|
311
|
+
'file %s is missing');
|
|
312
|
+
messages.set(ERR_INVALID_NUMBER_OF_CONNECTIONS, // NJS-092
|
|
313
|
+
'"poolMax" %d must be greater than or equal to "poolMin" %d');
|
|
314
|
+
messages.set(ERR_EXEC_MODE_ONLY_FOR_DML, // NJS-095
|
|
315
|
+
'setting "batchErrors" or "dmlRowCounts" to true is only permitted for DML statements');
|
|
316
|
+
messages.set(ERR_INVALID_BIND_NAME, // NJS-097
|
|
317
|
+
'no bind placeholder named ":%s" was found in the SQL text');
|
|
318
|
+
messages.set(ERR_WRONG_NUMBER_OF_POSITIONAL_BINDS, // NJS-098
|
|
319
|
+
'%s positional bind values are required but %s were provided');
|
|
320
|
+
messages.set(ERR_BUFFER_LENGTH_INSUFFICIENT, // NJS-099
|
|
321
|
+
'internal error: buffer of length %s insufficient to hold %s bytes');
|
|
322
|
+
messages.set(ERR_NCHAR_CS_NOT_SUPPORTED, // NJS-100
|
|
323
|
+
'national character set id %d is not supported by node-oracledb in Thin mode');
|
|
324
|
+
messages.set(ERR_MISSING_CREDENTIALS, // NJS-101
|
|
325
|
+
'no credentials specified');
|
|
326
|
+
messages.set(ERR_UNEXPECTED_END_OF_DATA, // NJS-102
|
|
327
|
+
'unexpected end of data: want %d bytes but only %d bytes are available');
|
|
328
|
+
messages.set(ERR_UNEXPECTED_MESSAGE_TYPE, // NJS-103
|
|
329
|
+
'unexpected message type %d received');
|
|
330
|
+
messages.set(ERR_POOL_HAS_BUSY_CONNECTIONS, // NJS-104
|
|
331
|
+
'connection pool cannot be closed because connections are busy');
|
|
332
|
+
messages.set(ERR_NAN_VALUE, // NJS-105
|
|
333
|
+
'value is not a number (NaN) and cannot be used in Oracle Database numbers');
|
|
334
|
+
messages.set(ERR_INTERNAL, // NJS-106
|
|
335
|
+
'internal error: %s');
|
|
336
|
+
messages.set(ERR_INVALID_REF_CURSOR, // NJS-107
|
|
337
|
+
'invalid cursor');
|
|
338
|
+
messages.set(ERR_LOB_CLOSED, // NJS-108
|
|
339
|
+
'LOB was already closed');
|
|
340
|
+
messages.set(ERR_INVALID_TYPE_NUM, // NJS-109
|
|
341
|
+
'invalid type number %d');
|
|
342
|
+
messages.set(ERR_INVALID_ORACLE_TYPE_NUM, // NJS-110
|
|
343
|
+
'invalid Oracle type number %d [csfrm: %d]');
|
|
344
|
+
messages.set(ERR_UNEXPECTED_NEGATIVE_INTEGER, // NJS-111
|
|
345
|
+
'internal error: read a negative integer when expecting a positive integer');
|
|
346
|
+
messages.set(ERR_INTEGER_TOO_LARGE, // NJS-112
|
|
347
|
+
'internal error: read integer of length %d when expecting integer of no more than length %d');
|
|
348
|
+
messages.set(ERR_UNEXPECTED_DATA, // NJS-113
|
|
349
|
+
'unexpected data received: %s');
|
|
350
|
+
messages.set(ERR_OSON_FIELD_NAME_LIMITATION, // NJS-114
|
|
351
|
+
'OSON field names may not exceed 255 UTF-8 encoded bytes');
|
|
352
|
+
messages.set(ERR_ORACLE_NUMBER_NO_REPR, // NJS-115
|
|
353
|
+
'value cannot be represented as an Oracle Database number');
|
|
354
|
+
messages.set(ERR_UNSUPPORTED_VERIFIER_TYPE, // NJS-116
|
|
355
|
+
'password verifier type 0x%s is not supported by node-oracledb in Thin mode');
|
|
356
|
+
messages.set(ERR_INVALID_PRIVATE_KEY, // NJS-117
|
|
357
|
+
'invalid private key. Headers and footers are not allowed');
|
|
358
|
+
messages.set(ERR_THIN_CONNECTION_ALREADY_CREATED, // NJS-118
|
|
359
|
+
'node-oracledb Thick mode cannot be enabled because a Thin mode connection has already been created');
|
|
360
|
+
messages.set(ERR_UNSUPPORTED_CONVERSION, // NJS-119
|
|
361
|
+
'conversion from type %s to type %s is not supported');
|
|
362
|
+
messages.set(ERR_FETCH_TYPE_HANDLER_RETURN_VALUE, // NJS-120
|
|
363
|
+
'fetchTypeHandler return value must be an object');
|
|
364
|
+
messages.set(ERR_FETCH_TYPE_HANDLER_TYPE, // NJS-121
|
|
365
|
+
'fetchTypeHandler return value attribute "type" must be a valid database type');
|
|
366
|
+
messages.set(ERR_FETCH_TYPE_HANDLER_CONVERTER, // NJS-122
|
|
367
|
+
'fetchTypeHandler return value attribute "converter" must be a function');
|
|
368
|
+
messages.set(ERR_CALL_TIMEOUT_EXCEEDED, // NJS-123
|
|
369
|
+
'call timeout of %d ms exceeded');
|
|
370
|
+
messages.set(ERR_EMPTY_CONNECT_STRING, // NJS-125
|
|
371
|
+
'"connectString" cannot be empty or undefined. Bequeath connections are not supported in Thin mode');
|
|
372
|
+
messages.set(ERR_OSON_VERSION_NOT_SUPPORTED, // NJS-126
|
|
373
|
+
'OSON version %s is not supported');
|
|
374
|
+
messages.set(ERR_UNKOWN_SERVER_SIDE_PIGGYBACK, // NJS-127
|
|
375
|
+
'internal error: unknown server side piggyback opcode %s');
|
|
376
|
+
messages.set(ERR_UNKNOWN_COLUMN_TYPE_NAME, // NJS-128
|
|
377
|
+
'internal error: unknown column type name "%s"');
|
|
378
|
+
messages.set(ERR_INVALID_OBJECT_TYPE_NAME, // NJS-129
|
|
379
|
+
'invalid object type name: "%s"');
|
|
380
|
+
messages.set(ERR_TDS_TYPE_NOT_SUPPORTED, // NJS-130
|
|
381
|
+
'Oracle TDS data type %d is not supported');
|
|
382
|
+
messages.set(ERR_INVALID_COLL_INDEX_SET, // NJS-131
|
|
383
|
+
'given index %d must be in the range of %d to %d');
|
|
384
|
+
messages.set(ERR_INVALID_COLL_INDEX_GET, // NJS-132
|
|
385
|
+
'element at index %d does not exist');
|
|
386
|
+
messages.set(ERR_DELETE_ELEMENTS_OF_VARRAY, // NJS-133
|
|
387
|
+
'cannot delete elements of a VARRAY');
|
|
388
|
+
messages.set(ERR_WRONG_VALUE_FOR_DBOBJECT_ATTR, // NJS-134
|
|
389
|
+
'value is of wrong type for attribute %s of object %s');
|
|
390
|
+
messages.set(ERR_WRONG_VALUE_FOR_DBOBJECT_ELEM, // NJS-135
|
|
391
|
+
'value is of wrong type for an element of object %s');
|
|
392
|
+
messages.set(ERR_WRONG_CRED_FOR_EXTAUTH, // NJS-136
|
|
393
|
+
'user name and password cannot be set when using external authentication');
|
|
394
|
+
messages.set(ERR_MISSING_BIND_VALUE, // NJS-137
|
|
395
|
+
'a bind variable replacement value for placeholder ":%s" was not provided');
|
|
396
|
+
|
|
397
|
+
// Oracle Net layer errors
|
|
398
|
+
|
|
399
|
+
messages.set(ERR_CONNECTION_CLOSED, // NJS-500
|
|
400
|
+
'connection to the Oracle Database was broken');
|
|
401
|
+
messages.set(ERR_CONNECTION_LOSTCONTACT, // NJS-501
|
|
402
|
+
'connection to host %s port %d terminated unexpectedly. (CONNECTION_ID=%s)\n%s');
|
|
403
|
+
messages.set(ERR_CONNECTION_INCOMPLETE, // NJS-503
|
|
404
|
+
'connection to host %s port %d could not be established. (CONNECTION_ID=%s)\n%s');
|
|
405
|
+
messages.set(ERR_PROXY_CONNECTION_FAILURE, // NJS-504
|
|
406
|
+
'connection establishment through a web proxy at host %s port %d failed. (CONNECTION_ID=%s)\n%s');
|
|
407
|
+
messages.set(ERR_TLS_INIT_FAILURE, // NJS-505
|
|
408
|
+
'unable to initiate TLS connection. Please check if wallet credentials are valid');
|
|
409
|
+
messages.set(ERR_TLS_AUTH_FAILURE, // NJS-506
|
|
410
|
+
'connection to host %s port %d encountered TLS handshake failure. (CONNECTION_ID=%s)\n%s');
|
|
411
|
+
messages.set(ERR_TLS_DNMATCH_FAILURE, // NJS-507
|
|
412
|
+
'TLS detected an invalid certificate. Server DN in certificate does not match the specified DN');
|
|
413
|
+
messages.set(ERR_TLS_HOSTMATCH_FAILURE, // NJS-508
|
|
414
|
+
'TLS detected an invalid certificate. %s not present in certificate');
|
|
415
|
+
messages.set(ERR_INVALID_PACKET, // NJS-509
|
|
416
|
+
'internal error: invalid packet type or malformed packet received');
|
|
417
|
+
messages.set(ERR_CONNECTION_TIMEDOUT, // NJS-510
|
|
418
|
+
'connection to host %s port %d timed out. Request exceeded "%s" of %d seconds. (CONNECTION_ID=%s)');
|
|
419
|
+
messages.set(ERR_CONNECTION_REFUSED, // NJS-511
|
|
420
|
+
'connection to listener at host %s port %d was refused. (CONNECTION_ID=%s)\nCause: %s');
|
|
421
|
+
messages.set(ERR_INVALID_CONNECT_STRING_PARAMETERS, // NJS-512
|
|
422
|
+
'invalid connection string parameters.\n%s');
|
|
423
|
+
messages.set(ERR_CONNECTION_INBAND, // NJS-513
|
|
424
|
+
'error received through in-band notification: %s');
|
|
425
|
+
messages.set(ERR_INVALID_CONNECT_STRING_SYNTAX, // NJS-514
|
|
426
|
+
'syntax error in connection string');
|
|
427
|
+
messages.set(ERR_INVALID_EZCONNECT_SYNTAX, // NJS-515
|
|
428
|
+
'error in Easy Connect connection string: %s: %s');
|
|
429
|
+
messages.set(ERR_NO_CONFIG_DIR, // NJS-516
|
|
430
|
+
'no configuration directory set or available to search for tnsnames.ora');
|
|
431
|
+
messages.set(ERR_TNS_ENTRY_NOT_FOUND, // NJS-517
|
|
432
|
+
'cannot connect to Oracle Database. Unable to find "%s" in "%s"');
|
|
433
|
+
messages.set(ERR_INVALID_SERVICE_NAME, // NJS-518
|
|
434
|
+
'cannot connect to Oracle Database. Service "%s" is not registered with the listener at host %s port %s. (CONNECTION_ID=%s)');
|
|
435
|
+
messages.set(ERR_INVALID_SID, // NJS-519
|
|
436
|
+
'cannot connect to Oracle Database. SID "%s" is not registered with the listener at host %s port %s. (CONNECTION_ID=%s)');
|
|
437
|
+
messages.set(ERR_TNS_NAMES_FILE_MISSING, // NJS-520
|
|
438
|
+
'cannot connect to Oracle Database. File tnsnames.ora not found in %s');
|
|
439
|
+
messages.set(ERR_CONNECTION_EOF, // NJS-521
|
|
440
|
+
'connection to host %s port %d received end-of-file on communication channel. (CONNECTION_ID=%s)');
|
|
441
|
+
|
|
442
|
+
//-----------------------------------------------------------------------------
|
|
443
|
+
// assert()
|
|
444
|
+
//
|
|
445
|
+
// Checks the condition, and if the condition is not true, throws an exception
|
|
446
|
+
// using the specified error number and arguments.
|
|
447
|
+
//-----------------------------------------------------------------------------
|
|
448
|
+
function assert(condition) {
|
|
449
|
+
if (!condition) {
|
|
450
|
+
const args = Array.prototype.slice.call(arguments, 1);
|
|
451
|
+
throwErr(...args);
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
//-----------------------------------------------------------------------------
|
|
456
|
+
// assertArgCount()
|
|
457
|
+
//
|
|
458
|
+
// Asserts that the argument count falls between the minimum and maximum number
|
|
459
|
+
// of arguments.
|
|
460
|
+
//-----------------------------------------------------------------------------
|
|
461
|
+
function assertArgCount(args, minArgCount, maxArgCount) {
|
|
462
|
+
assert(args.length >= minArgCount && args.length <= maxArgCount,
|
|
463
|
+
ERR_INVALID_NUMBER_OF_PARAMETERS);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
//-----------------------------------------------------------------------------
|
|
467
|
+
// assertParamPropBool()
|
|
468
|
+
//
|
|
469
|
+
// Asserts that the property value of a parmeter is a boolean value (or
|
|
470
|
+
// undefined).
|
|
471
|
+
//-----------------------------------------------------------------------------
|
|
472
|
+
function assertParamPropBool(obj, parameterNum, propName) {
|
|
473
|
+
if (obj[propName] !== undefined) {
|
|
474
|
+
assertParamPropValue(typeof obj[propName] === 'boolean', parameterNum,
|
|
475
|
+
propName);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
//-----------------------------------------------------------------------------
|
|
480
|
+
// assertParamPropFunction()
|
|
481
|
+
//
|
|
482
|
+
// Asserts that the property value of a parmeter is a function (or undefined).
|
|
483
|
+
//-----------------------------------------------------------------------------
|
|
484
|
+
function assertParamPropFunction(obj, parameterNum, propName) {
|
|
485
|
+
if (obj[propName] !== undefined) {
|
|
486
|
+
assertParamPropValue(typeof obj[propName] === 'function', parameterNum,
|
|
487
|
+
propName);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
//-----------------------------------------------------------------------------
|
|
492
|
+
// assertParamPropInt()
|
|
493
|
+
//
|
|
494
|
+
// Asserts that the property value of a parmeter is an integer value (or
|
|
495
|
+
// undefined).
|
|
496
|
+
//-----------------------------------------------------------------------------
|
|
497
|
+
function assertParamPropInt(obj, parameterNum, propName) {
|
|
498
|
+
if (obj[propName] !== undefined) {
|
|
499
|
+
assertParamPropValue(Number.isInteger(obj[propName]), parameterNum,
|
|
500
|
+
propName);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
//-----------------------------------------------------------------------------
|
|
505
|
+
// assertParamPropUnsignedInt()
|
|
506
|
+
//
|
|
507
|
+
// Asserts that the property value of a parmeter is a positive integer value
|
|
508
|
+
// (or undefined).
|
|
509
|
+
//-----------------------------------------------------------------------------
|
|
510
|
+
function assertParamPropUnsignedInt(obj, parameterNum, propName) {
|
|
511
|
+
if (obj[propName] !== undefined) {
|
|
512
|
+
assertParamPropValue(Number.isInteger(obj[propName]) && obj[propName] >= 0,
|
|
513
|
+
parameterNum, propName);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
//-----------------------------------------------------------------------------
|
|
518
|
+
// assertParamPropString()
|
|
519
|
+
//
|
|
520
|
+
// Asserts that the property value of a parmeter is a function (or undefined).
|
|
521
|
+
//-----------------------------------------------------------------------------
|
|
522
|
+
function assertParamPropString(obj, parameterNum, propName) {
|
|
523
|
+
if (obj[propName] !== undefined) {
|
|
524
|
+
assertParamPropValue(typeof obj[propName] === 'string', parameterNum,
|
|
525
|
+
propName);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
//-----------------------------------------------------------------------------
|
|
530
|
+
// assertParamPropValue()
|
|
531
|
+
//
|
|
532
|
+
// Asserts that the property value of a parmeter passes the specified
|
|
533
|
+
// condition.
|
|
534
|
+
//-----------------------------------------------------------------------------
|
|
535
|
+
function assertParamPropValue(condition, parameterNum, propName) {
|
|
536
|
+
assert(condition, ERR_INVALID_PROPERTY_VALUE_IN_PARAM, propName,
|
|
537
|
+
parameterNum);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
//-----------------------------------------------------------------------------
|
|
541
|
+
// assertParamValue()
|
|
542
|
+
//
|
|
543
|
+
// Asserts that the parmeter value passes the specified condition.
|
|
544
|
+
//-----------------------------------------------------------------------------
|
|
545
|
+
function assertParamValue(condition, parameterNum) {
|
|
546
|
+
assert(condition, ERR_INVALID_PARAMETER_VALUE, parameterNum);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
//-----------------------------------------------------------------------------
|
|
550
|
+
// assertPropValue()
|
|
551
|
+
//
|
|
552
|
+
// Asserts that the property value passes the specified condition.
|
|
553
|
+
//-----------------------------------------------------------------------------
|
|
554
|
+
function assertPropValue(condition, propName) {
|
|
555
|
+
assert(condition, ERR_INVALID_PROPERTY_VALUE, propName);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
//-----------------------------------------------------------------------------
|
|
559
|
+
// getErr()
|
|
560
|
+
//
|
|
561
|
+
// Returns an error object with the given error number after formatting it with
|
|
562
|
+
// the given arguments.
|
|
563
|
+
//-----------------------------------------------------------------------------
|
|
564
|
+
function getErr(errorNum) {
|
|
565
|
+
let baseText = messages.get(errorNum);
|
|
566
|
+
let args = [...arguments];
|
|
567
|
+
if (!baseText) {
|
|
568
|
+
args = [undefined, errorNum];
|
|
569
|
+
errorNum = ERR_INVALID_ERR_NUM;
|
|
570
|
+
baseText = messages.get(errorNum);
|
|
571
|
+
}
|
|
572
|
+
const errorNumStr = errorNum.toString().padStart(3, '0');
|
|
573
|
+
const code = `${ERR_PREFIX}-${errorNumStr}`;
|
|
574
|
+
args[0] = `${code}: ${baseText}`;
|
|
575
|
+
const err = new Error(util.format(...args));
|
|
576
|
+
err.code = code;
|
|
577
|
+
Error.captureStackTrace(err, getErr);
|
|
578
|
+
return err;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
//-----------------------------------------------------------------------------
|
|
582
|
+
// throwErr()
|
|
583
|
+
//
|
|
584
|
+
// Throws an error with the given error number after formatting it with the
|
|
585
|
+
// given arguments.
|
|
586
|
+
//-----------------------------------------------------------------------------
|
|
587
|
+
function throwErr() {
|
|
588
|
+
throw (getErr(...arguments));
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
//-----------------------------------------------------------------------------
|
|
592
|
+
// throwNotImplemented()
|
|
593
|
+
//
|
|
594
|
+
// Throws an error that the feature is not supported in Thin mode
|
|
595
|
+
//-----------------------------------------------------------------------------
|
|
596
|
+
function throwNotImplemented(feature) {
|
|
597
|
+
throwErr(ERR_NOT_IMPLEMENTED, feature);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
//-----------------------------------------------------------------------------
|
|
601
|
+
// transformErr()
|
|
602
|
+
//
|
|
603
|
+
// Adjusts the supplied error, if necessary, by looking for specific ODPI-C and
|
|
604
|
+
// Oracle errors and replacing them with driver specific errors.
|
|
605
|
+
//-----------------------------------------------------------------------------
|
|
606
|
+
function transformErr(err, fnOpt) {
|
|
607
|
+
if (!err.code) {
|
|
608
|
+
const pos = err.message.indexOf(":");
|
|
609
|
+
if (pos > 0) {
|
|
610
|
+
err.code = err.message.substr(0, pos);
|
|
611
|
+
if (adjustErrorXref.has(err.code)) {
|
|
612
|
+
let args = [];
|
|
613
|
+
let driverErrorNum;
|
|
614
|
+
let driverErrorInfo = adjustErrorXref.get(err.code);
|
|
615
|
+
if (typeof driverErrorInfo === 'number') {
|
|
616
|
+
driverErrorNum = driverErrorInfo;
|
|
617
|
+
} else {
|
|
618
|
+
driverErrorNum = driverErrorInfo[0];
|
|
619
|
+
const pattern = driverErrorInfo[1];
|
|
620
|
+
const results = err.message.match(pattern);
|
|
621
|
+
if (results) {
|
|
622
|
+
args = results.slice(1);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
const newErr = getErr(driverErrorNum, ...args);
|
|
626
|
+
err.code = newErr.code;
|
|
627
|
+
err.message = newErr.message + "\n" + err.message;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
if (err.requiresStackCapture) {
|
|
633
|
+
delete err.requiresStackCapture;
|
|
634
|
+
Error.captureStackTrace(err, fnOpt);
|
|
635
|
+
}
|
|
636
|
+
return err;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
// define exports
|
|
640
|
+
module.exports = {
|
|
641
|
+
ERR_INVALID_POOL,
|
|
642
|
+
ERR_INVALID_CONNECTION,
|
|
643
|
+
ERR_INVALID_PROPERTY_VALUE,
|
|
644
|
+
ERR_INVALID_PARAMETER_VALUE,
|
|
645
|
+
ERR_INVALID_PROPERTY_VALUE_IN_PARAM,
|
|
646
|
+
ERR_INVALID_NUMBER_OF_PARAMETERS,
|
|
647
|
+
ERR_UNSUPPORTED_DATA_TYPE,
|
|
648
|
+
ERR_BIND_VALUE_AND_TYPE_MISMATCH,
|
|
649
|
+
ERR_INVALID_BIND_DATA_TYPE,
|
|
650
|
+
ERR_INVALID_BIND_DIRECTION,
|
|
651
|
+
ERR_NO_TYPE_FOR_CONVERSION,
|
|
652
|
+
ERR_INSUFFICIENT_BUFFER_FOR_BINDS,
|
|
653
|
+
ERR_BUSY_RS,
|
|
654
|
+
ERR_INVALID_RS,
|
|
655
|
+
ERR_NOT_A_QUERY,
|
|
656
|
+
ERR_INVALID_TYPE_FOR_CONVERSION,
|
|
657
|
+
ERR_INVALID_LOB,
|
|
658
|
+
ERR_BUSY_LOB,
|
|
659
|
+
ERR_INSUFFICIENT_MEMORY,
|
|
660
|
+
ERR_INVALID_TYPE_FOR_ARRAY_BIND,
|
|
661
|
+
ERR_REQUIRED_MAX_ARRAY_SIZE,
|
|
662
|
+
ERR_INVALID_ARRAY_SIZE,
|
|
663
|
+
ERR_INCOMPATIBLE_TYPE_ARRAY_BIND,
|
|
664
|
+
ERR_CONN_REQUEST_TIMEOUT,
|
|
665
|
+
ERR_CANNOT_CONVERT_RS_TO_STREAM,
|
|
666
|
+
ERR_CANNOT_INVOKE_RS_METHODS,
|
|
667
|
+
ERR_RS_ALREADY_CONVERTED,
|
|
668
|
+
ERR_INVALID_BIND_UNIT,
|
|
669
|
+
ERR_CANNOT_LOAD_BINARY,
|
|
670
|
+
ERR_POOL_WITH_ALIAS_ALREADY_EXISTS,
|
|
671
|
+
ERR_POOL_WITH_ALIAS_NOT_FOUND,
|
|
672
|
+
ERR_INCOMPATIBLE_TYPE_ARRAY_INDEX_BIND,
|
|
673
|
+
ERR_MIXED_BIND,
|
|
674
|
+
ERR_MISSING_MAX_SIZE_BY_POS,
|
|
675
|
+
ERR_MISSING_MAX_SIZE_BY_NAME,
|
|
676
|
+
ERR_MAX_SIZE_TOO_SMALL,
|
|
677
|
+
ERR_MISSING_TYPE_BY_POS,
|
|
678
|
+
ERR_MISSING_TYPE_BY_NAME,
|
|
679
|
+
ERR_INVALID_SUBSCR,
|
|
680
|
+
ERR_MISSING_SUBSCR_CALLBACK,
|
|
681
|
+
ERR_MISSING_SUBSCR_SQL,
|
|
682
|
+
ERR_POOL_CLOSING,
|
|
683
|
+
ERR_POOL_CLOSED,
|
|
684
|
+
ERR_INVALID_SODA_DOC_CURSOR,
|
|
685
|
+
ERR_NO_BINARY_AVAILABLE,
|
|
686
|
+
ERR_INVALID_ERR_NUM,
|
|
687
|
+
ERR_NODE_TOO_OLD,
|
|
688
|
+
ERR_INVALID_AQ_MESSAGE,
|
|
689
|
+
ERR_DBL_CONNECT_STRING,
|
|
690
|
+
ERR_QUEUE_MAX_EXCEEDED,
|
|
691
|
+
ERR_UNSUPPORTED_DATA_TYPE_IN_JSON,
|
|
692
|
+
ERR_DBL_USER,
|
|
693
|
+
ERR_CONCURRENT_OPS,
|
|
694
|
+
ERR_POOL_RECONFIGURING,
|
|
695
|
+
ERR_POOL_STATISTICS_DISABLED,
|
|
696
|
+
ERR_TOKEN_BASED_AUTH,
|
|
697
|
+
ERR_POOL_TOKEN_BASED_AUTH,
|
|
698
|
+
ERR_CONN_TOKEN_BASED_AUTH,
|
|
699
|
+
ERR_TOKEN_HAS_EXPIRED,
|
|
700
|
+
ERR_NOT_IMPLEMENTED,
|
|
701
|
+
ERR_INIT_ORACLE_CLIENT_ARGS,
|
|
702
|
+
ERR_MISSING_FILE,
|
|
703
|
+
ERR_INVALID_NUMBER_OF_CONNECTIONS,
|
|
704
|
+
ERR_EXEC_MODE_ONLY_FOR_DML,
|
|
705
|
+
ERR_CONNECTION_CLOSED,
|
|
706
|
+
ERR_CONNECTION_LOSTCONTACT,
|
|
707
|
+
ERR_CONNECTION_INCOMPLETE,
|
|
708
|
+
ERR_PROXY_CONNECTION_FAILURE,
|
|
709
|
+
ERR_TLS_INIT_FAILURE,
|
|
710
|
+
ERR_TLS_AUTH_FAILURE,
|
|
711
|
+
ERR_TLS_DNMATCH_FAILURE,
|
|
712
|
+
ERR_TLS_HOSTMATCH_FAILURE,
|
|
713
|
+
ERR_INVALID_PACKET,
|
|
714
|
+
ERR_CONNECTION_TIMEDOUT,
|
|
715
|
+
ERR_CONNECTION_REFUSED,
|
|
716
|
+
ERR_INVALID_CONNECT_STRING_PARAMETERS,
|
|
717
|
+
ERR_CONNECTION_INBAND,
|
|
718
|
+
ERR_INVALID_CONNECT_STRING_SYNTAX,
|
|
719
|
+
ERR_INVALID_EZCONNECT_SYNTAX,
|
|
720
|
+
ERR_NO_CONFIG_DIR,
|
|
721
|
+
ERR_TNS_ENTRY_NOT_FOUND,
|
|
722
|
+
ERR_CONNECTION_EOF,
|
|
723
|
+
ERR_INVALID_BIND_NAME,
|
|
724
|
+
ERR_WRONG_NUMBER_OF_POSITIONAL_BINDS,
|
|
725
|
+
ERR_BUFFER_LENGTH_INSUFFICIENT,
|
|
726
|
+
ERR_NCHAR_CS_NOT_SUPPORTED,
|
|
727
|
+
ERR_MISSING_CREDENTIALS,
|
|
728
|
+
ERR_UNEXPECTED_END_OF_DATA,
|
|
729
|
+
ERR_UNEXPECTED_MESSAGE_TYPE,
|
|
730
|
+
ERR_POOL_HAS_BUSY_CONNECTIONS,
|
|
731
|
+
ERR_INTERNAL,
|
|
732
|
+
ERR_INVALID_REF_CURSOR,
|
|
733
|
+
ERR_UNSUPPORTED_VERIFIER_TYPE,
|
|
734
|
+
ERR_NAN_VALUE,
|
|
735
|
+
ERR_LOB_CLOSED,
|
|
736
|
+
ERR_ORACLE_NUMBER_NO_REPR,
|
|
737
|
+
ERR_INVALID_SERVICE_NAME,
|
|
738
|
+
ERR_INVALID_SID,
|
|
739
|
+
ERR_TNS_NAMES_FILE_MISSING,
|
|
740
|
+
ERR_INVALID_TYPE_NUM,
|
|
741
|
+
ERR_INVALID_ORACLE_TYPE_NUM,
|
|
742
|
+
ERR_UNEXPECTED_NEGATIVE_INTEGER,
|
|
743
|
+
ERR_INTEGER_TOO_LARGE,
|
|
744
|
+
ERR_UNEXPECTED_DATA,
|
|
745
|
+
ERR_OSON_FIELD_NAME_LIMITATION,
|
|
746
|
+
ERR_OSON_VERSION_NOT_SUPPORTED,
|
|
747
|
+
ERR_INVALID_PRIVATE_KEY,
|
|
748
|
+
ERR_THIN_CONNECTION_ALREADY_CREATED,
|
|
749
|
+
ERR_UNSUPPORTED_CONVERSION,
|
|
750
|
+
ERR_FETCH_TYPE_HANDLER_RETURN_VALUE,
|
|
751
|
+
ERR_FETCH_TYPE_HANDLER_TYPE,
|
|
752
|
+
ERR_FETCH_TYPE_HANDLER_CONVERTER,
|
|
753
|
+
ERR_CALL_TIMEOUT_EXCEEDED,
|
|
754
|
+
ERR_EMPTY_CONNECT_STRING,
|
|
755
|
+
ERR_UNKOWN_SERVER_SIDE_PIGGYBACK,
|
|
756
|
+
ERR_UNKNOWN_COLUMN_TYPE_NAME,
|
|
757
|
+
ERR_INVALID_OBJECT_TYPE_NAME,
|
|
758
|
+
ERR_TDS_TYPE_NOT_SUPPORTED,
|
|
759
|
+
ERR_INVALID_COLL_INDEX_SET,
|
|
760
|
+
ERR_INVALID_COLL_INDEX_GET,
|
|
761
|
+
ERR_DELETE_ELEMENTS_OF_VARRAY,
|
|
762
|
+
ERR_WRONG_VALUE_FOR_DBOBJECT_ATTR,
|
|
763
|
+
ERR_WRONG_VALUE_FOR_DBOBJECT_ELEM,
|
|
764
|
+
ERR_WRONG_CRED_FOR_EXTAUTH,
|
|
765
|
+
ERR_MISSING_BIND_VALUE,
|
|
766
|
+
ERR_CONNECTION_CLOSED_CODE: `${ERR_PREFIX}-${ERR_CONNECTION_CLOSED}`,
|
|
767
|
+
assert,
|
|
768
|
+
assertArgCount,
|
|
769
|
+
assertParamPropBool,
|
|
770
|
+
assertParamPropFunction,
|
|
771
|
+
assertParamPropInt,
|
|
772
|
+
assertParamPropString,
|
|
773
|
+
assertParamPropUnsignedInt,
|
|
774
|
+
assertParamPropValue,
|
|
775
|
+
assertParamValue,
|
|
776
|
+
assertPropValue,
|
|
777
|
+
getErr,
|
|
778
|
+
throwErr,
|
|
779
|
+
throwNotImplemented,
|
|
780
|
+
transformErr
|
|
781
|
+
};
|