@sqb/oracle-dialect 4.19.5 → 4.20.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/README.md CHANGED
@@ -18,12 +18,12 @@ SQB is an extensible, multi-dialect SQL query builder and Database connection wr
18
18
 
19
19
  ## Main goals
20
20
 
21
- - Single code base for any sql based database
22
- - Powerful and simplified query coding scheme
23
- - Fast applications with low memory requirements
24
- - Let applications work with large data tables efficiently
25
- - Support latest JavaScript language standards
26
- - Lightweight and extensible framework.
21
+ - Single code base for any sql based database
22
+ - Powerful and simplified query coding scheme
23
+ - Fast applications with low memory requirements
24
+ - Let applications work with large data tables efficiently
25
+ - Support latest JavaScript language standards
26
+ - Lightweight and extensible framework.
27
27
 
28
28
  You can report bugs and discuss features on the [GitHub issues](https://github.com/sqbjs/sqb/issues) page
29
29
 
@@ -39,7 +39,7 @@ $ npm install @sqb/oracle-dialect --save
39
39
 
40
40
  ## Node Compatibility
41
41
 
42
- - node >= 16.x
42
+ - node >= 16.x
43
43
 
44
44
  ### License
45
45
 
@@ -8,7 +8,7 @@ class OracleSerializer {
8
8
  this.dialect = 'oracle';
9
9
  }
10
10
  isReservedWord(ctx, s) {
11
- return s && typeof s === 'string' && reservedWords.includes(s.toLowerCase());
11
+ return (s && typeof s === 'string' && reservedWords.includes(s.toLowerCase()));
12
12
  }
13
13
  serialize(ctx, type, o, defFn) {
14
14
  switch (type) {
@@ -41,7 +41,11 @@ class OracleSerializer {
41
41
  if (limit || offset) {
42
42
  if (ctx.dialectVersion && ctx.dialectVersion >= '12') {
43
43
  if (offset)
44
- out += '\nOFFSET ' + offset + ' ROWS' + (limit ? ' FETCH NEXT ' + limit + ' ROWS ONLY' : '');
44
+ out +=
45
+ '\nOFFSET ' +
46
+ offset +
47
+ ' ROWS' +
48
+ (limit ? ' FETCH NEXT ' + limit + ' ROWS ONLY' : '');
45
49
  else
46
50
  out += '\nFETCH FIRST ' + limit + ' ROWS ONLY';
47
51
  }
@@ -71,7 +75,9 @@ class OracleSerializer {
71
75
  return defFn(ctx, o) || 'from dual';
72
76
  }
73
77
  _serializeComparison(ctx, o, defFn) {
74
- if (o.right && o.right.expression?.startsWith(':') && Array.isArray(o.right?.value)) {
78
+ if (o.right &&
79
+ o.right.expression?.startsWith(':') &&
80
+ Array.isArray(o.right?.value)) {
75
81
  const s = o.right.expression.substring(1);
76
82
  if (ctx.params)
77
83
  delete ctx.params[s];
@@ -82,12 +88,22 @@ class OracleSerializer {
82
88
  o.right.expression = ctx.anyToSQL(o.right.value);
83
89
  o.right.isParam = false;
84
90
  if (o.operatorType === 'eq')
85
- return defFn(ctx, { ...o, operatorType: builder_1.OperatorType.is, symbol: 'in' });
91
+ return defFn(ctx, {
92
+ ...o,
93
+ operatorType: builder_1.OperatorType.is,
94
+ symbol: 'in',
95
+ });
86
96
  if (o.operatorType === 'ne')
87
- return defFn(ctx, { ...o, operatorType: builder_1.OperatorType.isNot, symbol: 'not in' });
97
+ return defFn(ctx, {
98
+ ...o,
99
+ operatorType: builder_1.OperatorType.isNot,
100
+ symbol: 'not in',
101
+ });
88
102
  }
89
103
  else if ((o.right?.expression && o.right?.expression === 'null') ||
90
- (o.right && o.right?.value == null && (!o.right.expression || o.right.expression.startsWith(':')))) {
104
+ (o.right &&
105
+ o.right?.value == null &&
106
+ (!o.right.expression || o.right.expression.startsWith(':')))) {
91
107
  if (o.right.expression?.startsWith(':')) {
92
108
  const s = o.right.expression.substring(1);
93
109
  if (ctx.params)
@@ -100,9 +116,17 @@ class OracleSerializer {
100
116
  o.right.isParam = false;
101
117
  }
102
118
  if (o.operatorType === 'eq')
103
- return defFn(ctx, { ...o, operatorType: builder_1.OperatorType.is, symbol: 'is' });
119
+ return defFn(ctx, {
120
+ ...o,
121
+ operatorType: builder_1.OperatorType.is,
122
+ symbol: 'is',
123
+ });
104
124
  if (o.operatorType === 'ne')
105
- return defFn(ctx, { ...o, operatorType: builder_1.OperatorType.isNot, symbol: 'is not' });
125
+ return defFn(ctx, {
126
+ ...o,
127
+ operatorType: builder_1.OperatorType.isNot,
128
+ symbol: 'is not',
129
+ });
106
130
  }
107
131
  return defFn(ctx, o);
108
132
  }
@@ -117,7 +141,10 @@ class OracleSerializer {
117
141
  }
118
142
  _serializeDateValue(ctx, o, defFn) {
119
143
  const s = defFn(ctx, o);
120
- return s && (s.length <= 12 ? 'to_date(' + s + ", 'yyyy-mm-dd')" : 'to_date(' + s + ", 'yyyy-mm-dd hh24:mi:ss')");
144
+ return (s &&
145
+ (s.length <= 12
146
+ ? 'to_date(' + s + ", 'yyyy-mm-dd')"
147
+ : 'to_date(' + s + ", 'yyyy-mm-dd hh24:mi:ss')"));
121
148
  }
122
149
  _serializeBooleanValue(_ctx, o) {
123
150
  return o == null ? 'null' : o ? '1' : '0';
@@ -139,7 +166,10 @@ class OracleSerializer {
139
166
  _serializeSequenceGetter(ctx, o,
140
167
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
141
168
  defFn) {
142
- return o.genName + '.' + (o.next ? 'nextval' : 'currval') + (o.alias ? ' ' + o.alias : '');
169
+ return (o.genName +
170
+ '.' +
171
+ (o.next ? 'nextval' : 'currval') +
172
+ (o.alias ? ' ' + o.alias : ''));
143
173
  }
144
174
  _serializeReturning() {
145
175
  return '';
@@ -5,7 +5,7 @@ export class OracleSerializer {
5
5
  this.dialect = 'oracle';
6
6
  }
7
7
  isReservedWord(ctx, s) {
8
- return s && typeof s === 'string' && reservedWords.includes(s.toLowerCase());
8
+ return (s && typeof s === 'string' && reservedWords.includes(s.toLowerCase()));
9
9
  }
10
10
  serialize(ctx, type, o, defFn) {
11
11
  switch (type) {
@@ -38,7 +38,11 @@ export class OracleSerializer {
38
38
  if (limit || offset) {
39
39
  if (ctx.dialectVersion && ctx.dialectVersion >= '12') {
40
40
  if (offset)
41
- out += '\nOFFSET ' + offset + ' ROWS' + (limit ? ' FETCH NEXT ' + limit + ' ROWS ONLY' : '');
41
+ out +=
42
+ '\nOFFSET ' +
43
+ offset +
44
+ ' ROWS' +
45
+ (limit ? ' FETCH NEXT ' + limit + ' ROWS ONLY' : '');
42
46
  else
43
47
  out += '\nFETCH FIRST ' + limit + ' ROWS ONLY';
44
48
  }
@@ -68,7 +72,9 @@ export class OracleSerializer {
68
72
  return defFn(ctx, o) || 'from dual';
69
73
  }
70
74
  _serializeComparison(ctx, o, defFn) {
71
- if (o.right && o.right.expression?.startsWith(':') && Array.isArray(o.right?.value)) {
75
+ if (o.right &&
76
+ o.right.expression?.startsWith(':') &&
77
+ Array.isArray(o.right?.value)) {
72
78
  const s = o.right.expression.substring(1);
73
79
  if (ctx.params)
74
80
  delete ctx.params[s];
@@ -79,12 +85,22 @@ export class OracleSerializer {
79
85
  o.right.expression = ctx.anyToSQL(o.right.value);
80
86
  o.right.isParam = false;
81
87
  if (o.operatorType === 'eq')
82
- return defFn(ctx, { ...o, operatorType: OperatorType.is, symbol: 'in' });
88
+ return defFn(ctx, {
89
+ ...o,
90
+ operatorType: OperatorType.is,
91
+ symbol: 'in',
92
+ });
83
93
  if (o.operatorType === 'ne')
84
- return defFn(ctx, { ...o, operatorType: OperatorType.isNot, symbol: 'not in' });
94
+ return defFn(ctx, {
95
+ ...o,
96
+ operatorType: OperatorType.isNot,
97
+ symbol: 'not in',
98
+ });
85
99
  }
86
100
  else if ((o.right?.expression && o.right?.expression === 'null') ||
87
- (o.right && o.right?.value == null && (!o.right.expression || o.right.expression.startsWith(':')))) {
101
+ (o.right &&
102
+ o.right?.value == null &&
103
+ (!o.right.expression || o.right.expression.startsWith(':')))) {
88
104
  if (o.right.expression?.startsWith(':')) {
89
105
  const s = o.right.expression.substring(1);
90
106
  if (ctx.params)
@@ -97,9 +113,17 @@ export class OracleSerializer {
97
113
  o.right.isParam = false;
98
114
  }
99
115
  if (o.operatorType === 'eq')
100
- return defFn(ctx, { ...o, operatorType: OperatorType.is, symbol: 'is' });
116
+ return defFn(ctx, {
117
+ ...o,
118
+ operatorType: OperatorType.is,
119
+ symbol: 'is',
120
+ });
101
121
  if (o.operatorType === 'ne')
102
- return defFn(ctx, { ...o, operatorType: OperatorType.isNot, symbol: 'is not' });
122
+ return defFn(ctx, {
123
+ ...o,
124
+ operatorType: OperatorType.isNot,
125
+ symbol: 'is not',
126
+ });
103
127
  }
104
128
  return defFn(ctx, o);
105
129
  }
@@ -114,7 +138,10 @@ export class OracleSerializer {
114
138
  }
115
139
  _serializeDateValue(ctx, o, defFn) {
116
140
  const s = defFn(ctx, o);
117
- return s && (s.length <= 12 ? 'to_date(' + s + ", 'yyyy-mm-dd')" : 'to_date(' + s + ", 'yyyy-mm-dd hh24:mi:ss')");
141
+ return (s &&
142
+ (s.length <= 12
143
+ ? 'to_date(' + s + ", 'yyyy-mm-dd')"
144
+ : 'to_date(' + s + ", 'yyyy-mm-dd hh24:mi:ss')"));
118
145
  }
119
146
  _serializeBooleanValue(_ctx, o) {
120
147
  return o == null ? 'null' : o ? '1' : '0';
@@ -136,7 +163,10 @@ export class OracleSerializer {
136
163
  _serializeSequenceGetter(ctx, o,
137
164
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
138
165
  defFn) {
139
- return o.genName + '.' + (o.next ? 'nextval' : 'currval') + (o.alias ? ' ' + o.alias : '');
166
+ return (o.genName +
167
+ '.' +
168
+ (o.next ? 'nextval' : 'currval') +
169
+ (o.alias ? ' ' + o.alias : ''));
140
170
  }
141
171
  _serializeReturning() {
142
172
  return '';
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@sqb/oracle-dialect",
3
3
  "description": "SQB serialization extension for Oracle database",
4
- "version": "4.19.5",
4
+ "version": "4.20.0",
5
5
  "author": "Panates",
6
6
  "license": "Apache-2.0",
7
7
  "dependencies": {
8
8
  "tslib": "^2.8.1"
9
9
  },
10
10
  "peerDependencies": {
11
- "@sqb/builder": "^4.19.5"
11
+ "@sqb/builder": "^4.20.0"
12
12
  },
13
13
  "type": "module",
14
14
  "exports": {
@@ -34,12 +34,11 @@
34
34
  ],
35
35
  "repository": {
36
36
  "type": "git",
37
- "url": "https://github.com/sqbjs/sqb.git",
37
+ "url": "https://github.com/panates/sqb.git",
38
38
  "directory": "packages/oracle-dialect"
39
39
  },
40
40
  "engines": {
41
- "node": ">=16.0",
42
- "npm": ">=7.0.0"
41
+ "node": ">=18.0"
43
42
  },
44
43
  "files": [
45
44
  "bin/",
@@ -58,5 +57,8 @@
58
57
  "dialect",
59
58
  "serializer",
60
59
  "database"
61
- ]
60
+ ],
61
+ "publishConfig": {
62
+ "access": "public"
63
+ }
62
64
  }