@primate/oracledb 0.3.0 → 0.4.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 +12 -9
- package/package.json +9 -9
package/lib/private/OracleDB.js
CHANGED
|
@@ -552,17 +552,20 @@ export default class OracleDB {
|
|
|
552
552
|
: undefined;
|
|
553
553
|
const params = [];
|
|
554
554
|
const name_to_index = new Map();
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
555
|
+
let query = options.query;
|
|
556
|
+
if (is.defined(options.input)) {
|
|
557
|
+
const types = Object.fromEntries(Object.entries(options.input.properties)
|
|
558
|
+
.map(([k, v]) => [k, v.datatype]));
|
|
559
|
+
for (const [, name] of options.query.matchAll(/:(\w+)/g)) {
|
|
560
|
+
if (!name_to_index.has(name)) {
|
|
561
|
+
name_to_index.set(name, params.length + 1);
|
|
562
|
+
params.push(await bind_value(types[name], input[name]));
|
|
563
|
+
}
|
|
561
564
|
}
|
|
565
|
+
query = options.query.replace(/:(\w+)/g, (_, name) => {
|
|
566
|
+
return `:${name_to_index.get(name)}`;
|
|
567
|
+
});
|
|
562
568
|
}
|
|
563
|
-
const query = options.query.replace(/:(\w+)/g, (_, name) => {
|
|
564
|
-
return `:${name_to_index.get(name)}`;
|
|
565
|
-
});
|
|
566
569
|
const rows = await this.#sql(query, params);
|
|
567
570
|
return (is.defined(options.output)
|
|
568
571
|
? options.output.parse(rows)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primate/oracledb",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
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",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
],
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@rcompat/type": "^0.18.0",
|
|
21
|
-
"@types/oracledb": "^7.0.
|
|
21
|
+
"@types/oracledb": "^7.0.3"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"@primate/core": "^0.10.0",
|
|
24
25
|
"@rcompat/assert": "^0.14.0",
|
|
25
|
-
"@rcompat/is": "^0.12.
|
|
26
|
-
"oracledb": "^7.0.
|
|
27
|
-
"
|
|
28
|
-
"pema": "^0.9.0"
|
|
26
|
+
"@rcompat/is": "^0.12.1",
|
|
27
|
+
"oracledb": "^7.0.1",
|
|
28
|
+
"pema": "^0.10.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"primate": "^0.
|
|
31
|
+
"primate": "^0.41.0"
|
|
32
32
|
},
|
|
33
33
|
"imports": {
|
|
34
34
|
"#*": {
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build": "
|
|
46
|
+
"build": "pnpm run clean && tsc",
|
|
47
47
|
"clean": "rm -rf ./lib",
|
|
48
48
|
"lint": "eslint .",
|
|
49
|
-
"test": "
|
|
49
|
+
"test": "pnpm run db && npx proby",
|
|
50
50
|
"db": "scripts/db.sh"
|
|
51
51
|
}
|
|
52
52
|
}
|