dbgate-sqltree 6.7.1 → 6.7.2
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/lib/dumpSqlCommand.js +5 -1
- package/lib/dumpSqlExpression.js +6 -0
- package/lib/types.d.ts +6 -1
- package/package.json +2 -2
package/lib/dumpSqlCommand.js
CHANGED
|
@@ -119,7 +119,11 @@ function dumpSqlInsert(dmp, cmd) {
|
|
|
119
119
|
if (cmd.insertWhereNotExistsCondition) {
|
|
120
120
|
dmp.put('^insert ^into %f (%,i) ^select ', cmd.targetTable, cmd.fields.map(x => x.targetColumn));
|
|
121
121
|
dmp.putCollection(',', cmd.fields, x => (0, dumpSqlExpression_1.dumpSqlExpression)(dmp, x));
|
|
122
|
-
if (
|
|
122
|
+
if (cmd.whereNotExistsSource) {
|
|
123
|
+
dmp.put(' ^from ');
|
|
124
|
+
(0, dumpSqlSource_1.dumpSqlSourceDef)(dmp, cmd.whereNotExistsSource);
|
|
125
|
+
}
|
|
126
|
+
else if (dmp.dialect.requireFromDual) {
|
|
123
127
|
dmp.put(' ^from ^dual ');
|
|
124
128
|
}
|
|
125
129
|
dmp.put(' ^where ^not ^exists (^select * ^from %f ^where ', cmd.targetTable);
|
package/lib/dumpSqlExpression.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dumpSqlExpression = void 0;
|
|
4
4
|
const dumpSqlSource_1 = require("./dumpSqlSource");
|
|
5
|
+
const dumpSqlCommand_1 = require("./dumpSqlCommand");
|
|
5
6
|
function dumpSqlExpression(dmp, expr) {
|
|
6
7
|
switch (expr.exprType) {
|
|
7
8
|
case 'column':
|
|
@@ -62,6 +63,11 @@ function dumpSqlExpression(dmp, expr) {
|
|
|
62
63
|
});
|
|
63
64
|
dmp.put(')');
|
|
64
65
|
break;
|
|
66
|
+
case 'select':
|
|
67
|
+
dmp.put('(');
|
|
68
|
+
(0, dumpSqlCommand_1.dumpSqlSelect)(dmp, expr.select);
|
|
69
|
+
dmp.put(')');
|
|
70
|
+
break;
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
73
|
exports.dumpSqlExpression = dumpSqlExpression;
|
package/lib/types.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export interface Insert {
|
|
|
33
33
|
fields: UpdateField[];
|
|
34
34
|
targetTable: NamedObjectInfo;
|
|
35
35
|
insertWhereNotExistsCondition?: Condition;
|
|
36
|
+
whereNotExistsSource?: Source;
|
|
36
37
|
}
|
|
37
38
|
export interface AllowIdentityInsert {
|
|
38
39
|
commandType: 'allowIdentityInsert';
|
|
@@ -164,7 +165,11 @@ export interface RowNumberExpression {
|
|
|
164
165
|
exprType: 'rowNumber';
|
|
165
166
|
orderBy: OrderByExpression[];
|
|
166
167
|
}
|
|
167
|
-
export
|
|
168
|
+
export interface SelectExpression {
|
|
169
|
+
exprType: 'select';
|
|
170
|
+
select: Select;
|
|
171
|
+
}
|
|
172
|
+
export type Expression = ColumnRefExpression | ValueExpression | PlaceholderExpression | RawExpression | UnaryRawExpression | CallExpression | MethodCallExpression | TranformExpression | RowNumberExpression | SelectExpression;
|
|
168
173
|
export type OrderByExpression = Expression & {
|
|
169
174
|
direction: 'ASC' | 'DESC';
|
|
170
175
|
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "6.7.
|
|
2
|
+
"version": "6.7.2",
|
|
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": "^6.7.
|
|
30
|
+
"dbgate-types": "^6.7.2",
|
|
31
31
|
"typescript": "^4.4.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|