@sqb/oracle-dialect 4.0.1-beta.4 → 4.0.1-beta.48
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/dist/OracleSerializer.d.ts +2 -0
- package/dist/OracleSerializer.js +23 -5
- package/dist/index.js +1 -1
- package/package.json +4 -4
|
@@ -6,6 +6,8 @@ export declare class OracleSerializer implements SerializerExtension {
|
|
|
6
6
|
private _serializeSelect;
|
|
7
7
|
private _serializeFrom;
|
|
8
8
|
private _serializeComparison;
|
|
9
|
+
private _serializeStringValue;
|
|
9
10
|
private _serializeDateValue;
|
|
11
|
+
private _serializeBooleanValue;
|
|
10
12
|
private _serializeReturning;
|
|
11
13
|
}
|
package/dist/OracleSerializer.js
CHANGED
|
@@ -39,8 +39,12 @@ class OracleSerializer {
|
|
|
39
39
|
return this._serializeFrom(ctx, o, defFn);
|
|
40
40
|
case builder_1.SerializationType.COMPARISON_EXPRESSION:
|
|
41
41
|
return this._serializeComparison(ctx, o, defFn);
|
|
42
|
+
case builder_1.SerializationType.STRING_VALUE:
|
|
43
|
+
return this._serializeStringValue(ctx, o, defFn);
|
|
42
44
|
case builder_1.SerializationType.DATE_VALUE:
|
|
43
45
|
return this._serializeDateValue(ctx, o, defFn);
|
|
46
|
+
case builder_1.SerializationType.BOOLEAN_VALUE:
|
|
47
|
+
return this._serializeBooleanValue(ctx, o);
|
|
44
48
|
case builder_1.SerializationType.RETURNING_BLOCK:
|
|
45
49
|
return this._serializeReturning();
|
|
46
50
|
}
|
|
@@ -81,11 +85,22 @@ class OracleSerializer {
|
|
|
81
85
|
return defFn(ctx, o) || 'from dual';
|
|
82
86
|
}
|
|
83
87
|
_serializeComparison(ctx, o, defFn) {
|
|
84
|
-
if (o.right
|
|
85
|
-
if (o.
|
|
86
|
-
o.
|
|
87
|
-
|
|
88
|
-
o.
|
|
88
|
+
if (o.right) {
|
|
89
|
+
if (o.right.expression.toLowerCase() === 'null') {
|
|
90
|
+
if (o.operatorType === 'eq')
|
|
91
|
+
return defFn(ctx, { ...o, operatorType: builder_1.OperatorType.is, symbol: 'is' });
|
|
92
|
+
if (o.operatorType === 'ne')
|
|
93
|
+
return defFn(ctx, { ...o, operatorType: builder_1.OperatorType.isNot, symbol: 'is not' });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return defFn(ctx, o);
|
|
97
|
+
}
|
|
98
|
+
_serializeStringValue(ctx, o, defFn) {
|
|
99
|
+
if (typeof o === 'string') {
|
|
100
|
+
if (o.match(/^\d{4}-\d{2}-\d{2}$/))
|
|
101
|
+
return 'to_date(' + o + ', \'yyyy-mm-dd\')';
|
|
102
|
+
if (o.match(/^\d{4}-\d{2}-\d{2}T/))
|
|
103
|
+
return `to_timestamp_tz('${o}','yyyy-mm-dd"T"hh24:mi:sstzh:tzm')`;
|
|
89
104
|
}
|
|
90
105
|
return defFn(ctx, o);
|
|
91
106
|
}
|
|
@@ -95,6 +110,9 @@ class OracleSerializer {
|
|
|
95
110
|
'to_date(' + s + ', \'yyyy-mm-dd\')' :
|
|
96
111
|
'to_date(' + s + ', \'yyyy-mm-dd hh24:mi:ss\')');
|
|
97
112
|
}
|
|
113
|
+
_serializeBooleanValue(_ctx, o) {
|
|
114
|
+
return o == null ? 'null' : (o ? '1' : '0');
|
|
115
|
+
}
|
|
98
116
|
_serializeReturning() {
|
|
99
117
|
return '';
|
|
100
118
|
}
|
package/dist/index.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const builder_1 = require("@sqb/builder");
|
|
4
4
|
const OracleSerializer_1 = require("./OracleSerializer");
|
|
5
|
-
builder_1.registerSerializer(new OracleSerializer_1.OracleSerializer());
|
|
5
|
+
(0, builder_1.registerSerializer)(new OracleSerializer_1.OracleSerializer());
|
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.0.1-beta.
|
|
4
|
+
"version": "4.0.1-beta.48",
|
|
5
5
|
"author": "Panates Ltd.",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Eray Hanoglu <e.hanoglu@panates.com>"
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"compare-versions": "^3.6.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"fast-glob": "^3.2.
|
|
28
|
+
"fast-glob": "^3.2.6"
|
|
29
29
|
},
|
|
30
30
|
"main": "dist/index.js",
|
|
31
31
|
"types": "dist/index.d.ts",
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
33
|
+
"node": ">= 14.0"
|
|
34
34
|
},
|
|
35
35
|
"directories": {
|
|
36
36
|
"lib": "dist",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"temp-dir": "./coverage/.nyc_output"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
|
-
"test": "ts-
|
|
48
|
+
"test": "TS_NODE_PROJECT='./test/tsconfig.json' mocha -r ts-node/register -r tsconfig-paths/register --reporter spec test/**/*.spec.ts",
|
|
49
49
|
"cover": "nyc --reporter=cobertura --reporter html --reporter text npm run test",
|
|
50
50
|
"build": "tsc -b tsconfig-build.json",
|
|
51
51
|
"compile": "tsc -b tsconfig.json",
|