@sqb/oracle-dialect 4.23.3 → 4.25.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/oracle-serializer.js +20 -5
- package/package.json +2 -2
package/oracle-serializer.js
CHANGED
|
@@ -33,6 +33,18 @@ export class OracleSerializer {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
_serializeSelect(ctx, o, defFn) {
|
|
36
|
+
const indexHint = o.indexHint
|
|
37
|
+
?.map(x => x.index?.length ? `/*+ INDEX(t ${x.index.join(',')})*/` : undefined)
|
|
38
|
+
.filter(x => x)
|
|
39
|
+
.join('\n');
|
|
40
|
+
if (indexHint)
|
|
41
|
+
o.columns = indexHint + '\n\t' + o.columns;
|
|
42
|
+
const noIndexHint = o.noIndexHint
|
|
43
|
+
?.map(x => x.index?.length ? `/*+ NO_INDEX(t ${x.index.join(',')})*/` : undefined)
|
|
44
|
+
.filter(x => x)
|
|
45
|
+
.join('\n');
|
|
46
|
+
if (noIndexHint)
|
|
47
|
+
o.columns = noIndexHint + '\n\t' + o.columns;
|
|
36
48
|
let out = defFn(ctx, o);
|
|
37
49
|
const limit = o.limit || 0;
|
|
38
50
|
const offset = Math.max(o.offset || 0, 0);
|
|
@@ -173,11 +185,14 @@ export class OracleSerializer {
|
|
|
173
185
|
return '';
|
|
174
186
|
}
|
|
175
187
|
_serializeParameter(ctx, o, defFn) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
188
|
+
if (ctx.rootQuery._type === SerializationType.SELECT_QUERY ||
|
|
189
|
+
ctx.rootQuery._type === SerializationType.DELETE_QUERY) {
|
|
190
|
+
const v = ctx.params?.[o.name];
|
|
191
|
+
if (v instanceof Date) {
|
|
192
|
+
ctx.preparedParams = ctx.preparedParams || {};
|
|
193
|
+
ctx.preparedParams[o.name] = toDateString(v).replace('T', ' ');
|
|
194
|
+
return `TO_DATE(:${o.name}, 'yyyy-mm-dd hh24:mi:ss.SSSSS')`;
|
|
195
|
+
}
|
|
181
196
|
}
|
|
182
197
|
return defFn(ctx, o);
|
|
183
198
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqb/oracle-dialect",
|
|
3
3
|
"description": "SQB serialization extension for Oracle database",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.25.0",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"dependencies": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"tslib": "^2.8.1"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@sqb/builder": "^4.
|
|
12
|
+
"@sqb/builder": "^4.25.0"
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
15
|
"module": "./index.js",
|