@primate/oracledb 0.2.0 → 0.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/lib/private/OracleDB.js +8 -6
- package/lib/public/index.d.ts +1 -1
- package/package.json +11 -11
package/lib/private/OracleDB.js
CHANGED
|
@@ -10,7 +10,7 @@ const VALID_IDENTIFIER = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
|
10
10
|
function quote(name) {
|
|
11
11
|
if (!VALID_IDENTIFIER.test(name))
|
|
12
12
|
throw E.identifier_invalid(name);
|
|
13
|
-
return `"${name}"`;
|
|
13
|
+
return `"${name.toUpperCase()}"`;
|
|
14
14
|
}
|
|
15
15
|
function get_column(key) {
|
|
16
16
|
return typemap[key].column;
|
|
@@ -397,7 +397,7 @@ export default class OracleDB {
|
|
|
397
397
|
SELECT COUNT(*) AS n
|
|
398
398
|
FROM USER_TABLES
|
|
399
399
|
WHERE TABLE_NAME = :1
|
|
400
|
-
`, [table]);
|
|
400
|
+
`, [table.toUpperCase()]);
|
|
401
401
|
if (Number(exists[0]?.n ?? 0) === 0)
|
|
402
402
|
return null;
|
|
403
403
|
const rows = await this.#sql(`
|
|
@@ -411,12 +411,12 @@ export default class OracleDB {
|
|
|
411
411
|
FROM USER_TAB_COLUMNS
|
|
412
412
|
WHERE TABLE_NAME = :1
|
|
413
413
|
ORDER BY COLUMN_ID
|
|
414
|
-
`, [table]);
|
|
414
|
+
`, [table.toUpperCase()]);
|
|
415
415
|
const result = {};
|
|
416
416
|
for (const row of rows) {
|
|
417
417
|
const candidates = columns_to_types(row);
|
|
418
418
|
if (candidates.length > 0) {
|
|
419
|
-
result[row.column_name] = candidates;
|
|
419
|
+
result[row.column_name.toLowerCase()] = candidates;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
return result;
|
|
@@ -552,13 +552,15 @@ export default class OracleDB {
|
|
|
552
552
|
: undefined;
|
|
553
553
|
const params = [];
|
|
554
554
|
const name_to_index = new Map();
|
|
555
|
-
const
|
|
555
|
+
for (const [, name] of options.query.matchAll(/:(\w+)/g)) {
|
|
556
556
|
if (!name_to_index.has(name)) {
|
|
557
557
|
name_to_index.set(name, params.length + 1);
|
|
558
558
|
const types = Object.fromEntries(Object.entries(options.input.properties)
|
|
559
559
|
.map(([k, v]) => [k, v.datatype]));
|
|
560
|
-
params.push(bind_value(types[name], input[name]));
|
|
560
|
+
params.push(await bind_value(types[name], input[name]));
|
|
561
561
|
}
|
|
562
|
+
}
|
|
563
|
+
const query = options.query.replace(/:(\w+)/g, (_, name) => {
|
|
562
564
|
return `:${name_to_index.get(name)}`;
|
|
563
565
|
});
|
|
564
566
|
const rows = await this.#sql(query, params);
|
package/lib/public/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primate/oracledb",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Oracle database for Primate",
|
|
5
5
|
"homepage": "https://primate.run/docs/database/oracledb",
|
|
6
6
|
"bugs": "https://github.com/primate-run/primate/issues",
|
|
7
7
|
"type": "module",
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
"!/**/*.spec.*"
|
|
18
18
|
],
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@rcompat/type": "^0.
|
|
21
|
-
"@types/oracledb": "^
|
|
20
|
+
"@rcompat/type": "^0.18.0",
|
|
21
|
+
"@types/oracledb": "^7.0.1"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@rcompat/assert": "^0.
|
|
25
|
-
"@rcompat/is": "^0.
|
|
26
|
-
"oracledb": "^
|
|
27
|
-
"@primate/core": "^0.
|
|
28
|
-
"pema": "0.
|
|
24
|
+
"@rcompat/assert": "^0.14.0",
|
|
25
|
+
"@rcompat/is": "^0.12.0",
|
|
26
|
+
"oracledb": "^7.0.0",
|
|
27
|
+
"@primate/core": "^0.9.0",
|
|
28
|
+
"pema": "^0.9.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"primate": "^0.
|
|
31
|
+
"primate": "^0.40.0"
|
|
32
32
|
},
|
|
33
33
|
"imports": {
|
|
34
34
|
"#*": {
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build": "npm run clean &&
|
|
46
|
+
"build": "npm run clean && tsc",
|
|
47
47
|
"clean": "rm -rf ./lib",
|
|
48
48
|
"lint": "eslint .",
|
|
49
49
|
"test": "npm run db && npx proby",
|