@sqb/oracle-dialect 4.25.0 → 4.26.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.
@@ -33,18 +33,19 @@ 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
+ if (o.query._tables) {
37
+ let optimizerHint = '';
38
+ for (const t of o.query._tables) {
39
+ if (t._type === SerializationType.TABLE_NAME) {
40
+ if (!t.optimizerHint?.length)
41
+ continue;
42
+ const s = t.optimizerHint?.map(x => x.hint).join('\n');
43
+ optimizerHint +=
44
+ '/*+ ' + s.replace(/:table/gi, t.alias || t.table) + ' */';
45
+ }
46
+ }
47
+ o.optimizerHint = optimizerHint;
48
+ }
48
49
  let out = defFn(ctx, o);
49
50
  const limit = o.limit || 0;
50
51
  const offset = Math.max(o.offset || 0, 0);
@@ -81,8 +82,8 @@ export class OracleSerializer {
81
82
  }
82
83
  return out;
83
84
  }
84
- _serializeFrom(ctx, o, defFn) {
85
- return defFn(ctx, o) || 'from dual';
85
+ _serializeFrom(ctx, arr, defFn) {
86
+ return defFn(ctx, arr) || 'from dual';
86
87
  }
87
88
  _serializeComparison(ctx, o, defFn) {
88
89
  if (o.right &&
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.25.0",
4
+ "version": "4.26.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.25.0"
12
+ "@sqb/builder": "^4.26.0"
13
13
  },
14
14
  "type": "module",
15
15
  "module": "./index.js",