oracledb 6.1.0 → 6.3.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/README.md +2 -2
- package/build/Release/oracledb-6.3.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.3.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.3.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.3.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.3.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.3.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.3.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.3.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.3.0-win32-x64.node-buildinfo.txt +1 -0
- package/examples/README.md +26 -8
- package/examples/dbconfig.js +57 -40
- package/examples/example.js +6 -4
- package/lib/connection.js +67 -1
- package/lib/dbObject.js +9 -0
- package/lib/errors.js +25 -7
- package/lib/future.js +53 -0
- package/lib/impl/connection.js +56 -0
- package/lib/impl/pool.js +5 -3
- package/lib/impl/resultset.js +48 -11
- package/lib/oracledb.js +34 -14
- package/lib/pool.js +10 -0
- package/lib/sodaCollection.js +11 -0
- package/lib/sodaOperation.js +16 -0
- package/lib/thin/connection.js +184 -155
- package/lib/thin/dbObject.js +49 -2
- package/lib/thin/index.js +1 -1
- package/lib/thin/pool.js +3 -2
- package/lib/thin/protocol/buffer.js +79 -70
- package/lib/thin/protocol/capabilities.js +3 -1
- package/lib/thin/protocol/constants.js +31 -14
- package/lib/thin/protocol/messages/auth.js +6 -2
- package/lib/thin/protocol/messages/base.js +36 -14
- package/lib/thin/protocol/messages/dataType.js +8 -5
- package/lib/thin/protocol/messages/lobOp.js +7 -8
- package/lib/thin/protocol/messages/withData.js +62 -22
- package/lib/thin/protocol/oson.js +13 -10
- package/lib/thin/protocol/packet.js +6 -5
- package/lib/thin/protocol/utils.js +2 -2
- package/lib/thin/sqlnet/connStrategy.js +8 -4
- package/lib/thin/sqlnet/constants.js +138 -138
- package/lib/thin/sqlnet/ezConnectResolver.js +10 -43
- package/lib/thin/sqlnet/navNodes.js +7 -7
- package/lib/thin/sqlnet/networkSession.js +22 -21
- package/lib/thin/sqlnet/ntTcp.js +7 -7
- package/lib/thin/sqlnet/packet.js +1 -1
- package/lib/thin/statement.js +345 -113
- package/lib/thin/util.js +35 -86
- package/lib/types.js +6 -1
- package/lib/util.js +12 -0
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/build/Release/oracledb-6.1.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.1.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.1.0-js-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.1.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.1.0-linux-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.1.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.1.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.1.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.1.0-win32-x64.node-buildinfo.txt +0 -1
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# node-oracledb version 6.
|
|
1
|
+
# node-oracledb version 6.3.0
|
|
2
2
|
|
|
3
3
|
The node-oracledb add-on for Node.js powers high performance Oracle Database
|
|
4
4
|
applications. Applications can be written in TypeScript, or directly in
|
|
5
5
|
JavaScript.
|
|
6
6
|
|
|
7
|
-
Use node-oracledb 6.
|
|
7
|
+
Use node-oracledb 6.3.0 to connect Node.js 14.6, or later, to Oracle
|
|
8
8
|
Database. Older versions of node-oracledb may work with older versions of
|
|
9
9
|
Node.js.
|
|
10
10
|
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.3.0-darwin-x64.node v18.16.0 6430a56e82b0405c4118fcc1060c3568be4c43aa 4b8ebc2af8c9d58f7260c9de81d220f14fcab777 Sun, 17 Dec 2023 09:33:07 GMT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
6430a56e82b0405c4118fcc1060c3568be4c43aa
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.3.0-linux-arm64.node v16.20.2 6430a56e82b0405c4118fcc1060c3568be4c43aa 4b8ebc2af8c9d58f7260c9de81d220f14fcab777 Sun, 17 Dec 2023 09:47:35 GMT
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.3.0-linux-x64.node v16.19.1 6430a56e82b0405c4118fcc1060c3568be4c43aa 4b8ebc2af8c9d58f7260c9de81d220f14fcab777 Fri, 15 Dec 2023 17:32:48 GMT
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
oracledb-6.3.0-win32-x64.node v14.17.3 6430a56e82b0405c4118fcc1060c3568be4c43aa 4b8ebc2af8c9d58f7260c9de81d220f14fcab777 Fri, 15 Dec 2023 17:43:19 GMT
|
package/examples/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Node-oracledb Examples
|
|
2
2
|
|
|
3
|
-
The directory in node-oracledb's [Github repository](https://github.com/oracle/node-oracledb/tree/main/examples) contains a lot of [node-oracledb](https://www.npmjs.com/package/oracledb)
|
|
4
|
-
|
|
5
|
-
[here](https://node-oracledb.readthedocs.io/en/latest/).
|
|
3
|
+
The directory in node-oracledb's [Github repository](https://github.com/oracle/node-oracledb/tree/main/examples) contains a lot of [node-oracledb](https://www.npmjs.com/package/oracledb) examples.
|
|
4
|
+
Documentation is [here](https://node-oracledb.readthedocs.io/en/latest/).
|
|
6
5
|
|
|
7
6
|
To run the examples:
|
|
8
7
|
|
|
@@ -11,18 +10,37 @@ To run the examples:
|
|
|
11
10
|
- Ensure that you navigate to the `examples` directory in your terminal window
|
|
12
11
|
or IDE, where you are running the samples.
|
|
13
12
|
|
|
14
|
-
- Review `dbconfig.js`.
|
|
15
|
-
variables. For example, set `NODE_ORACLEDB_PASSWORD` to the value of your
|
|
16
|
-
database password.
|
|
13
|
+
- Review `dbconfig.js`.
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
In your terminal window or IDE, set the following environment variables to
|
|
16
|
+
provide credentials for the `dbconfig.js` file.
|
|
17
|
+
|
|
18
|
+
- `NODE_ORACLEDB_USER` must be set to the database user.
|
|
19
|
+
|
|
20
|
+
- `NODE_ORACLEDB_PASSWORD` must be set to the database password.
|
|
21
|
+
|
|
22
|
+
- `NODE_ORACLEDB_CONNECTIONSTRING` must be set to the connection string that points to your database's location.
|
|
23
|
+
|
|
24
|
+
- `NODE_ORACLEDB_EXTERNALAUTH` provides the options for enabling external authentication. Setting this environment variable to "true" will enable external authentication. To ensure external authentication works, firstly make sure the Oracle external authentication service is correctly configured. See [Documentation for External Authentication](https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#extauth) for details.
|
|
25
|
+
|
|
26
|
+
- `NODE_ORACLEDB_DRIVER_MODE` provides an option to set the 'Thin' or 'Thick' modes of node-oracledb. Setting this environment variable to "thick" will enable Thick mode.
|
|
27
|
+
Setting it to "thin" will retain the Thin mode. The default mode is Thin.
|
|
28
|
+
|
|
29
|
+
- `NODE_ORACLEDB_WALLET_LOCATION` must be set to the local directory name for the wallets that may be required for mutual TLS (mTLS) connections, especially to Oracle Cloud
|
|
30
|
+
Autonomous Databases optionally. The wallet location can also be provided as a part of the database connect string.
|
|
31
|
+
|
|
32
|
+
- `NODE_ORACLEDB_WALLET_PASSWORD` must set to the password for the wallets that may be required for mutual TLS (mTLS) connections, especially to Oracle Cloud Autonomous Databases.
|
|
33
|
+
|
|
34
|
+
- `NODE_ORACLEDB_CLIENT_LIB_DIR` provides an optional path for the Oracle Client libraries to be used on Windows and macOS platforms, when using Thick mode in node-oracledb.
|
|
35
|
+
|
|
36
|
+
Review the examples and then run them individually. For example, to see what
|
|
19
37
|
the file `example.js` does, use:
|
|
20
38
|
|
|
21
39
|
```
|
|
22
40
|
node example.js
|
|
23
41
|
```
|
|
24
42
|
|
|
25
|
-
|
|
43
|
+
After running the examples, the demonstration objects can be dropped with
|
|
26
44
|
`demodrop.js`:
|
|
27
45
|
|
|
28
46
|
```
|
package/examples/dbconfig.js
CHANGED
|
@@ -26,17 +26,16 @@
|
|
|
26
26
|
* dbconfig.js
|
|
27
27
|
*
|
|
28
28
|
* DESCRIPTION
|
|
29
|
-
* Holds the credentials used by node-oracledb examples to connect
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* Holds the credentials used by node-oracledb examples to connect to the
|
|
30
|
+
* database. Production applications should consider using External
|
|
31
|
+
* Authentication to avoid hard coded credentials.
|
|
32
32
|
*
|
|
33
|
-
* To create a database user see
|
|
33
|
+
* To create a database user, see
|
|
34
34
|
* https://blogs.oracle.com/sql/post/how-to-create-users-grant-them-privileges-and-remove-them-in-oracle-database
|
|
35
35
|
*
|
|
36
|
-
* Applications can set the connectString value to an Easy Connect
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* database instance.
|
|
36
|
+
* Applications can set the connectString value to an Easy Connect string,
|
|
37
|
+
* or a Net Service Name from the tnsnames.ora file or an external naming
|
|
38
|
+
* service, or it can be the name of a local Oracle Database instance.
|
|
40
39
|
*
|
|
41
40
|
* If node-oracledb is linked with Instant Client, then an Easy
|
|
42
41
|
* Connect string is generally appropriate. The basic syntax is:
|
|
@@ -46,55 +45,73 @@
|
|
|
46
45
|
* Commonly just the host_name and service_name are needed
|
|
47
46
|
* e.g. "localhost/orclpdb1" or "example.com/XEPDB1"
|
|
48
47
|
*
|
|
49
|
-
* The Easy Connect syntax
|
|
50
|
-
*
|
|
48
|
+
* The Easy Connect syntax supports lots of options. To know more, please
|
|
49
|
+
* refer to the latest Oracle documentation on Easy Connect syntax:
|
|
51
50
|
* https://www.oracle.com/pls/topic/lookup?ctx=dblatest&id=GUID-B0437826-43C1-49EC-A94D-B650B6A4A6EE
|
|
52
51
|
*
|
|
53
|
-
* If using a tnsnames.ora file, the file can be in a default
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
52
|
+
* If using a tnsnames.ora file, the file can be in a default location such
|
|
53
|
+
* as $ORACLE_HOME/network/admin/tnsnames.ora or /etc/tnsnames.ora.
|
|
54
|
+
* Alternatively set the TNS_ADMIN environment variable and put the file in
|
|
55
|
+
* $TNS_ADMIN/tnsnames.ora.
|
|
57
56
|
*
|
|
58
|
-
* If connectString is not specified, the empty string "" is used
|
|
59
|
-
*
|
|
57
|
+
* If connectString is not specified, the empty string "" is used which
|
|
58
|
+
* indicates to connect to the local, default database.
|
|
60
59
|
*
|
|
61
|
-
* External Authentication can be used by setting the optional
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
* application.
|
|
66
|
-
*
|
|
60
|
+
* External Authentication can be used by setting the optional property
|
|
61
|
+
* externalAuth to true. External Authentication allows applications to use
|
|
62
|
+
* an external password store such as Oracle Wallet, so that passwords
|
|
63
|
+
* do not need to be hard coded into the application. The user and password
|
|
64
|
+
* application. The user and password properties for connecting or creating
|
|
65
|
+
* a pool should not be set when externalAuth is true.
|
|
67
66
|
*
|
|
68
67
|
* TROUBLESHOOTING
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* indicate connectString is invalid.
|
|
74
|
-
*
|
|
75
|
-
* The error:
|
|
76
|
-
* ORA-12514: TNS:listener does not currently know of requested in connect descriptor
|
|
77
|
-
* indicates connectString is invalid. You are reaching a computer
|
|
78
|
-
* with Oracle installed but the service name isn't known.
|
|
79
|
-
* Use 'lsnrctl services' on the database server to find available services
|
|
68
|
+
* Refer to the Error Handling section in node-oracledb documentation
|
|
69
|
+
* to understand the different types of errors in both the Thin and Thick
|
|
70
|
+
* modes of node-oracledb:
|
|
71
|
+
* https://node-oracledb.readthedocs.io/en/latest/user_guide/exception_handling.html#errors-in-thin-and-thick-modes
|
|
80
72
|
*
|
|
81
73
|
*****************************************************************************/
|
|
82
74
|
|
|
83
|
-
|
|
84
|
-
user
|
|
75
|
+
const config = {
|
|
76
|
+
user: process.env.NODE_ORACLEDB_USER,
|
|
85
77
|
|
|
86
78
|
// Get the password from the environment variable
|
|
87
79
|
// NODE_ORACLEDB_PASSWORD. The password could also be a hard coded
|
|
88
80
|
// string (not recommended), or it could be prompted for.
|
|
89
|
-
// Alternatively use External Authentication so that no password is
|
|
90
|
-
|
|
91
|
-
password : process.env.NODE_ORACLEDB_PASSWORD,
|
|
81
|
+
// Alternatively use External Authentication so that no password is needed.
|
|
82
|
+
password: process.env.NODE_ORACLEDB_PASSWORD,
|
|
92
83
|
|
|
93
84
|
// For information on connection strings see:
|
|
94
85
|
// https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#connectionstrings
|
|
95
|
-
connectString
|
|
86
|
+
connectString: process.env.NODE_ORACLEDB_CONNECTIONSTRING,
|
|
96
87
|
|
|
97
88
|
// Setting externalAuth is optional. It defaults to false. See:
|
|
98
89
|
// https://node-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#extauth
|
|
99
|
-
externalAuth
|
|
90
|
+
externalAuth: process.env.NODE_ORACLEDB_EXTERNALAUTH ? true : false,
|
|
100
91
|
};
|
|
92
|
+
|
|
93
|
+
// Set the NODE_ORACLEDB_WALLET_LOCATION and NODE_ORACLEDB_WALLET_PASSWORD
|
|
94
|
+
// environment variables for database connections that require wallets.
|
|
95
|
+
// For example, creating and dropping a user.
|
|
96
|
+
// See the README.md file in this directory for more details.
|
|
97
|
+
if (process.env.NODE_ORACLEDB_WALLET_PASSWORD) {
|
|
98
|
+
config.walletPassword = process.env.NODE_ORACLEDB_WALLET_PASSWORD;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (process.env.NODE_ORACLEDB_WALLET_LOCATION) {
|
|
102
|
+
config.walletLocation = process.env.NODE_ORACLEDB_WALLET_LOCATION;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Set the NODE_ORACLEDB_DBA_USER and NODE_ORACLEDB_DBA_PASSWORD environment
|
|
106
|
+
// variables for database operations which require SYSDBA privileges.
|
|
107
|
+
// For example, creating and dropping a user. See the README.md file in this
|
|
108
|
+
// directory for more details.
|
|
109
|
+
if (process.env.NODE_ORACLEDB_DBA_USER) {
|
|
110
|
+
config.DBA_user = process.env.NODE_ORACLEDB_DBA_USER;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (process.env.NODE_ORACLEDB_DBA_PASSWORD) {
|
|
114
|
+
config.DBA_password = process.env.NODE_ORACLEDB_DBA_PASSWORD;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
module.exports = config;
|
package/examples/example.js
CHANGED
|
@@ -54,14 +54,16 @@ if (process.env.NODE_ORACLEDB_DRIVER_MODE === 'thick') {
|
|
|
54
54
|
// is not correct, you will get a DPI-1047 error. See the node-oracledb
|
|
55
55
|
// installation documentation.
|
|
56
56
|
let clientOpts = {};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
clientOpts = { libDir: process.env.
|
|
57
|
+
// On Windows and macOS Intel platforms, set the environment
|
|
58
|
+
// variable NODE_ORACLEDB_CLIENT_LIB_DIR to the Oracle Client library path
|
|
59
|
+
if (process.platform === 'win32' || (process.platform === 'darwin' && process.arch === 'x64')) {
|
|
60
|
+
clientOpts = { libDir: process.env.NODE_ORACLEDB_CLIENT_LIB_DIR };
|
|
61
61
|
}
|
|
62
62
|
oracledb.initOracleClient(clientOpts); // enable node-oracledb Thick mode
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
console.log(oracledb.thin ? 'Running in thin mode' : 'Running in thick mode');
|
|
66
|
+
|
|
65
67
|
async function run() {
|
|
66
68
|
let connection;
|
|
67
69
|
|
package/lib/connection.js
CHANGED
|
@@ -865,6 +865,11 @@ class Connection extends EventEmitter {
|
|
|
865
865
|
throw err;
|
|
866
866
|
}
|
|
867
867
|
|
|
868
|
+
// convert ORA errors to NJS
|
|
869
|
+
if (result.warning) {
|
|
870
|
+
result.warning = errors.transformErr(result.warning);
|
|
871
|
+
}
|
|
872
|
+
|
|
868
873
|
// process queries; if a result set is not desired, fetch all of the rows
|
|
869
874
|
// from the result set and then destroy the result set
|
|
870
875
|
if (result.resultSet !== undefined) {
|
|
@@ -971,6 +976,24 @@ class Connection extends EventEmitter {
|
|
|
971
976
|
this._impl.setExternalName(value);
|
|
972
977
|
}
|
|
973
978
|
|
|
979
|
+
//---------------------------------------------------------------------------
|
|
980
|
+
// dbDomain (READONLY)
|
|
981
|
+
//
|
|
982
|
+
// Property for identifying the dbDomain of the Oracle Database.
|
|
983
|
+
//---------------------------------------------------------------------------
|
|
984
|
+
get dbDomain() {
|
|
985
|
+
return this._impl && this._impl.getDbDomain();
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
//---------------------------------------------------------------------------
|
|
989
|
+
// dbName (READONLY)
|
|
990
|
+
//
|
|
991
|
+
// Property for identifying the dbName of the Oracle Database.
|
|
992
|
+
//---------------------------------------------------------------------------
|
|
993
|
+
get dbName() {
|
|
994
|
+
return this._impl && this._impl.getDbName();
|
|
995
|
+
}
|
|
996
|
+
|
|
974
997
|
//---------------------------------------------------------------------------
|
|
975
998
|
// getDbObjectClass()
|
|
976
999
|
//
|
|
@@ -1074,12 +1097,36 @@ class Connection extends EventEmitter {
|
|
|
1074
1097
|
//
|
|
1075
1098
|
// Returns the health status of the connection. If this function returns
|
|
1076
1099
|
// false, the caller should close the connection.
|
|
1077
|
-
|
|
1100
|
+
//---------------------------------------------------------------------------
|
|
1078
1101
|
isHealthy() {
|
|
1079
1102
|
return (this._impl !== undefined && !this._closing &&
|
|
1080
1103
|
this._impl.isHealthy());
|
|
1081
1104
|
}
|
|
1082
1105
|
|
|
1106
|
+
//---------------------------------------------------------------------------
|
|
1107
|
+
// maxOpenCursors
|
|
1108
|
+
//
|
|
1109
|
+
// Returns maximum number of cursors that can be opened in one session.
|
|
1110
|
+
//---------------------------------------------------------------------------
|
|
1111
|
+
get maxOpenCursors() {
|
|
1112
|
+
return this._impl && this._impl.getMaxOpenCursors();
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
//---------------------------------------------------------------------------
|
|
1116
|
+
// warning
|
|
1117
|
+
//
|
|
1118
|
+
// Returns warningInfo.
|
|
1119
|
+
//---------------------------------------------------------------------------
|
|
1120
|
+
get warning() {
|
|
1121
|
+
let warning = this._impl.getWarning();
|
|
1122
|
+
if (warning) {
|
|
1123
|
+
// Make sure that warning code attribute is populated and ORA error
|
|
1124
|
+
// is converted to NJS, if required
|
|
1125
|
+
warning = errors.transformErr(warning);
|
|
1126
|
+
}
|
|
1127
|
+
return this._impl && warning;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1083
1130
|
//---------------------------------------------------------------------------
|
|
1084
1131
|
// module
|
|
1085
1132
|
//
|
|
@@ -1117,6 +1164,25 @@ class Connection extends EventEmitter {
|
|
|
1117
1164
|
return undefined;
|
|
1118
1165
|
}
|
|
1119
1166
|
|
|
1167
|
+
//---------------------------------------------------------------------------
|
|
1168
|
+
// serviceName
|
|
1169
|
+
//
|
|
1170
|
+
// Returns the Oracle Database service name associated with the connection.
|
|
1171
|
+
//---------------------------------------------------------------------------
|
|
1172
|
+
get serviceName() {
|
|
1173
|
+
return this._impl && this._impl.getServiceName();
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
//---------------------------------------------------------------------------
|
|
1177
|
+
// transactionInProgress
|
|
1178
|
+
//
|
|
1179
|
+
// Returns a boolean value based on the presence of an active transaction
|
|
1180
|
+
// on the connection
|
|
1181
|
+
//---------------------------------------------------------------------------
|
|
1182
|
+
get transactionInProgress() {
|
|
1183
|
+
return this._impl && this._impl.getTransactionInProgress();
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1120
1186
|
//---------------------------------------------------------------------------
|
|
1121
1187
|
// ping()
|
|
1122
1188
|
//
|
package/lib/dbObject.js
CHANGED
|
@@ -319,6 +319,15 @@ class BaseDbObject {
|
|
|
319
319
|
return this._objType.schema;
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
+
//---------------------------------------------------------------------------
|
|
323
|
+
// packageName
|
|
324
|
+
//
|
|
325
|
+
// Property for the packageName of the database object type.
|
|
326
|
+
//---------------------------------------------------------------------------
|
|
327
|
+
get packageName() {
|
|
328
|
+
return this._objType.packageName;
|
|
329
|
+
}
|
|
330
|
+
|
|
322
331
|
//---------------------------------------------------------------------------
|
|
323
332
|
// setElement()
|
|
324
333
|
//
|
package/lib/errors.js
CHANGED
|
@@ -136,6 +136,8 @@ const ERR_WRONG_VALUE_FOR_DBOBJECT_ELEM = 135;
|
|
|
136
136
|
const ERR_WRONG_CRED_FOR_EXTAUTH = 136;
|
|
137
137
|
const ERR_MISSING_BIND_VALUE = 137;
|
|
138
138
|
const ERR_SERVER_VERSION_NOT_SUPPORTED = 138;
|
|
139
|
+
const ERR_UNEXPECTED_XML_TYPE = 139;
|
|
140
|
+
const ERR_WRONG_USER_FORMAT_EXTAUTH_PROXY = 140;
|
|
139
141
|
|
|
140
142
|
// Oracle Net layer errors start from 500
|
|
141
143
|
const ERR_CONNECTION_CLOSED = 500;
|
|
@@ -160,6 +162,9 @@ const ERR_INVALID_SID = 519;
|
|
|
160
162
|
const ERR_TNS_NAMES_FILE_MISSING = 520;
|
|
161
163
|
const ERR_CONNECTION_EOF = 521;
|
|
162
164
|
|
|
165
|
+
// Oracle SUCCESS_WITH_INFO warning start from 700
|
|
166
|
+
const WRN_COMPILATION_CREATE = 700;
|
|
167
|
+
|
|
163
168
|
// define mapping for ODPI-C, OCI & ORA errors that need to be wrapped
|
|
164
169
|
// with NJS errors
|
|
165
170
|
const adjustErrorXref = new Map();
|
|
@@ -178,6 +183,7 @@ adjustErrorXref.set("ORA-00028", ERR_CONNECTION_CLOSED);
|
|
|
178
183
|
adjustErrorXref.set("ORA-00600", ERR_CONNECTION_CLOSED);
|
|
179
184
|
adjustErrorXref.set("ORA-24338", ERR_INVALID_REF_CURSOR);
|
|
180
185
|
adjustErrorXref.set("ORA-25708", ERR_TOKEN_HAS_EXPIRED);
|
|
186
|
+
adjustErrorXref.set("ORA-24344", WRN_COMPILATION_CREATE);
|
|
181
187
|
|
|
182
188
|
// define mapping for error messages
|
|
183
189
|
const messages = new Map();
|
|
@@ -393,6 +399,10 @@ messages.set(ERR_MISSING_BIND_VALUE, // NJS-137
|
|
|
393
399
|
'a bind variable replacement value for placeholder ":%s" was not provided');
|
|
394
400
|
messages.set(ERR_SERVER_VERSION_NOT_SUPPORTED, // NJS-138
|
|
395
401
|
'connections to this database server version are not supported by node-oracledb in Thin mode');
|
|
402
|
+
messages.set(ERR_UNEXPECTED_XML_TYPE, // NJS-139
|
|
403
|
+
'unexpected XML type with flag %d');
|
|
404
|
+
messages.set(ERR_WRONG_USER_FORMAT_EXTAUTH_PROXY, // NJS-140
|
|
405
|
+
'user name must be enclosed in [] when using external authentication with a proxy user');
|
|
396
406
|
|
|
397
407
|
// Oracle Net layer errors
|
|
398
408
|
|
|
@@ -439,6 +449,11 @@ messages.set(ERR_TNS_NAMES_FILE_MISSING, // NJS-520
|
|
|
439
449
|
messages.set(ERR_CONNECTION_EOF, // NJS-521
|
|
440
450
|
'connection to host %s port %d received end-of-file on communication channel. (CONNECTION_ID=%s)');
|
|
441
451
|
|
|
452
|
+
// Oracle SUCCESS_WITH_INFO warning
|
|
453
|
+
|
|
454
|
+
messages.set(WRN_COMPILATION_CREATE, // NJS-700
|
|
455
|
+
'creation succeeded with compilation errors');
|
|
456
|
+
|
|
442
457
|
//-----------------------------------------------------------------------------
|
|
443
458
|
// assert()
|
|
444
459
|
//
|
|
@@ -466,7 +481,7 @@ function assertArgCount(args, minArgCount, maxArgCount) {
|
|
|
466
481
|
//-----------------------------------------------------------------------------
|
|
467
482
|
// assertParamPropBool()
|
|
468
483
|
//
|
|
469
|
-
// Asserts that the property value of a
|
|
484
|
+
// Asserts that the property value of a parameter is a boolean value (or
|
|
470
485
|
// undefined).
|
|
471
486
|
//-----------------------------------------------------------------------------
|
|
472
487
|
function assertParamPropBool(obj, parameterNum, propName) {
|
|
@@ -479,7 +494,7 @@ function assertParamPropBool(obj, parameterNum, propName) {
|
|
|
479
494
|
//-----------------------------------------------------------------------------
|
|
480
495
|
// assertParamPropFunction()
|
|
481
496
|
//
|
|
482
|
-
// Asserts that the property value of a
|
|
497
|
+
// Asserts that the property value of a parameter is a function (or undefined).
|
|
483
498
|
//-----------------------------------------------------------------------------
|
|
484
499
|
function assertParamPropFunction(obj, parameterNum, propName) {
|
|
485
500
|
if (obj[propName] !== undefined) {
|
|
@@ -491,7 +506,7 @@ function assertParamPropFunction(obj, parameterNum, propName) {
|
|
|
491
506
|
//-----------------------------------------------------------------------------
|
|
492
507
|
// assertParamPropInt()
|
|
493
508
|
//
|
|
494
|
-
// Asserts that the property value of a
|
|
509
|
+
// Asserts that the property value of a parameter is an integer value (or
|
|
495
510
|
// undefined).
|
|
496
511
|
//-----------------------------------------------------------------------------
|
|
497
512
|
function assertParamPropInt(obj, parameterNum, propName) {
|
|
@@ -504,7 +519,7 @@ function assertParamPropInt(obj, parameterNum, propName) {
|
|
|
504
519
|
//-----------------------------------------------------------------------------
|
|
505
520
|
// assertParamPropUnsignedInt()
|
|
506
521
|
//
|
|
507
|
-
// Asserts that the property value of a
|
|
522
|
+
// Asserts that the property value of a parameter is a positive integer value
|
|
508
523
|
// (or undefined).
|
|
509
524
|
//-----------------------------------------------------------------------------
|
|
510
525
|
function assertParamPropUnsignedInt(obj, parameterNum, propName) {
|
|
@@ -517,7 +532,7 @@ function assertParamPropUnsignedInt(obj, parameterNum, propName) {
|
|
|
517
532
|
//-----------------------------------------------------------------------------
|
|
518
533
|
// assertParamPropString()
|
|
519
534
|
//
|
|
520
|
-
// Asserts that the property value of a
|
|
535
|
+
// Asserts that the property value of a parameter is a string value (or undefined).
|
|
521
536
|
//-----------------------------------------------------------------------------
|
|
522
537
|
function assertParamPropString(obj, parameterNum, propName) {
|
|
523
538
|
if (obj[propName] !== undefined) {
|
|
@@ -529,7 +544,7 @@ function assertParamPropString(obj, parameterNum, propName) {
|
|
|
529
544
|
//-----------------------------------------------------------------------------
|
|
530
545
|
// assertParamPropValue()
|
|
531
546
|
//
|
|
532
|
-
// Asserts that the property value of a
|
|
547
|
+
// Asserts that the property value of a parameter passes the specified
|
|
533
548
|
// condition.
|
|
534
549
|
//-----------------------------------------------------------------------------
|
|
535
550
|
function assertParamPropValue(condition, parameterNum, propName) {
|
|
@@ -540,7 +555,7 @@ function assertParamPropValue(condition, parameterNum, propName) {
|
|
|
540
555
|
//-----------------------------------------------------------------------------
|
|
541
556
|
// assertParamValue()
|
|
542
557
|
//
|
|
543
|
-
// Asserts that the
|
|
558
|
+
// Asserts that the parameter value passes the specified condition.
|
|
544
559
|
//-----------------------------------------------------------------------------
|
|
545
560
|
function assertParamValue(condition, parameterNum) {
|
|
546
561
|
assert(condition, ERR_INVALID_PARAMETER_VALUE, parameterNum);
|
|
@@ -772,7 +787,10 @@ module.exports = {
|
|
|
772
787
|
ERR_WRONG_CRED_FOR_EXTAUTH,
|
|
773
788
|
ERR_MISSING_BIND_VALUE,
|
|
774
789
|
ERR_SERVER_VERSION_NOT_SUPPORTED,
|
|
790
|
+
ERR_UNEXPECTED_XML_TYPE,
|
|
791
|
+
ERR_WRONG_USER_FORMAT_EXTAUTH_PROXY,
|
|
775
792
|
ERR_CONNECTION_CLOSED_CODE: `${ERR_PREFIX}-${ERR_CONNECTION_CLOSED}`,
|
|
793
|
+
WRN_COMPILATION_CREATE,
|
|
776
794
|
assert,
|
|
777
795
|
assertArgCount,
|
|
778
796
|
assertParamPropBool,
|
package/lib/future.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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 errors = require('./errors.js');
|
|
30
|
+
|
|
31
|
+
// future object used for managing backwards incompatible changes.
|
|
32
|
+
class Future {
|
|
33
|
+
|
|
34
|
+
constructor() {
|
|
35
|
+
this._featureFlags = {};
|
|
36
|
+
this._featureFlags.oldJsonColumnAsObj = false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get oldJsonColumnAsObj() {
|
|
40
|
+
return this._featureFlags.oldJsonColumnAsObj;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// fetch VARCHAR2 and LOB columns that contain JSON data (and have
|
|
44
|
+
// the "IS JSON" constraint enabled) in the same way that columns
|
|
45
|
+
// of type JSON (which requires Oracle Database 21 and higher) are fetched.
|
|
46
|
+
set oldJsonColumnAsObj(value) {
|
|
47
|
+
errors.assertPropValue(typeof value === 'boolean', "oldJsonColumnAsObj");
|
|
48
|
+
this._featureFlags.oldJsonColumnAsObj = value;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
module.exports = new Future;
|
package/lib/impl/connection.js
CHANGED
|
@@ -208,6 +208,24 @@ class ConnectionImpl {
|
|
|
208
208
|
errors.throwNotImplemented("getting current schema");
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
//---------------------------------------------------------------------------
|
|
212
|
+
// getDbDomain()
|
|
213
|
+
//
|
|
214
|
+
// Returns the Oracle Database domain name associated with the connection.
|
|
215
|
+
//---------------------------------------------------------------------------
|
|
216
|
+
getDbDomain() {
|
|
217
|
+
errors.throwNotImplemented("getting db domain");
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
//---------------------------------------------------------------------------
|
|
221
|
+
// getDbName()
|
|
222
|
+
//
|
|
223
|
+
// Returns the Oracle Database name associated with the connection.
|
|
224
|
+
//---------------------------------------------------------------------------
|
|
225
|
+
getDbName() {
|
|
226
|
+
errors.throwNotImplemented("getting db name");
|
|
227
|
+
}
|
|
228
|
+
|
|
211
229
|
//---------------------------------------------------------------------------
|
|
212
230
|
// getDbObjectClass()
|
|
213
231
|
//
|
|
@@ -244,6 +262,15 @@ class ConnectionImpl {
|
|
|
244
262
|
errors.throwNotImplemented("getting the internal name");
|
|
245
263
|
}
|
|
246
264
|
|
|
265
|
+
//---------------------------------------------------------------------------
|
|
266
|
+
// getMaxOpenCursors()
|
|
267
|
+
//
|
|
268
|
+
// Returns maximum number of cursors that can be opened in one session.
|
|
269
|
+
//---------------------------------------------------------------------------
|
|
270
|
+
getMaxOpenCursors() {
|
|
271
|
+
errors.throwNotImplemented("getting max open cursors");
|
|
272
|
+
}
|
|
273
|
+
|
|
247
274
|
//---------------------------------------------------------------------------
|
|
248
275
|
// getOracleServerVersion()
|
|
249
276
|
//
|
|
@@ -271,6 +298,15 @@ class ConnectionImpl {
|
|
|
271
298
|
errors.throwNotImplemented("getting a queue");
|
|
272
299
|
}
|
|
273
300
|
|
|
301
|
+
//---------------------------------------------------------------------------
|
|
302
|
+
// getServiceName()
|
|
303
|
+
//
|
|
304
|
+
// Returns the Oracle Database service name associated with the connection.
|
|
305
|
+
//---------------------------------------------------------------------------
|
|
306
|
+
getServiceName() {
|
|
307
|
+
errors.throwNotImplemented("getting service name");
|
|
308
|
+
}
|
|
309
|
+
|
|
274
310
|
//---------------------------------------------------------------------------
|
|
275
311
|
// getSodaDatabase()
|
|
276
312
|
//
|
|
@@ -307,6 +343,26 @@ class ConnectionImpl {
|
|
|
307
343
|
errors.throwNotImplemented("getting the tag for the connection");
|
|
308
344
|
}
|
|
309
345
|
|
|
346
|
+
//---------------------------------------------------------------------------
|
|
347
|
+
// getTransactionInProgress()
|
|
348
|
+
//
|
|
349
|
+
// Returns boolean based on the presence of an active transaction on the
|
|
350
|
+
// connection
|
|
351
|
+
//---------------------------------------------------------------------------
|
|
352
|
+
getTransactionInProgress() {
|
|
353
|
+
errors.throwNotImplemented("getting the status of an active transaction" +
|
|
354
|
+
" on the connection");
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
//---------------------------------------------------------------------------
|
|
358
|
+
// getWarning()
|
|
359
|
+
//
|
|
360
|
+
// Returns a warning on a connection
|
|
361
|
+
//---------------------------------------------------------------------------
|
|
362
|
+
getWarning() {
|
|
363
|
+
errors.throwNotImplemented("getting information about warning");
|
|
364
|
+
}
|
|
365
|
+
|
|
310
366
|
//---------------------------------------------------------------------------
|
|
311
367
|
// isHealthy()
|
|
312
368
|
//
|
package/lib/impl/pool.js
CHANGED
|
@@ -37,10 +37,10 @@ class PoolImpl {
|
|
|
37
37
|
// Access token handler callback function which wraps the user callback and
|
|
38
38
|
// returns the token to the implementation.
|
|
39
39
|
//---------------------------------------------------------------------------
|
|
40
|
-
async _accessTokenHandler(userFn, externalObj, refresh) {
|
|
40
|
+
async _accessTokenHandler(userFn, externalObj, refresh, accessTokenConfig) {
|
|
41
41
|
let accessToken;
|
|
42
42
|
try {
|
|
43
|
-
let result = userFn(refresh);
|
|
43
|
+
let result = userFn(refresh, accessTokenConfig);
|
|
44
44
|
if (result instanceof Promise) {
|
|
45
45
|
result = await result;
|
|
46
46
|
}
|
|
@@ -48,7 +48,9 @@ class PoolImpl {
|
|
|
48
48
|
if (!nodbUtil.isTokenValid(result)) {
|
|
49
49
|
errors.throwErr(errors.ERR_TOKEN_HAS_EXPIRED);
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
if (typeof result === 'object' && result.privateKey !== undefined) {
|
|
52
|
+
result.privateKey = nodbUtil.denormalizePrivateKey(result.privateKey);
|
|
53
|
+
}
|
|
52
54
|
accessToken = result;
|
|
53
55
|
} finally {
|
|
54
56
|
this.returnAccessToken(externalObj, accessToken);
|