oracledb 6.5.1 → 6.7.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 (73) hide show
  1. package/README.md +2 -2
  2. package/build/Release/oracledb-6.7.0-darwin-arm64.node +0 -0
  3. package/build/Release/oracledb-6.7.0-darwin-arm64.node-buildinfo.txt +1 -0
  4. package/build/Release/oracledb-6.7.0-darwin-x64.node +0 -0
  5. package/build/Release/oracledb-6.7.0-darwin-x64.node-buildinfo.txt +1 -0
  6. package/build/Release/oracledb-6.7.0-js-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-6.7.0-linux-arm64.node +0 -0
  8. package/build/Release/oracledb-6.7.0-linux-arm64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.7.0-linux-x64.node +0 -0
  10. package/build/Release/oracledb-6.7.0-linux-x64.node-buildinfo.txt +1 -0
  11. package/build/Release/oracledb-6.7.0-win32-x64.node +0 -0
  12. package/build/Release/oracledb-6.7.0-win32-x64.node-buildinfo.txt +1 -0
  13. package/examples/README.md +4 -0
  14. package/lib/configProviders/azure.js +178 -0
  15. package/lib/configProviders/base.js +85 -0
  16. package/lib/configProviders/ociobject.js +211 -0
  17. package/lib/connection.js +97 -14
  18. package/lib/constants.js +1 -0
  19. package/lib/errors.js +68 -6
  20. package/lib/impl/aqQueue.js +2 -1
  21. package/lib/impl/base.js +45 -0
  22. package/lib/impl/connection.js +53 -0
  23. package/lib/impl/datahandlers/constants.js +3 -1
  24. package/lib/impl/datahandlers/vector.js +24 -9
  25. package/lib/impl/lob.js +29 -1
  26. package/lib/impl/pool.js +15 -0
  27. package/lib/impl/resultset.js +28 -2
  28. package/lib/impl/sodaCollection.js +2 -1
  29. package/lib/impl/sodaDatabase.js +2 -1
  30. package/lib/impl/sodaDocCursor.js +2 -1
  31. package/lib/impl/sodaOperation.js +2 -1
  32. package/lib/lob.js +55 -3
  33. package/lib/oracledb.js +246 -7
  34. package/lib/pool.js +14 -5
  35. package/lib/settings.js +1 -0
  36. package/lib/thin/connection.js +304 -29
  37. package/lib/thin/dbObject.js +4 -0
  38. package/lib/thin/lob.js +193 -1
  39. package/lib/thin/pool.js +18 -0
  40. package/lib/thin/protocol/capabilities.js +2 -0
  41. package/lib/thin/protocol/constants.js +29 -1
  42. package/lib/thin/protocol/messages/auth.js +12 -6
  43. package/lib/thin/protocol/messages/base.js +3 -0
  44. package/lib/thin/protocol/messages/index.js +5 -1
  45. package/lib/thin/protocol/messages/lobOp.js +17 -5
  46. package/lib/thin/protocol/messages/sessionRelease.js +1 -0
  47. package/lib/thin/protocol/messages/transactionChangeState.js +99 -0
  48. package/lib/thin/protocol/messages/transactionSwitch.js +139 -0
  49. package/lib/thin/protocol/messages/withData.js +21 -6
  50. package/lib/thin/protocol/protocol.js +23 -0
  51. package/lib/thin/sqlnet/connStrategy.js +9 -1
  52. package/lib/thin/sqlnet/constants.js +2 -0
  53. package/lib/thin/sqlnet/navNodes.js +14 -2
  54. package/lib/thin/sqlnet/networkSession.js +11 -10
  55. package/lib/thin/sqlnet/ntTcp.js +1 -1
  56. package/lib/thin/sqlnet/paramParser.js +87 -50
  57. package/lib/thin/sqlnet/sessionAtts.js +14 -2
  58. package/lib/thin/util.js +4 -3
  59. package/lib/traceHandler.js +133 -0
  60. package/lib/transformer.js +1 -2
  61. package/lib/types.js +1 -1
  62. package/lib/util.js +213 -35
  63. package/lib/version.js +2 -2
  64. package/package.json +1 -1
  65. package/build/Release/oracledb-6.5.1-darwin-x64.node +0 -0
  66. package/build/Release/oracledb-6.5.1-darwin-x64.node-buildinfo.txt +0 -1
  67. package/build/Release/oracledb-6.5.1-js-buildinfo.txt +0 -1
  68. package/build/Release/oracledb-6.5.1-linux-arm64.node +0 -0
  69. package/build/Release/oracledb-6.5.1-linux-arm64.node-buildinfo.txt +0 -1
  70. package/build/Release/oracledb-6.5.1-linux-x64.node +0 -0
  71. package/build/Release/oracledb-6.5.1-linux-x64.node-buildinfo.txt +0 -1
  72. package/build/Release/oracledb-6.5.1-win32-x64.node +0 -0
  73. package/build/Release/oracledb-6.5.1-win32-x64.node-buildinfo.txt +0 -1
package/lib/connection.js CHANGED
@@ -202,9 +202,7 @@ class Connection extends EventEmitter {
202
202
  typeof value === 'boolean' ||
203
203
  typeof value === 'bigint' ||
204
204
  Array.isArray(value) ||
205
- value instanceof Float32Array ||
206
- value instanceof Float64Array ||
207
- value instanceof Int8Array ||
205
+ nodbUtil.isVectorValue(value) ||
208
206
  Buffer.isBuffer(value) ||
209
207
  util.types.isDate(value) ||
210
208
  value instanceof Lob ||
@@ -871,10 +869,15 @@ class Connection extends EventEmitter {
871
869
  let binds = [];
872
870
  let options = {};
873
871
 
872
+ errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
873
+
874
874
  // process arguments
875
875
  if (nodbUtil.isObject(sql) && typeof sql.statement === 'string') {
876
876
  errors.assertArgCount(arguments, 1, 2);
877
877
  if (sql.values) {
878
+ if (this._impl._callLevelTraceData) {
879
+ this._impl._callLevelTraceData.values = sql.values;
880
+ }
878
881
  binds = await this._processExecuteBinds(sql.values);
879
882
  }
880
883
  sql = sql.statement;
@@ -885,6 +888,9 @@ class Connection extends EventEmitter {
885
888
  errors.assertArgCount(arguments, 1, 3);
886
889
  errors.assertParamValue(typeof sql === 'string', 1);
887
890
  if (arguments.length >= 2) {
891
+ if (this._impl._callLevelTraceData) {
892
+ this._impl._callLevelTraceData.values = a2;
893
+ }
888
894
  binds = await this._processExecuteBinds(a2);
889
895
  }
890
896
  if (arguments.length == 3) {
@@ -892,11 +898,13 @@ class Connection extends EventEmitter {
892
898
  }
893
899
  }
894
900
  this._addDefaultsToExecOpts(options);
895
- errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
896
901
 
897
902
  // perform actual execute
898
903
  let result;
899
904
  try {
905
+ if (this._impl._callLevelTraceData) {
906
+ this._impl._callLevelTraceData.statement = sql;
907
+ }
900
908
  result = await this._impl.execute(sql, numIters, binds, options, false);
901
909
  } catch (err) {
902
910
  if (err.errorNum === 1406)
@@ -1037,6 +1045,63 @@ class Connection extends EventEmitter {
1037
1045
  return this._impl && this._impl.getDbName();
1038
1046
  }
1039
1047
 
1048
+ //---------------------------------------------------------------------------
1049
+ // hostName (READONLY)
1050
+ //
1051
+ // Property for identifying the hostName of the Oracle Database.
1052
+ //---------------------------------------------------------------------------
1053
+ get hostName() {
1054
+ return this._impl && this._impl.getHostName();
1055
+ }
1056
+
1057
+ //---------------------------------------------------------------------------
1058
+ // port (READONLY)
1059
+ //
1060
+ // Property for identifying the port to which client is connected.
1061
+ //---------------------------------------------------------------------------
1062
+ get port() {
1063
+ return this._impl && this._impl.getPort();
1064
+ }
1065
+
1066
+ //---------------------------------------------------------------------------
1067
+ // protocol (READONLY)
1068
+ //
1069
+ // Property for identifying the protocol used to connect to Oracle Database.
1070
+ //---------------------------------------------------------------------------
1071
+ get protocol() {
1072
+ return this._impl && this._impl.getProtocol();
1073
+ }
1074
+
1075
+ //---------------------------------------------------------------------------
1076
+ // connectString (READONLY)
1077
+ //
1078
+ // User provided connectString to connect to Oracle Database.
1079
+ //---------------------------------------------------------------------------
1080
+ get connectString() {
1081
+ return this._impl && this._impl._connectString;
1082
+ }
1083
+
1084
+ //---------------------------------------------------------------------------
1085
+ // user
1086
+ //
1087
+ // User property provided to connect to Oracle Database.
1088
+ //---------------------------------------------------------------------------
1089
+ get user() {
1090
+ if (this.currentSchema.length) {
1091
+ return this.currentSchema;
1092
+ }
1093
+ return this._impl && this._impl._user;
1094
+ }
1095
+
1096
+ //---------------------------------------------------------------------------
1097
+ // connectTraceConfig
1098
+ //
1099
+ // Property for getting the connection related config.
1100
+ //---------------------------------------------------------------------------
1101
+ get connectTraceConfig() {
1102
+ return this._impl && this._impl._getConnectTraceConfig();
1103
+ }
1104
+
1040
1105
  //---------------------------------------------------------------------------
1041
1106
  // getDbObjectClass()
1042
1107
  //
@@ -1412,7 +1477,7 @@ class Connection extends EventEmitter {
1412
1477
  async tpcBegin(xid, flag, timeout) {
1413
1478
  errors.assertArgCount(arguments, 1, 3);
1414
1479
  errors.assertParamValue(nodbUtil.isXid(xid), 1);
1415
-
1480
+ const normalizedXid = nodbUtil.normalizeXid(xid);
1416
1481
  if (arguments.length < 3) {
1417
1482
  timeout = 60; // seconds
1418
1483
  } else {
@@ -1423,9 +1488,14 @@ class Connection extends EventEmitter {
1423
1488
  flag = constants.TPC_BEGIN_NEW;
1424
1489
  } else {
1425
1490
  errors.assertParamValue(typeof flag === 'number', 2);
1491
+ const options = [constants.TPC_BEGIN_NEW, constants.TPC_BEGIN_JOIN,
1492
+ constants.TPC_BEGIN_RESUME, constants.TPC_BEGIN_PROMOTE];
1493
+ if (options.indexOf(flag) < 0) {
1494
+ errors.throwErr(errors.ERR_INVALID_TPC_BEGIN_FLAGS);
1495
+ }
1426
1496
  }
1427
1497
  errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
1428
- await this._impl.tpcBegin(xid, flag, timeout);
1498
+ await this._impl.tpcBegin(normalizedXid, flag, timeout);
1429
1499
  }
1430
1500
 
1431
1501
  //---------------------------------------------------------------------------
@@ -1441,11 +1511,13 @@ class Connection extends EventEmitter {
1441
1511
  } else {
1442
1512
  errors.assertParamValue(typeof onePhase === 'boolean', 2);
1443
1513
  }
1514
+ let normalizedXid;
1444
1515
  if (arguments.length >= 1) {
1445
1516
  errors.assertParamValue(nodbUtil.isXid(xid), 1);
1517
+ normalizedXid = nodbUtil.normalizeXid(xid);
1446
1518
  }
1447
1519
  errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
1448
- await this._impl.tpcCommit(xid, onePhase);
1520
+ await this._impl.tpcCommit(normalizedXid, onePhase);
1449
1521
  }
1450
1522
 
1451
1523
  //---------------------------------------------------------------------------
@@ -1460,14 +1532,19 @@ class Connection extends EventEmitter {
1460
1532
  flag = constants.TPC_END_NORMAL;
1461
1533
  } else {
1462
1534
  errors.assertParamValue(typeof flag === 'number', 2);
1535
+ const options = [constants.TPC_END_NORMAL, constants.TPC_END_SUSPEND];
1536
+ if (!options.includes(flag)) {
1537
+ errors.throwErr(errors.ERR_INVALID_TPC_END_FLAGS);
1538
+ }
1463
1539
  }
1464
-
1540
+ let normalizedXid;
1465
1541
  if (arguments.length >= 1) {
1466
1542
  errors.assertParamValue(nodbUtil.isXid(xid), 1);
1543
+ normalizedXid = nodbUtil.normalizeXid(xid);
1467
1544
  }
1468
1545
  errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
1469
1546
 
1470
- await this._impl.tpcEnd(xid, flag);
1547
+ await this._impl.tpcEnd(normalizedXid, flag);
1471
1548
  }
1472
1549
 
1473
1550
  //---------------------------------------------------------------------------
@@ -1479,9 +1556,10 @@ class Connection extends EventEmitter {
1479
1556
  async tpcForget(xid) {
1480
1557
  errors.assertArgCount(arguments, 1, 1);
1481
1558
  errors.assertParamValue(nodbUtil.isXid(xid), 1);
1559
+ const normalizedXid = nodbUtil.normalizeXid(xid);
1482
1560
  errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
1483
1561
 
1484
- await this._impl.tpcForget(xid);
1562
+ await this._impl.tpcForget(normalizedXid);
1485
1563
  }
1486
1564
 
1487
1565
  //---------------------------------------------------------------------------
@@ -1491,12 +1569,14 @@ class Connection extends EventEmitter {
1491
1569
  //---------------------------------------------------------------------------
1492
1570
  async tpcPrepare(xid) {
1493
1571
  errors.assertArgCount(arguments, 0, 1);
1572
+ let normalizedXid;
1494
1573
  if (arguments.length >= 1) {
1495
1574
  errors.assertParamValue(nodbUtil.isXid(xid), 1);
1575
+ normalizedXid = nodbUtil.normalizeXid(xid);
1496
1576
  }
1497
1577
  errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
1498
1578
 
1499
- return await this._impl.tpcPrepare(xid);
1579
+ return await this._impl.tpcPrepare(normalizedXid);
1500
1580
  }
1501
1581
 
1502
1582
  //---------------------------------------------------------------------------
@@ -1541,12 +1621,14 @@ class Connection extends EventEmitter {
1541
1621
  //---------------------------------------------------------------------------
1542
1622
  async tpcRollback(xid) {
1543
1623
  errors.assertArgCount(arguments, 0, 1);
1624
+ let normalizedXid;
1544
1625
  if (arguments.length == 1) {
1545
1626
  errors.assertParamValue(nodbUtil.isXid(xid), 1);
1627
+ normalizedXid = nodbUtil.normalizeXid(xid);
1546
1628
  }
1547
1629
  errors.assert(this._impl, errors.ERR_INVALID_CONNECTION);
1548
1630
 
1549
- await this._impl.tpcRollback(xid);
1631
+ await this._impl.tpcRollback(normalizedXid);
1550
1632
  }
1551
1633
 
1552
1634
  //---------------------------------------------------------------------------
@@ -1569,7 +1651,9 @@ class Connection extends EventEmitter {
1569
1651
  // that cannot take place concurrently
1570
1652
  // NOTE: breakExecution() should not be serialized
1571
1653
  Connection.prototype.break =
1572
- nodbUtil.callbackify(Connection.prototype.breakExecution);
1654
+ nodbUtil.callbackify(nodbUtil.wrapFn(Connection.prototype.breakExecution));
1655
+ Connection.prototype.tpcRecover =
1656
+ nodbUtil.callbackify(nodbUtil.wrapFn(Connection.prototype.tpcRecover));
1573
1657
  nodbUtil.wrapFns(Connection.prototype,
1574
1658
  "changePassword",
1575
1659
  "close",
@@ -1590,7 +1674,6 @@ nodbUtil.wrapFns(Connection.prototype,
1590
1674
  "tpcEnd",
1591
1675
  "tpcForget",
1592
1676
  "tpcPrepare",
1593
- "tpcRecover",
1594
1677
  "tpcRollback",
1595
1678
  "unsubscribe");
1596
1679
 
package/lib/constants.js CHANGED
@@ -205,5 +205,6 @@ module.exports = {
205
205
  VECTOR_FORMAT_FLOAT32: 2,
206
206
  VECTOR_FORMAT_FLOAT64: 3,
207
207
  VECTOR_FORMAT_INT8: 4,
208
+ VECTOR_FORMAT_BINARY: 5,
208
209
 
209
210
  };
package/lib/errors.js CHANGED
@@ -108,7 +108,7 @@ const ERR_MISSING_FILE = 91;
108
108
  const ERR_INVALID_NUMBER_OF_CONNECTIONS = 92;
109
109
  const ERR_EXEC_MODE_ONLY_FOR_DML = 95;
110
110
  const ERR_INVALID_BIND_NAME = 97;
111
- const ERR_WRONG_NUMBER_OF_POSITIONAL_BINDS = 98;
111
+ const ERR_WRONG_NUMBER_OF_BINDS = 98;
112
112
  const ERR_BUFFER_LENGTH_INSUFFICIENT = 99;
113
113
  const ERR_NCHAR_CS_NOT_SUPPORTED = 100;
114
114
  const ERR_MISSING_CREDENTIALS = 101;
@@ -156,6 +156,14 @@ const ERR_VECTOR_VERSION_NOT_SUPPORTED = 145;
156
156
  const ERR_OBJECT_IS_NOT_A_COLLECTION = 146;
157
157
  const ERR_CURSOR_HAS_BEEN_CLOSED = 147;
158
158
  const ERR_DML_RETURNING_DUP_BINDS = 149;
159
+ const ERR_INVALID_TPC_BEGIN_FLAGS = 150;
160
+ const ERR_INVALID_TPC_END_FLAGS = 151;
161
+ const ERR_UNKNOWN_TRANSACTION_STATE = 152;
162
+ const ERR_INVALID_TRANSACTION_SIZE = 153;
163
+ const ERR_INVALID_BRANCH_SIZE = 154;
164
+ const ERR_OPERATION_NOT_SUPPORTED_ON_BFILE = 155;
165
+ const ERR_OPERATION_ONLY_SUPPORTED_ON_BFILE = 156;
166
+ const ERR_EXECMANY_NOT_ALLOWED_ON_QUERIES = 157;
159
167
 
160
168
  // Oracle Net layer errors start from 500
161
169
  const ERR_CONNECTION_CLOSED = 500;
@@ -179,6 +187,14 @@ const ERR_INVALID_SERVICE_NAME = 518;
179
187
  const ERR_INVALID_SID = 519;
180
188
  const ERR_TNS_NAMES_FILE_MISSING = 520;
181
189
  const ERR_CONNECTION_EOF = 521;
190
+ const ERR_AZURE_CONFIG_PROVIDER_AUTH_FAILED = 522;
191
+ const ERR_CONFIG_PROVIDER_FAILED_TO_RETRIEVE_CONFIG = 523;
192
+ const ERR_CONFIG_PROVIDER_NOT_SUPPORTED = 524;
193
+ const ERR_CONFIG_PROVIDER_LOAD_FAILED = 525;
194
+ const ERR_OCIOBJECT_CONFIG_PROVIDER_AUTH_FAILED = 526;
195
+ const ERR_AZURE_VAULT_AUTH_FAILED = 527;
196
+ const ERR_AZURE_SERVICE_PRINCIPAL_AUTH_FAILED = 528;
197
+ const ERR_WALLET_TYPE_NOT_SUPPORTED = 529;
182
198
 
183
199
  // Oracle SUCCESS_WITH_INFO warning start from 700
184
200
  const WRN_COMPILATION_CREATE = 700;
@@ -338,8 +354,8 @@ messages.set(ERR_EXEC_MODE_ONLY_FOR_DML, // NJS-095
338
354
  'setting "batchErrors" or "dmlRowCounts" to true is only permitted for DML statements');
339
355
  messages.set(ERR_INVALID_BIND_NAME, // NJS-097
340
356
  'no bind placeholder named ":%s" was found in the statement text');
341
- messages.set(ERR_WRONG_NUMBER_OF_POSITIONAL_BINDS, // NJS-098
342
- '%s positional bind values are required but %s were provided');
357
+ messages.set(ERR_WRONG_NUMBER_OF_BINDS, // NJS-098
358
+ '%s bind placeholders were used in the SQL statement but %s bind values were provided');
343
359
  messages.set(ERR_BUFFER_LENGTH_INSUFFICIENT, // NJS-099
344
360
  'internal error: buffer of length %s insufficient to hold %s bytes');
345
361
  messages.set(ERR_NCHAR_CS_NOT_SUPPORTED, // NJS-100
@@ -434,6 +450,22 @@ messages.set(ERR_CURSOR_HAS_BEEN_CLOSED, // NJS-147
434
450
  'cursor has been closed by the database');
435
451
  messages.set(ERR_DML_RETURNING_DUP_BINDS, // NJS-149
436
452
  'the bind variable placeholder "%s" cannot be used both before and after the RETURNING clause in a DML RETURNING statement');
453
+ messages.set(ERR_INVALID_TPC_BEGIN_FLAGS, // NJS-150
454
+ 'invalid flags for tpcBegin() in Two Phase Commit');
455
+ messages.set(ERR_INVALID_TPC_END_FLAGS, // NJS-151
456
+ 'invalid flags for tpcEnd() in Two Phase Commit');
457
+ messages.set(ERR_UNKNOWN_TRANSACTION_STATE, // NJS-152
458
+ 'internal error: unknown transaction state {state} in Two Phase Commit');
459
+ messages.set(ERR_INVALID_TRANSACTION_SIZE, // NJS-153
460
+ 'size of the transaction ID is %d and cannot exceed 64');
461
+ messages.set(ERR_INVALID_BRANCH_SIZE, // NJS-154
462
+ 'size of the branch ID is %d and cannot exceed 64');
463
+ messages.set(ERR_OPERATION_NOT_SUPPORTED_ON_BFILE, // NJS-155
464
+ 'operation is not supported on BFILE LOBs');
465
+ messages.set(ERR_OPERATION_ONLY_SUPPORTED_ON_BFILE, // NJS-156
466
+ 'operation is only supported on BFILE LOBs');
467
+ messages.set(ERR_EXECMANY_NOT_ALLOWED_ON_QUERIES, // NJS-157
468
+ 'executeMany() cannot be used with SELECT statement or WITH SQL clause');
437
469
 
438
470
  // Oracle Net layer errors
439
471
 
@@ -446,7 +478,7 @@ messages.set(ERR_CONNECTION_INCOMPLETE, // NJS-503
446
478
  messages.set(ERR_PROXY_CONNECTION_FAILURE, // NJS-504
447
479
  'connection establishment through a web proxy at host %s port %d failed. (CONNECTION_ID=%s)\n%s');
448
480
  messages.set(ERR_TLS_INIT_FAILURE, // NJS-505
449
- 'unable to initiate TLS connection. Please check if wallet credentials are valid');
481
+ 'unable to initiate TLS connection. Please check if wallet credentials are valid\n%s');
450
482
  messages.set(ERR_TLS_AUTH_FAILURE, // NJS-506
451
483
  'connection to host %s port %d encountered TLS handshake failure. (CONNECTION_ID=%s)\n%s');
452
484
  messages.set(ERR_TLS_DNMATCH_FAILURE, // NJS-507
@@ -479,7 +511,21 @@ messages.set(ERR_TNS_NAMES_FILE_MISSING, // NJS-520
479
511
  'cannot connect to Oracle Database. File tnsnames.ora not found in %s');
480
512
  messages.set(ERR_CONNECTION_EOF, // NJS-521
481
513
  'connection to host %s port %d received end-of-file on communication channel. (CONNECTION_ID=%s)');
482
-
514
+ messages.set(ERR_AZURE_CONFIG_PROVIDER_AUTH_FAILED, // NJS-522
515
+ 'Azure Authentication Failed: The authentication parameter value %s may be incorrect');
516
+ messages.set(ERR_CONFIG_PROVIDER_FAILED_TO_RETRIEVE_CONFIG, // NJS-523
517
+ 'Failed to retrieve configuration from Centralized Configuration Provider:\n %s');
518
+ messages.set(ERR_CONFIG_PROVIDER_NOT_SUPPORTED, // NJS-524
519
+ 'Configuration Provider not supported: %s');
520
+ messages.set(ERR_CONFIG_PROVIDER_LOAD_FAILED, // NJS-525
521
+ 'Centralized Config Provider failed to load required libraries. Please install the required libraries.\n %s');
522
+ messages.set(ERR_OCIOBJECT_CONFIG_PROVIDER_AUTH_FAILED, // NJS-526
523
+ 'OCI authentication failed: The authentication parameter value %s may be incorrect');
524
+ messages.set(ERR_AZURE_VAULT_AUTH_FAILED, // NJS-527
525
+ 'Azure Vault: Provide correct azure vault authentication details');
526
+ messages.set(ERR_AZURE_SERVICE_PRINCIPAL_AUTH_FAILED, // NJS-528
527
+ 'Azure service principal authentication requires either a client certificate path or a client secret string');
528
+ messages.set(ERR_WALLET_TYPE_NOT_SUPPORTED, 'Invalid wallet content format. Supported format is PEM');// NJS-529
483
529
  // Oracle SUCCESS_WITH_INFO warning
484
530
 
485
531
  messages.set(WRN_COMPILATION_CREATE, // NJS-700
@@ -789,8 +835,16 @@ module.exports = {
789
835
  ERR_NO_CONFIG_DIR,
790
836
  ERR_TNS_ENTRY_NOT_FOUND,
791
837
  ERR_CONNECTION_EOF,
838
+ ERR_AZURE_CONFIG_PROVIDER_AUTH_FAILED,
839
+ ERR_OCIOBJECT_CONFIG_PROVIDER_AUTH_FAILED,
840
+ ERR_AZURE_VAULT_AUTH_FAILED,
841
+ ERR_AZURE_SERVICE_PRINCIPAL_AUTH_FAILED,
842
+ ERR_CONFIG_PROVIDER_FAILED_TO_RETRIEVE_CONFIG,
843
+ ERR_CONFIG_PROVIDER_NOT_SUPPORTED,
844
+ ERR_CONFIG_PROVIDER_LOAD_FAILED,
845
+ ERR_WALLET_TYPE_NOT_SUPPORTED,
792
846
  ERR_INVALID_BIND_NAME,
793
- ERR_WRONG_NUMBER_OF_POSITIONAL_BINDS,
847
+ ERR_WRONG_NUMBER_OF_BINDS,
794
848
  ERR_BUFFER_LENGTH_INSUFFICIENT,
795
849
  ERR_NCHAR_CS_NOT_SUPPORTED,
796
850
  ERR_MISSING_CREDENTIALS,
@@ -841,7 +895,15 @@ module.exports = {
841
895
  ERR_OBJECT_IS_NOT_A_COLLECTION,
842
896
  ERR_CURSOR_HAS_BEEN_CLOSED,
843
897
  ERR_DML_RETURNING_DUP_BINDS,
898
+ ERR_INVALID_TPC_BEGIN_FLAGS,
899
+ ERR_INVALID_TPC_END_FLAGS,
900
+ ERR_UNKNOWN_TRANSACTION_STATE,
901
+ ERR_INVALID_TRANSACTION_SIZE,
902
+ ERR_INVALID_BRANCH_SIZE,
844
903
  ERR_CONNECTION_CLOSED_CODE: `${ERR_PREFIX}-${ERR_CONNECTION_CLOSED}`,
904
+ ERR_OPERATION_NOT_SUPPORTED_ON_BFILE,
905
+ ERR_OPERATION_ONLY_SUPPORTED_ON_BFILE,
906
+ ERR_EXECMANY_NOT_ALLOWED_ON_QUERIES,
845
907
  WRN_COMPILATION_CREATE,
846
908
  assert,
847
909
  assertArgCount,
@@ -27,8 +27,9 @@
27
27
  'use strict';
28
28
 
29
29
  const errors = require('../errors.js');
30
+ const BaseImpl = require('./base.js');
30
31
 
31
- class AqQueueImpl {
32
+ class AqQueueImpl extends BaseImpl {
32
33
 
33
34
  //---------------------------------------------------------------------------
34
35
  // _getConnImpl()
@@ -0,0 +1,45 @@
1
+ // Copyright (c) 2024, Oracle and/or its affiliates.
2
+
3
+ //-----------------------------------------------------------------------------
4
+ //
5
+ // This software is dual-licensed to you under the Universal Permissive License
6
+ // (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
7
+ // 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
8
+ // either license.
9
+ //
10
+ // If you elect to accept the software under the Apache License, Version 2.0,
11
+ // the following applies:
12
+ //
13
+ // Licensed under the Apache License, Version 2.0 (the "License");
14
+ // you may not use this file except in compliance with the License.
15
+ // You may obtain a copy of the License at
16
+ //
17
+ // https://www.apache.org/licenses/LICENSE-2.0
18
+ //
19
+ // Unless required by applicable law or agreed to in writing, software
20
+ // distributed under the License is distributed on an "AS IS" BASIS,
21
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ // See the License for the specific language governing permissions and
23
+ // limitations under the License.
24
+ //
25
+ //-----------------------------------------------------------------------------
26
+
27
+ 'use strict';
28
+
29
+ class BaseImpl {
30
+
31
+ //---------------------------------------------------------------------------
32
+ // _getConnectTraceConfig()
33
+ //
34
+ // Retrieves connect trace config from connection object.
35
+ //---------------------------------------------------------------------------
36
+ _getConnectTraceConfig() {
37
+ const connImpl = this._getConnImpl();
38
+ if (connImpl) {
39
+ return connImpl._getConnectTraceConfig();
40
+ }
41
+ }
42
+
43
+ }
44
+
45
+ module.exports = BaseImpl;
@@ -69,6 +69,32 @@ class ConnectionImpl {
69
69
  return this;
70
70
  }
71
71
 
72
+ //---------------------------------------------------------------------------
73
+ // _getConnectTraceConfig()
74
+ //
75
+ // returns the necessary connection config used for debug/trace.
76
+ // ---------------------------------------------------------------------------
77
+ _getConnectTraceConfig() {
78
+ let traceConfig;
79
+
80
+ if (this._pool) {
81
+ traceConfig = this._pool._getConnectTraceConfig();
82
+ } else {
83
+ traceConfig = {connectString: this._connectString, user: this._user};
84
+ }
85
+ traceConfig.serviceName = this.getServiceName();
86
+ traceConfig.instanceName = this.getInstanceName();
87
+ traceConfig.pdbName = this.getDbName();
88
+
89
+ // Thick mode doesnt have these properties for now.
90
+ if (settings.thin) {
91
+ traceConfig.hostName = this.getHostName();
92
+ traceConfig.port = this.getPort();
93
+ traceConfig.protocol = this.getProtocol();
94
+ }
95
+ return traceConfig;
96
+ }
97
+
72
98
  //---------------------------------------------------------------------------
73
99
  // _getDbObjectType()
74
100
  //
@@ -589,6 +615,33 @@ class ConnectionImpl {
589
615
  errors.throwNotImplemented("unsubscribing from events");
590
616
  }
591
617
 
618
+ //---------------------------------------------------------------------------
619
+ // getHostName()
620
+ //
621
+ // Returns the Oracle Database host name associated with the connection.
622
+ //---------------------------------------------------------------------------
623
+ getHostName() {
624
+ errors.throwNotImplemented("getting HostName");
625
+ }
626
+
627
+ //---------------------------------------------------------------------------
628
+ // getPort()
629
+ //
630
+ // Returns the Oracle Database port number associated with the connection.
631
+ //---------------------------------------------------------------------------
632
+ getPort() {
633
+ errors.throwNotImplemented("getting Port");
634
+ }
635
+
636
+ //---------------------------------------------------------------------------
637
+ // getProtocol()
638
+ //
639
+ // Returns the protocol associated with the connection.
640
+ //---------------------------------------------------------------------------
641
+ getProtocol() {
642
+ errors.throwNotImplemented("getting Protocol");
643
+ }
644
+
592
645
  }
593
646
 
594
647
  // export just the class
@@ -32,7 +32,8 @@ module.exports = {
32
32
 
33
33
  // vector constants
34
34
  TNS_VECTOR_MAGIC_BYTE: 0xDB,
35
- TNS_VECTOR_VERSION: 0,
35
+ TNS_VECTOR_VERSION_BASE: 0,
36
+ TNS_VECTOR_VERSION_WITH_BINARY: 1,
36
37
 
37
38
  // vector flags
38
39
  TNS_VECTOR_FLAG_NORMSRC: 0x0010,
@@ -99,6 +100,7 @@ module.exports = {
99
100
  VECTOR_FORMAT_FLOAT32: constants.VECTOR_FORMAT_FLOAT32,
100
101
  VECTOR_FORMAT_FLOAT64: constants.VECTOR_FORMAT_FLOAT64,
101
102
  VECTOR_FORMAT_INT8: constants.VECTOR_FORMAT_INT8,
103
+ VECTOR_FORMAT_BINARY: constants.VECTOR_FORMAT_BINARY,
102
104
 
103
105
  TNS_NULL_LENGTH_INDICATOR: 255,
104
106
  TNS_LONG_LENGTH_INDICATOR: 254,
@@ -50,11 +50,11 @@ class VectorDecoder extends BaseBuffer {
50
50
  errors.throwErr(errors.ERR_UNEXPECTED_DATA,
51
51
  Buffer.from([magicByte]).toString('hex'));
52
52
  const version = this.readUInt8();
53
- if (version != constants.TNS_VECTOR_VERSION)
53
+ if (version > constants.TNS_VECTOR_VERSION_WITH_BINARY)
54
54
  errors.throwErr(errors.ERR_VECTOR_VERSION_NOT_SUPPORTED, version);
55
55
  const flags = this.readUInt16BE();
56
56
  const vectorFormat = this.readUInt8();
57
- const numElements = this.readUInt32BE();
57
+ let numElements = this.readUInt32BE();
58
58
  let elementSize, result;
59
59
  if (vectorFormat === constants.VECTOR_FORMAT_FLOAT32) {
60
60
  elementSize = 4;
@@ -65,10 +65,18 @@ class VectorDecoder extends BaseBuffer {
65
65
  } else if (vectorFormat === constants.VECTOR_FORMAT_INT8) {
66
66
  elementSize = 1;
67
67
  result = new Int8Array(numElements);
68
+ } else if (vectorFormat === constants.VECTOR_FORMAT_BINARY) {
69
+ elementSize = 1;
70
+ // The number of dimensions are assumed to be multiple of 8.
71
+ numElements = numElements / 8;
72
+ result = new Uint8Array(numElements);
68
73
  } else {
69
74
  errors.throwErr(errors.ERR_VECTOR_FORMAT_NOT_SUPPORTED, vectorFormat);
70
75
  }
71
- if (flags & constants.TNS_VECTOR_FLAG_NORM)
76
+
77
+ // For binary vector, NORM will never be present but space for NORM is reserved to keep
78
+ // same header lengh across the different vector formats.
79
+ if (vectorFormat === constants.VECTOR_FORMAT_BINARY || flags & constants.TNS_VECTOR_FLAG_NORM)
72
80
  this.skipBytes(8);
73
81
 
74
82
  // parse data
@@ -100,6 +108,10 @@ class VectorEncoder extends GrowableBuffer {
100
108
  // determine some basic information about the vector
101
109
  let vectorFormat = constants.VECTOR_FORMAT_FLOAT32;
102
110
  let writeFn = this.writeBinaryFloat.bind(this);
111
+ let numElements = value.length;
112
+ let vectorVersion = constants.TNS_VECTOR_VERSION_BASE;
113
+ let flags = constants.TNS_VECTOR_FLAG_NORMSRC
114
+ | constants.TNS_VECTOR_FLAG_NORM; // NORM is present and reserve space.
103
115
 
104
116
  if (Array.isArray(value) || value instanceof Float64Array) {
105
117
  vectorFormat = constants.VECTOR_FORMAT_FLOAT64;
@@ -107,18 +119,21 @@ class VectorEncoder extends GrowableBuffer {
107
119
  } else if (value instanceof Int8Array) {
108
120
  vectorFormat = constants.VECTOR_FORMAT_INT8;
109
121
  writeFn = this.writeSB1.bind(this);
122
+ } else if (value.constructor.name === 'Uint8Array') {
123
+ vectorFormat = constants.VECTOR_FORMAT_BINARY;
124
+ // The number of dimensions are assumed to be multiple of 8.
125
+ numElements = numElements * 8;
126
+ vectorVersion = constants.TNS_VECTOR_VERSION_WITH_BINARY;
127
+ flags = constants.TNS_VECTOR_FLAG_NORMSRC; // only space is reserved.
128
+ writeFn = this.writeUInt8.bind(this);
110
129
  }
111
130
 
112
- // Let server generate the norm (TNS_VECTOR_FLAG_NORMSRC)
113
- const flags = constants.TNS_VECTOR_FLAG_NORM
114
- | constants.TNS_VECTOR_FLAG_NORMSRC;
115
-
116
131
  // write header
117
132
  this.writeUInt8(constants.TNS_VECTOR_MAGIC_BYTE);
118
- this.writeUInt8(constants.TNS_VECTOR_VERSION);
133
+ this.writeUInt8(vectorVersion);
119
134
  this.writeUInt16BE(flags);
120
135
  this.writeUInt8(vectorFormat);
121
- this.writeUInt32BE(value.length);
136
+ this.writeUInt32BE(numElements);
122
137
  this.reserveBytes(8);
123
138
 
124
139
  // write data
package/lib/impl/lob.js CHANGED
@@ -28,8 +28,9 @@
28
28
 
29
29
  const ConnectionImpl = require('./connection.js');
30
30
  const errors = require('../errors.js');
31
+ const BaseImpl = require('./base.js');
31
32
 
32
- class LobImpl {
33
+ class LobImpl extends BaseImpl {
33
34
 
34
35
  //---------------------------------------------------------------------------
35
36
  // _getConnImpl()
@@ -53,6 +54,15 @@ class LobImpl {
53
54
  errors.throwNotImplemented("closing a LOB");
54
55
  }
55
56
 
57
+ //---------------------------------------------------------------------------
58
+ // fileExists()
59
+ //
60
+ // Checks if BFILE present or not.
61
+ //---------------------------------------------------------------------------
62
+ fileExists() {
63
+ errors.throwNotImplemented("check if BFILE exists");
64
+ }
65
+
56
66
  //---------------------------------------------------------------------------
57
67
  // getData()
58
68
  //
@@ -62,6 +72,15 @@ class LobImpl {
62
72
  errors.throwNotImplemented("getting all of the data from a LOB");
63
73
  }
64
74
 
75
+ //---------------------------------------------------------------------------
76
+ // getDirFileName()
77
+ //
78
+ // returns directory and filename of LOB (BFILE).
79
+ //----------------------------------------------------------------------------
80
+ getDirFileName() {
81
+ errors.throwNotImplemented("getting directory and filename of LOB(BFILE)");
82
+ }
83
+
65
84
  //---------------------------------------------------------------------------
66
85
  // read()
67
86
  //
@@ -71,6 +90,15 @@ class LobImpl {
71
90
  errors.throwNotImplemented("reading from a LOB");
72
91
  }
73
92
 
93
+ //---------------------------------------------------------------------------
94
+ // setDirFileName()
95
+ //
96
+ // sets directory and filename for LOB (BFILE)
97
+ //---------------------------------------------------------------------------
98
+ setDirFileName() {
99
+ errors.throwNotImplemented("setting directory and filename of LOB(BFILE)");
100
+ }
101
+
74
102
  //---------------------------------------------------------------------------
75
103
  // write()
76
104
  //
package/lib/impl/pool.js CHANGED
@@ -174,6 +174,21 @@ class PoolImpl {
174
174
  errors.throwNotImplemented("getting the pool statement cache size");
175
175
  }
176
176
 
177
+ //---------------------------------------------------------------------------
178
+ // _getConnectTraceConfig()
179
+ //
180
+ // Returns the necessary connection config used by pool for debug/trace.
181
+ //---------------------------------------------------------------------------
182
+ _getConnectTraceConfig() {
183
+ return {
184
+ connectString: this._connectString,
185
+ user: this._user,
186
+ poolMin: this.getPoolMin(),
187
+ poolMax: this.getPoolMax(),
188
+ poolIncrement: this.getPoolIncrement()
189
+ };
190
+ }
191
+
177
192
  //---------------------------------------------------------------------------
178
193
  // getSodaMetaDataCache()
179
194
  //