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.
Files changed (108) hide show
  1. package/CHANGELOG.md +1 -1849
  2. package/LICENSE.txt +8 -222
  3. package/NOTICE.txt +1 -1
  4. package/README.md +38 -30
  5. package/SECURITY.md +38 -0
  6. package/THIRD_PARTY_LICENSES.txt +1 -1
  7. package/build/Release/oracledb-6.0.0-darwin-x64.node +0 -0
  8. package/build/Release/oracledb-6.0.0-darwin-x64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.0.0-js-buildinfo.txt +1 -0
  10. package/build/Release/oracledb-6.0.0-linux-arm64.node +0 -0
  11. package/build/Release/oracledb-6.0.0-linux-arm64.node-buildinfo.txt +1 -0
  12. package/build/Release/oracledb-6.0.0-linux-x64.node +0 -0
  13. package/build/Release/oracledb-6.0.0-linux-x64.node-buildinfo.txt +1 -0
  14. package/build/Release/oracledb-6.0.0-win32-x64.node +0 -0
  15. package/build/Release/oracledb-6.0.0-win32-x64.node-buildinfo.txt +1 -0
  16. package/examples/README.md +113 -0
  17. package/examples/dbconfig.js +100 -0
  18. package/examples/example.js +156 -0
  19. package/index.js +26 -0
  20. package/lib/aqDeqOptions.js +146 -7
  21. package/lib/aqEnqOptions.js +59 -7
  22. package/lib/aqMessage.js +118 -7
  23. package/lib/aqQueue.js +242 -53
  24. package/lib/connection.js +1324 -465
  25. package/lib/constants.js +203 -0
  26. package/lib/dbObject.js +346 -32
  27. package/lib/errors.js +781 -0
  28. package/lib/impl/aqDeqOptions.js +197 -0
  29. package/lib/impl/aqEnqOptions.js +89 -0
  30. package/lib/impl/aqMessage.js +134 -0
  31. package/lib/impl/aqQueue.js +81 -0
  32. package/lib/impl/connection.js +529 -0
  33. package/lib/impl/dbObject.js +159 -0
  34. package/lib/impl/index.js +59 -0
  35. package/lib/impl/lob.js +85 -0
  36. package/lib/impl/pool.js +195 -0
  37. package/lib/impl/resultset.js +223 -0
  38. package/lib/impl/sodaCollection.js +174 -0
  39. package/lib/impl/sodaDatabase.js +81 -0
  40. package/lib/impl/sodaDocCursor.js +63 -0
  41. package/lib/impl/sodaDocument.js +98 -0
  42. package/lib/impl/sodaOperation.js +109 -0
  43. package/lib/lob.js +156 -68
  44. package/lib/oracledb.js +1051 -257
  45. package/lib/pool.js +654 -465
  46. package/lib/poolStatistics.js +23 -9
  47. package/lib/queryStream.js +14 -7
  48. package/lib/resultset.js +292 -171
  49. package/lib/settings.js +191 -0
  50. package/lib/sodaCollection.js +214 -201
  51. package/lib/sodaDatabase.js +107 -71
  52. package/lib/sodaDocCursor.js +44 -32
  53. package/lib/sodaDocument.js +76 -14
  54. package/lib/sodaOperation.js +131 -118
  55. package/lib/thin/connection.js +1038 -0
  56. package/lib/thin/dbObject.js +629 -0
  57. package/lib/thin/index.js +40 -0
  58. package/lib/thin/lob.js +188 -0
  59. package/lib/thin/pool.js +481 -0
  60. package/lib/thin/protocol/buffer.js +1040 -0
  61. package/lib/thin/protocol/capabilities.js +116 -0
  62. package/lib/thin/protocol/constants.js +764 -0
  63. package/lib/thin/protocol/encryptDecrypt.js +185 -0
  64. package/lib/thin/protocol/messages/auth.js +348 -0
  65. package/lib/thin/protocol/messages/base.js +475 -0
  66. package/lib/thin/protocol/messages/commit.js +56 -0
  67. package/lib/thin/protocol/messages/dataType.js +382 -0
  68. package/lib/thin/protocol/messages/execute.js +312 -0
  69. package/lib/thin/protocol/messages/fetch.js +60 -0
  70. package/lib/thin/protocol/messages/index.js +53 -0
  71. package/lib/thin/protocol/messages/lobOp.js +200 -0
  72. package/lib/thin/protocol/messages/logOff.js +53 -0
  73. package/lib/thin/protocol/messages/ping.js +56 -0
  74. package/lib/thin/protocol/messages/protocol.js +78 -0
  75. package/lib/thin/protocol/messages/rollback.js +56 -0
  76. package/lib/thin/protocol/messages/sessionRelease.js +60 -0
  77. package/lib/thin/protocol/messages/withData.js +811 -0
  78. package/lib/thin/protocol/oson.js +660 -0
  79. package/lib/thin/protocol/packet.js +520 -0
  80. package/lib/thin/protocol/protocol.js +202 -0
  81. package/lib/thin/protocol/utils.js +88 -0
  82. package/lib/thin/resultSet.js +122 -0
  83. package/lib/thin/sqlnet/connStrategy.js +175 -0
  84. package/lib/thin/sqlnet/constants.js +199 -0
  85. package/lib/thin/sqlnet/ezConnectResolver.js +488 -0
  86. package/lib/thin/sqlnet/navNodes.js +870 -0
  87. package/lib/thin/sqlnet/networkSession.js +620 -0
  88. package/lib/thin/sqlnet/ntTcp.js +525 -0
  89. package/lib/thin/sqlnet/nvStrToNvPair.js +783 -0
  90. package/lib/thin/sqlnet/packet.js +405 -0
  91. package/lib/thin/sqlnet/paramParser.js +205 -0
  92. package/lib/thin/sqlnet/sessionAtts.js +160 -0
  93. package/lib/thin/statement.js +301 -0
  94. package/lib/thin/util.js +289 -0
  95. package/lib/transformer.js +250 -0
  96. package/lib/types.js +357 -0
  97. package/lib/util.js +194 -108
  98. package/lib/version.js +36 -0
  99. package/package/README.md +33 -30
  100. package/package/install.js +89 -64
  101. package/package/prunebinaries.js +60 -12
  102. package/package.json +3 -3
  103. package/build/Release/oracledb-5.4.0-darwin-x64.node +0 -0
  104. package/build/Release/oracledb-5.4.0-darwin-x64.node-buildinfo.txt +0 -1
  105. package/build/Release/oracledb-5.4.0-linux-x64.node +0 -0
  106. package/build/Release/oracledb-5.4.0-linux-x64.node-buildinfo.txt +0 -1
  107. package/build/Release/oracledb-5.4.0-win32-x64.node +0 -0
  108. package/build/Release/oracledb-5.4.0-win32-x64.node-buildinfo.txt +0 -1
@@ -0,0 +1,289 @@
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 constants = require('../constants');
30
+ const errors = require('../errors.js');
31
+
32
+ //---------------------------------------------------------------------------
33
+ // getMetadataMany(sql)
34
+ //
35
+ // Get metadata info for all the columns in the table
36
+ //---------------------------------------------------------------------------
37
+ function getMetadataMany(vars) {
38
+ const metadata = [];
39
+ for (const queryVar of vars) {
40
+ metadata.push(queryVar.fetchInfo);
41
+ }
42
+ return metadata;
43
+ }
44
+
45
+ //---------------------------------------------------------------------------
46
+ // getOutBinds(sql)
47
+ //
48
+ // Get the outBinds for the sql
49
+ //---------------------------------------------------------------------------
50
+ function getOutBinds(bindVars, pos) {
51
+ let bindByPos = (bindVars[0].name === undefined);
52
+ let outBinds;
53
+ if (bindByPos) {
54
+ outBinds = [];
55
+ } else {
56
+ outBinds = {};
57
+ }
58
+ for (let i = 0; i < bindVars.length; i++) {
59
+ if (bindVars[i].dir === constants.BIND_IN)
60
+ continue;
61
+ if (bindByPos) {
62
+ outBinds.push(bindVars[i].values[pos]);
63
+ } else {
64
+ outBinds[bindVars[i].name] = bindVars[i].values[pos];
65
+ }
66
+ }
67
+ return outBinds;
68
+ }
69
+
70
+ //---------------------------------------------------------------------------
71
+ // getExecuteManyOutBinds(sql)
72
+ //
73
+ // Get the outBinds for the sql when doing an executeMany call
74
+ //---------------------------------------------------------------------------
75
+ function getExecuteManyOutBinds(bindVars, numIters) {
76
+ let numOutBinds = getNumOutBinds(bindVars);
77
+ if (numOutBinds === 0) {
78
+ return;
79
+ }
80
+ let outBinds = new Array(numIters).fill(null);
81
+ for (let i = 0; i < numIters; i++) {
82
+ outBinds[i] = getOutBinds(bindVars, i);
83
+ }
84
+ return outBinds;
85
+ }
86
+
87
+ //---------------------------------------------------------------------------
88
+ // getNumOutBinds(sql)
89
+ //
90
+ // Get the number of outBinds for the sql
91
+ //---------------------------------------------------------------------------
92
+ function getNumOutBinds(bindVars) {
93
+ let numOutBinds = 0;
94
+ for (let i = 0; i < bindVars.length; i++) {
95
+ if (bindVars[i].dir !== constants.BIND_IN) {
96
+ numOutBinds++;
97
+ }
98
+ }
99
+ return numOutBinds;
100
+ }
101
+
102
+ //---------------------------------------------------------------------------
103
+ // getExecuteOutBinds(sql)
104
+ //
105
+ // Get the outBinds for the sql when doing an execute call
106
+ //---------------------------------------------------------------------------
107
+ function getExecuteOutBinds(bindVars) {
108
+ let numOutBinds = getNumOutBinds(bindVars);
109
+ if (numOutBinds === 0) {
110
+ return;
111
+ }
112
+ return getOutBinds(bindVars, 0);
113
+ }
114
+
115
+ //---------------------------------------------------------------------------
116
+ // cleanSql(sql)
117
+ //
118
+ // Sanitize the sql to remove comment and redundant information
119
+ //---------------------------------------------------------------------------
120
+ function cleanSql(sql) {
121
+ sql = sql.trim();
122
+ sql = sql.replace(/\--.*(\n|$)/g, ""); // eslint-disable-line
123
+ sql = sql.replace(/\/\\*[\S\n ]+\\*\//g, "");
124
+ sql = sql.replace(/\s+/g, " ");
125
+ return sql;
126
+ }
127
+
128
+ //---------------------------------------------------------------------------
129
+ // getOutBinds(sql)
130
+ //
131
+ // Get the bind variables from the bindInfoList of the statement object
132
+ //---------------------------------------------------------------------------
133
+ function getBindVars(statement) {
134
+ let bindVars = [];
135
+ for (const bindInfo of statement.bindInfoList) {
136
+ bindVars.push(bindInfo.bindVar);
137
+ }
138
+ return bindVars;
139
+ }
140
+
141
+ //---------------------------------------------------------------------------
142
+ // checkProxyUserValidity()
143
+ //
144
+ // Check validity status for proxy authentication
145
+ //---------------------------------------------------------------------------
146
+ function checkProxyUserValidity(userName) {
147
+ let schemaUser = '', proxyUser = '';
148
+ let quoteFound = false, openSquareBracketFound = false;
149
+ let lastQuoteFoundIndex = 0;
150
+ let schemaUserStartIndex;
151
+ let result = {
152
+ status : -1,
153
+ proxyUser : '',
154
+ schemaUser : ''
155
+ };
156
+ const userNameLength = userName.length;
157
+ let index = 0, i, j;
158
+ while (index < userNameLength) {
159
+ // check for double quotes
160
+ if (userName.charAt(index) === '"') {
161
+ quoteFound = !quoteFound;
162
+ lastQuoteFoundIndex = index;
163
+ }
164
+
165
+ // check for open square bracket
166
+ if (userName.charAt(index) === '[' && !quoteFound) {
167
+ openSquareBracketFound = true;
168
+ // skip leading space and extract proxy user name
169
+ if (lastQuoteFoundIndex != 0) {
170
+ for (i = lastQuoteFoundIndex + 1; i < index; i++) {
171
+ if (userName.charAt(i) !== ' ') {
172
+ return result;
173
+ }
174
+ }
175
+
176
+ for (i = 0; i <= lastQuoteFoundIndex; i++) {
177
+ proxyUser += userName.charAt(i);
178
+ }
179
+ } else {
180
+ for (i = 0; i < index; i++) {
181
+ if (userName.charAt(i) !== ' ') {
182
+ proxyUser += userName.charAt(i);
183
+ } else {
184
+ break;
185
+ }
186
+ }
187
+ }
188
+ break;
189
+ }
190
+ index++;
191
+ }
192
+
193
+ if (proxyUser.length === 0) {
194
+ return result;
195
+ } else {
196
+ result.proxyUser = proxyUser;
197
+ }
198
+
199
+ // extract schema user
200
+ index = index + 1;
201
+ quoteFound = false;
202
+ schemaUserStartIndex = index;
203
+ lastQuoteFoundIndex = 0;
204
+ while (index < userNameLength) {
205
+ // check for double quotes
206
+ if (userName.charAt(index) === '"') {
207
+ quoteFound = !quoteFound;
208
+ lastQuoteFoundIndex = index;
209
+ }
210
+
211
+ if (userName.charAt(index) === '[' && !quoteFound &&
212
+ openSquareBracketFound) {
213
+ return result;
214
+ }
215
+
216
+ if (userName.charAt(index) === ']' && !quoteFound) {
217
+ if (lastQuoteFoundIndex != schemaUserStartIndex &&
218
+ lastQuoteFoundIndex != 0) {
219
+ for (i = schemaUserStartIndex; i <= lastQuoteFoundIndex; i++) {
220
+ schemaUser += userName.charAt(i);
221
+ }
222
+ // check for character between double quotes and close brackets
223
+ for (i = lastQuoteFoundIndex + 1; i < index; i++) {
224
+ if (userName.charAt(i) != ' ') {
225
+ return result;
226
+ }
227
+ }
228
+ } else {
229
+ // skip trailing spaces
230
+ for (i = schemaUserStartIndex; i < index; i++) {
231
+ if (userName.charAt(i) != ' ') {
232
+ break;
233
+ }
234
+ }
235
+ if (i == index) {
236
+ return result;
237
+ }
238
+
239
+ for (j = i; j < index; j++) {
240
+ schemaUser += userName[j];
241
+ }
242
+ }
243
+
244
+ // check for character from [ till end of string
245
+ for (i = index + 1; i < userNameLength; i++) {
246
+ if (userName[i] != ' ') {
247
+ return result;
248
+ }
249
+ }
250
+ }
251
+ index++;
252
+ }
253
+
254
+ if (schemaUser.length === 0) {
255
+ return result;
256
+ } else {
257
+ result.schemaUser = schemaUser;
258
+ }
259
+
260
+ result.status = 0;
261
+ return result;
262
+ }
263
+
264
+ //---------------------------------------------------------------------------
265
+ // checkCredentials()
266
+ //
267
+ // Check Credentials for Password Authentication
268
+ //---------------------------------------------------------------------------
269
+ function checkCredentials(params) {
270
+ if (params.token === undefined) {
271
+ if (params.externalAuth === true) {
272
+ errors.throwErr(errors.ERR_NOT_IMPLEMENTED, 'External Authentication');
273
+ }
274
+ if (params.password === undefined) {
275
+ errors.throwErr(errors.ERR_MISSING_CREDENTIALS);
276
+ }
277
+ }
278
+ }
279
+
280
+ module.exports = {
281
+ getMetadataMany,
282
+ cleanSql,
283
+ getExecuteOutBinds,
284
+ getExecuteManyOutBinds,
285
+ getOutBinds,
286
+ getBindVars,
287
+ checkProxyUserValidity,
288
+ checkCredentials
289
+ };
@@ -0,0 +1,250 @@
1
+ // Copyright (c) 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 BaseDbObject = require('./dbObject.js');
30
+ const Lob = require('./lob.js');
31
+ const ResultSet = require('./resultset.js');
32
+ const constants = require('./constants.js');
33
+ const errors = require('./errors.js');
34
+ const util = require('util');
35
+ const types = require('./types.js');
36
+
37
+ //-----------------------------------------------------------------------------
38
+ // checkType()
39
+ //
40
+ // Checks that the type of the data matches one of the given types. If the type
41
+ // has not been specified yet, the first type is assumed to be the correct one.
42
+ //
43
+ // A failure to match results in an exception being thrown. The data in the
44
+ // info parameter is used to determine which error should be thrown.
45
+ //-----------------------------------------------------------------------------
46
+ function checkType(info, options) {
47
+ if (info.type === undefined && arguments.length > 2) {
48
+ info.type = arguments[2];
49
+ } else {
50
+ let matches = false;
51
+ for (let i = 2; i < arguments.length; i++) {
52
+ if (info.type === arguments[i]) {
53
+ matches = true;
54
+ break;
55
+ }
56
+ }
57
+ if (!matches) {
58
+ if (info.attrName) {
59
+ errors.throwErr(errors.ERR_WRONG_VALUE_FOR_DBOBJECT_ATTR,
60
+ info.attrName, info.fqn);
61
+ } else if (info.fqn) {
62
+ errors.throwErr(errors.ERR_WRONG_VALUE_FOR_DBOBJECT_ELEM, info.fqn);
63
+ } else if (info.isArray && info.name) {
64
+ errors.throwErr(errors.ERR_INCOMPATIBLE_TYPE_ARRAY_BIND, options.pos,
65
+ info.name);
66
+ } else if (info.isArray) {
67
+ errors.throwErr(errors.ERR_INCOMPATIBLE_TYPE_ARRAY_INDEX_BIND,
68
+ options.pos, info.pos);
69
+ } else {
70
+ errors.throwErr(errors.ERR_BIND_VALUE_AND_TYPE_MISMATCH);
71
+ }
72
+ }
73
+ }
74
+ }
75
+
76
+ //-----------------------------------------------------------------------------
77
+ // transformJsonValue()
78
+ //
79
+ // Returns a normalized JSON value. Scalar values are returned unchanged.
80
+ // Arrays are returned as a new array with transformed JSON values. Objects are
81
+ // returned as new objects with keys "fields" and "values", both of which
82
+ // are arrays (with the value transformed to JSON values).
83
+ //-----------------------------------------------------------------------------
84
+ function transformJsonValue(value) {
85
+
86
+ // handle simple scalars
87
+ if (value === undefined || value === null ||
88
+ typeof value === 'number' || typeof value === 'string' ||
89
+ typeof value === 'boolean' || Buffer.isBuffer(value) ||
90
+ util.isDate(value))
91
+ return value;
92
+
93
+ // arrays are transformed to a new array with processed values
94
+ if (Array.isArray(value)) {
95
+ const outValue = new Array(value.length);
96
+ for (let i = 0; i < value.length; i++) {
97
+ outValue[i] = transformJsonValue(value[i]);
98
+ }
99
+ return outValue;
100
+ }
101
+
102
+ // database objects are treated as empty objects
103
+ if (value instanceof BaseDbObject)
104
+ return {fields: [], values: []};
105
+
106
+ // all other objects are transformed to an object with two arrays (fields
107
+ // and values)
108
+ const outValue = {};
109
+ outValue.fields = Object.getOwnPropertyNames(value);
110
+ outValue.values = new Array(outValue.fields.length);
111
+ for (let i = 0; i < outValue.fields.length; i++) {
112
+ outValue.values[i] = transformJsonValue(value[outValue.fields[i]]);
113
+ }
114
+ return outValue;
115
+
116
+ }
117
+
118
+ //-----------------------------------------------------------------------------
119
+ // transformValueIn()
120
+ //
121
+ // Processes the value supplied by the caller and returns a normalized value,
122
+ // if necessary, for use by the implementation. All checks are performed on the
123
+ // value to ensure it is suitable for the type information supplied. If no type
124
+ // information is supplied, however, the value defines it instead!
125
+ //-----------------------------------------------------------------------------
126
+ function transformValueIn(info, value, options) {
127
+
128
+ // null and undefined can always be set so nothing needs to be done
129
+ if (value === undefined || value === null)
130
+ return undefined;
131
+
132
+ // handle setting plain JS values to database objects
133
+ if (info.type === types.DB_TYPE_OBJECT) {
134
+ let obj = value;
135
+ if (!(value instanceof BaseDbObject)) {
136
+ obj = new info.typeClass(value);
137
+ }
138
+ return obj._impl;
139
+
140
+ // handle setting plain JS values to JSON
141
+ } else if (info.type === types.DB_TYPE_JSON) {
142
+ return transformJsonValue(value);
143
+
144
+ // handle strings
145
+ } else if (typeof value === 'string') {
146
+ checkType(info, options,
147
+ types.DB_TYPE_VARCHAR,
148
+ types.DB_TYPE_NVARCHAR,
149
+ types.DB_TYPE_CHAR,
150
+ types.DB_TYPE_NCHAR,
151
+ types.DB_TYPE_CLOB,
152
+ types.DB_TYPE_NCLOB);
153
+ if (info.type !== types.DB_TYPE_CLOB &&
154
+ info.type !== types.DB_TYPE_NCLOB &&
155
+ info.cqn === undefined &&
156
+ (info.maxSize === undefined || value.length > info.maxSize)) {
157
+ if (info.checkSize) {
158
+ errors.throwErr(errors.ERR_MAX_SIZE_TOO_SMALL, info.maxSize,
159
+ value.length, options.pos);
160
+ }
161
+ info.maxSize = value.length;
162
+ }
163
+ return value;
164
+
165
+ // handle numbers
166
+ } else if (typeof value === 'number') {
167
+ checkType(info, options,
168
+ types.DB_TYPE_NUMBER,
169
+ types.DB_TYPE_BINARY_INTEGER,
170
+ types.DB_TYPE_BINARY_FLOAT,
171
+ types.DB_TYPE_BINARY_DOUBLE);
172
+ if (Number.isNaN(value) && info.type === types.DB_TYPE_NUMBER) {
173
+ errors.throwErr(errors.ERR_NAN_VALUE);
174
+ }
175
+ return value;
176
+
177
+ // handle booleans
178
+ } else if (typeof value === 'boolean') {
179
+ checkType(info, options, types.DB_TYPE_BOOLEAN);
180
+ return value;
181
+
182
+ // handle dates
183
+ } else if (util.isDate(value)) {
184
+ checkType(info, options,
185
+ types.DB_TYPE_TIMESTAMP,
186
+ types.DB_TYPE_TIMESTAMP_TZ,
187
+ types.DB_TYPE_TIMESTAMP_LTZ,
188
+ types.DB_TYPE_DATE);
189
+ return value;
190
+
191
+ // handle binding buffers
192
+ } else if (Buffer.isBuffer(value)) {
193
+ checkType(info, options,
194
+ types.DB_TYPE_RAW,
195
+ types.DB_TYPE_BLOB);
196
+ if (info.type === types.DB_TYPE_RAW && info.cqn === undefined &&
197
+ (info.maxSize === undefined || value.length > info.maxSize)) {
198
+ if (info.checkSize) {
199
+ errors.throwErr(errors.ERR_MAX_SIZE_TOO_SMALL, info.maxSize,
200
+ value.length, options.pos);
201
+ }
202
+ info.maxSize = value.length;
203
+ }
204
+ return value;
205
+
206
+ // handle result sets
207
+ } else if (value instanceof ResultSet) {
208
+ checkType(info, options, types.DB_TYPE_CURSOR);
209
+ return value._impl;
210
+
211
+ // handle binding LOBs
212
+ } else if (value instanceof Lob) {
213
+ checkType(info, options, value.type);
214
+ return value._impl;
215
+
216
+ // handle database objects
217
+ } else if (value instanceof BaseDbObject) {
218
+ checkType(info, options, types.DB_TYPE_OBJECT);
219
+ return value._impl;
220
+
221
+ // handle arrays
222
+ } else if (options.allowArray && Array.isArray(value)) {
223
+ info.isArray = true;
224
+ if (info.dir === constants.BIND_IN) {
225
+ info.maxArraySize = value.length || 1;
226
+ } else if (info.maxArraySize === undefined) {
227
+ errors.throwErr(errors.ERR_REQUIRED_MAX_ARRAY_SIZE);
228
+ } else if (value.length > info.maxArraySize) {
229
+ errors.throwErr(errors.ERR_INVALID_ARRAY_SIZE);
230
+ }
231
+ options.allowArray = false;
232
+ const transformed = new Array(value.length);
233
+ for (let i = 0; i < value.length; i++) {
234
+ options.pos = i;
235
+ transformed[i] = transformValueIn(info, value[i], options);
236
+ }
237
+ return transformed;
238
+ }
239
+
240
+ // no suitable bind value found
241
+ if (info.type === undefined)
242
+ errors.throwErr(errors.ERR_INVALID_BIND_DATA_TYPE, 2);
243
+ checkType(info, options);
244
+
245
+ }
246
+
247
+ // define exports
248
+ module.exports = {
249
+ transformValueIn,
250
+ };