dbgate-sqltree 5.4.4 → 5.4.5-alpha.3

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.
@@ -67,9 +67,15 @@ function dumpSqlSelect(dmp, cmd) {
67
67
  }
68
68
  exports.dumpSqlSelect = dumpSqlSelect;
69
69
  function dumpSqlUpdate(dmp, cmd) {
70
- dmp.put('^update ');
71
- (0, dumpSqlSource_1.dumpSqlSourceRef)(dmp, cmd.from);
72
- dmp.put('&n^set ');
70
+ var _a;
71
+ if (cmd.alterTableUpdateSyntax) {
72
+ dmp.put('^alter ^table %f &n^update ', (_a = cmd.from) === null || _a === void 0 ? void 0 : _a.name);
73
+ }
74
+ else {
75
+ dmp.put('^update ');
76
+ (0, dumpSqlSource_1.dumpSqlSourceRef)(dmp, cmd.from);
77
+ dmp.put('&n^set ');
78
+ }
73
79
  dmp.put('&>');
74
80
  dmp.putCollection(', ', cmd.fields, col => {
75
81
  dmp.put('%i=', col.targetColumn);
@@ -84,8 +90,15 @@ function dumpSqlUpdate(dmp, cmd) {
84
90
  }
85
91
  exports.dumpSqlUpdate = dumpSqlUpdate;
86
92
  function dumpSqlDelete(dmp, cmd) {
87
- dmp.put('^delete ^from ');
88
- (0, dumpSqlSource_1.dumpSqlSourceRef)(dmp, cmd.from);
93
+ if (cmd.alterTableDeleteSyntax) {
94
+ dmp.put('^alter ^table ');
95
+ (0, dumpSqlSource_1.dumpSqlSourceRef)(dmp, cmd.from);
96
+ dmp.put(' ^delete ');
97
+ }
98
+ else {
99
+ dmp.put('^delete ^from ');
100
+ (0, dumpSqlSource_1.dumpSqlSourceRef)(dmp, cmd.from);
101
+ }
89
102
  if (cmd.where) {
90
103
  dmp.put('&n^where ');
91
104
  (0, dumpSqlCondition_1.dumpSqlCondition)(dmp, cmd.where);
package/lib/types.d.ts CHANGED
@@ -20,11 +20,13 @@ export interface Update {
20
20
  fields: UpdateField[];
21
21
  from: FromDefinition;
22
22
  where?: Condition;
23
+ alterTableUpdateSyntax?: boolean;
23
24
  }
24
25
  export interface Delete {
25
26
  commandType: 'delete';
26
27
  from: FromDefinition;
27
28
  where?: Condition;
29
+ alterTableDeleteSyntax?: boolean;
28
30
  }
29
31
  export interface Insert {
30
32
  commandType: 'insert';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.4.4",
2
+ "version": "5.4.5-alpha.3",
3
3
  "name": "dbgate-sqltree",
4
4
  "main": "lib/index.js",
5
5
  "typings": "lib/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "devDependencies": {
29
29
  "@types/node": "^13.7.0",
30
- "dbgate-types": "^5.4.4",
30
+ "dbgate-types": "^5.4.5-alpha.3",
31
31
  "typescript": "^4.4.3"
32
32
  },
33
33
  "dependencies": {