@sqb/oracle-dialect 5.0.4 → 5.0.5
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 +24 -26
- package/package.json +3 -3
package/oracle-serializer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OperatorType, SerializationType, SerializeContext, } from '@sqb/builder';
|
|
1
|
+
import { isParam, OperatorType, SerializationType, SerializeContext, } from '@sqb/builder';
|
|
2
2
|
import { toDateString } from 'valgen';
|
|
3
3
|
const reservedWords = ['comment', 'dual'];
|
|
4
4
|
export class OracleSerializer {
|
|
@@ -86,32 +86,26 @@ export class OracleSerializer {
|
|
|
86
86
|
return defFn(ctx, arr) || 'from dual';
|
|
87
87
|
}
|
|
88
88
|
_serializeComparison(ctx, o, defFn) {
|
|
89
|
-
if (o.
|
|
90
|
-
o.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (o.operatorType === 'ne')
|
|
108
|
-
return defFn(ctx, {
|
|
109
|
-
...o,
|
|
110
|
-
operatorType: OperatorType.isNot,
|
|
111
|
-
symbol: 'not in',
|
|
112
|
-
});
|
|
89
|
+
if (isParam(o.orgRight)) {
|
|
90
|
+
const n = o.orgRight._name;
|
|
91
|
+
const v = ctx.orgParams?.[n];
|
|
92
|
+
if (Array.isArray(v)) {
|
|
93
|
+
o.right.isParam = false;
|
|
94
|
+
if (o.operatorType === 'eq')
|
|
95
|
+
return defFn(ctx, {
|
|
96
|
+
...o,
|
|
97
|
+
operatorType: OperatorType.in,
|
|
98
|
+
symbol: 'in',
|
|
99
|
+
});
|
|
100
|
+
if (o.operatorType === 'ne')
|
|
101
|
+
return defFn(ctx, {
|
|
102
|
+
...o,
|
|
103
|
+
operatorType: OperatorType.notIn,
|
|
104
|
+
symbol: 'not in',
|
|
105
|
+
});
|
|
106
|
+
}
|
|
113
107
|
}
|
|
114
|
-
|
|
108
|
+
if ((o.right?.expression && o.right?.expression === 'null') ||
|
|
115
109
|
(o.right &&
|
|
116
110
|
o.right?.value == null &&
|
|
117
111
|
(!o.right.expression || o.right.expression.startsWith(':')))) {
|
|
@@ -194,6 +188,10 @@ export class OracleSerializer {
|
|
|
194
188
|
ctx.preparedParams[o.name] = toDateString(v).replace('T', ' ');
|
|
195
189
|
return `TO_DATE(:${o.name}, 'yyyy-mm-dd hh24:mi:ss.SSSSS')`;
|
|
196
190
|
}
|
|
191
|
+
if (Array.isArray(v)) {
|
|
192
|
+
delete ctx.params?.[o.name];
|
|
193
|
+
return ctx.anyToSQL(v);
|
|
194
|
+
}
|
|
197
195
|
}
|
|
198
196
|
return defFn(ctx, o);
|
|
199
197
|
}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqb/oracle-dialect",
|
|
3
3
|
"description": "SQB serialization extension for Oracle database",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.5",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"valgen": "^6.2.
|
|
8
|
+
"valgen": "^6.2.2",
|
|
9
9
|
"tslib": "^2.8.1"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
12
|
-
"@sqb/builder": "^5.0.
|
|
12
|
+
"@sqb/builder": "^5.0.5"
|
|
13
13
|
},
|
|
14
14
|
"type": "module",
|
|
15
15
|
"module": "./index.js",
|