@mikro-orm/oracledb 7.1.9-dev.0 → 7.1.9-dev.1
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/OracleConnection.js +20 -1
- package/package.json +3 -3
package/OracleConnection.js
CHANGED
|
@@ -31,10 +31,29 @@ export class OracleConnection extends AbstractSqlConnection {
|
|
|
31
31
|
const password = options.password;
|
|
32
32
|
const onCreateConnection = this.options.onCreateConnection ?? this.config.get('onCreateConnection');
|
|
33
33
|
const initialPassword = typeof password === 'function' ? await password() : password;
|
|
34
|
+
const dbName = this.config.get('dbName');
|
|
35
|
+
// unqualified names resolve against the login user's schema, but we manage `dbName`
|
|
36
|
+
const setSchemaSql = this.config.get('user', dbName) === dbName ? undefined : this.platform.getSchemaHelper().getSetSchemaSQL(dbName);
|
|
34
37
|
const poolOptions = {
|
|
35
38
|
...options,
|
|
36
39
|
password: initialPassword,
|
|
37
|
-
sessionCallback: onCreateConnection
|
|
40
|
+
sessionCallback: setSchemaSql || onCreateConnection
|
|
41
|
+
? (conn, _requestedTag, cb) => {
|
|
42
|
+
const initSession = async () => {
|
|
43
|
+
if (setSchemaSql) {
|
|
44
|
+
// ORA-01435: the schema might not exist yet, `ensureDatabase()` creates it later on
|
|
45
|
+
await conn.execute(setSchemaSql).catch((e) => {
|
|
46
|
+
/* v8 ignore next 3: other failures of `alter session` are not reproducible in tests */
|
|
47
|
+
if (e.errorNum !== 1435) {
|
|
48
|
+
throw e;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
await onCreateConnection?.(conn);
|
|
53
|
+
};
|
|
54
|
+
initSession().then(() => cb(), cb);
|
|
55
|
+
}
|
|
56
|
+
: undefined,
|
|
38
57
|
};
|
|
39
58
|
// Retry pool creation for transient Oracle errors (e.g. ORA-01017 under load)
|
|
40
59
|
let pool;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/oracledb",
|
|
3
|
-
"version": "7.1.9-dev.
|
|
3
|
+
"version": "7.1.9-dev.1",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL, SQLite, MSSQL and Oracle databases.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"data-mapper",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"copy": "node ../../scripts/copy.mjs"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@mikro-orm/sql": "7.1.9-dev.
|
|
45
|
+
"@mikro-orm/sql": "7.1.9-dev.1",
|
|
46
46
|
"kysely": "0.29.4",
|
|
47
47
|
"oracledb": "7.0.1"
|
|
48
48
|
},
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@mikro-orm/core": "^7.1.8"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@mikro-orm/core": "7.1.9-dev.
|
|
53
|
+
"@mikro-orm/core": "7.1.9-dev.1"
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">= 22.17.0"
|