prettier-plugin-sql-cst 0.18.0 → 0.19.1
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/CstToDocMap.d.ts +2 -2
- package/dist/CstToDocMap.js +1 -2
- package/dist/PrintFn.js +1 -2
- package/dist/embed.js +5 -13
- package/dist/embedJs.js +28 -84
- package/dist/embedJson.js +29 -85
- package/dist/embedSql.js +26 -76
- package/dist/index.js +28 -34
- package/dist/node_utils.d.ts +1 -0
- package/dist/node_utils.js +44 -54
- package/dist/options.js +1 -4
- package/dist/printComment.js +2 -6
- package/dist/printSql.js +29 -39
- package/dist/print_utils.js +19 -38
- package/dist/syntax/alias.js +2 -5
- package/dist/syntax/alter_action.js +115 -208
- package/dist/syntax/alter_table.js +18 -27
- package/dist/syntax/analyze.js +3 -8
- package/dist/syntax/base.js +6 -9
- package/dist/syntax/cast.js +3 -6
- package/dist/syntax/comment.js +53 -122
- package/dist/syntax/constraint.d.ts +1 -1
- package/dist/syntax/constraint.js +54 -90
- package/dist/syntax/create_table.js +49 -87
- package/dist/syntax/data_type.js +25 -44
- package/dist/syntax/dcl.js +78 -136
- package/dist/syntax/delete.js +4 -9
- package/dist/syntax/dialects/bigquery.js +70 -116
- package/dist/syntax/dialects/mysql.js +2 -5
- package/dist/syntax/dialects/postgresql.js +8 -13
- package/dist/syntax/dialects/sqlite.js +8 -17
- package/dist/syntax/do.js +3 -6
- package/dist/syntax/domain.js +10 -19
- package/dist/syntax/drop_table.js +10 -15
- package/dist/syntax/explain.js +6 -11
- package/dist/syntax/expr.js +124 -173
- package/dist/syntax/extension.js +12 -21
- package/dist/syntax/frame.js +11 -16
- package/dist/syntax/function.js +53 -63
- package/dist/syntax/index.js +54 -81
- package/dist/syntax/insert.js +32 -49
- package/dist/syntax/merge.js +25 -30
- package/dist/syntax/other_clauses.js +5 -14
- package/dist/syntax/parameter.js +13 -26
- package/dist/syntax/policy.js +26 -41
- package/dist/syntax/prepared_statements.js +23 -43
- package/dist/syntax/proc_clause.js +10 -15
- package/dist/syntax/procedural_language.js +80 -111
- package/dist/syntax/procedure.js +36 -40
- package/dist/syntax/program.js +15 -22
- package/dist/syntax/publication.js +26 -47
- package/dist/syntax/rename_table.js +7 -12
- package/dist/syntax/role.js +30 -55
- package/dist/syntax/schema.js +17 -35
- package/dist/syntax/select.js +157 -226
- package/dist/syntax/sequence.js +35 -52
- package/dist/syntax/subscription.js +9 -24
- package/dist/syntax/transaction.js +18 -33
- package/dist/syntax/transformMap.js +99 -63
- package/dist/syntax/trigger.js +48 -72
- package/dist/syntax/truncate.js +9 -14
- package/dist/syntax/type.js +11 -22
- package/dist/syntax/unsupported_grammar.js +3 -6
- package/dist/syntax/update.js +7 -14
- package/dist/syntax/view.js +32 -43
- package/dist/transform/addFinalSemicolon.js +5 -9
- package/dist/transform/aliasAs.js +4 -8
- package/dist/transform/canonicKeywords.js +16 -20
- package/dist/transform/canonicOperators.js +8 -12
- package/dist/transform/comments.js +10 -31
- package/dist/transform/stripTrailingCommas.js +7 -11
- package/dist/transform/transformCst.js +13 -17
- package/dist/transform/transformUtils.js +2 -6
- package/dist/utils.js +9 -30
- package/dist/visitAllNodes.js +8 -13
- package/package.json +9 -8
package/dist/syntax/index.js
CHANGED
|
@@ -1,87 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.indexMap = void 0;
|
|
13
|
-
var print_utils_1 = require("../print_utils");
|
|
14
|
-
exports.indexMap = {
|
|
15
|
-
create_index_stmt: function (print) {
|
|
16
|
-
return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), __spreadArray([
|
|
17
|
-
print.spaced([
|
|
18
|
-
"createKw",
|
|
19
|
-
"orReplaceKw",
|
|
20
|
-
"indexTypeKw",
|
|
21
|
-
"indexKw",
|
|
22
|
-
"concurrentlyKw",
|
|
23
|
-
"ifNotExistsKw",
|
|
24
|
-
"name",
|
|
25
|
-
"onKw",
|
|
26
|
-
"table",
|
|
27
|
-
"using",
|
|
28
|
-
"columns",
|
|
29
|
-
])
|
|
30
|
-
], print("clauses"), true)));
|
|
31
|
-
},
|
|
32
|
-
index_specification: function (print) {
|
|
33
|
-
return print.spaced(["expr", "opclass", "direction", "nullHandlingKw"]);
|
|
34
|
-
},
|
|
35
|
-
index_include_clause: function (print) { return print.spaced(["includeKw", "columns"]); },
|
|
36
|
-
index_nulls_distinct_clause: function (print) { return print.spaced(["nullsDistinctKw"]); },
|
|
37
|
-
index_nulls_not_distinct_clause: function (print) {
|
|
38
|
-
return print.spaced(["nullsNotDistinctKw"]);
|
|
39
|
-
},
|
|
40
|
-
drop_index_stmt: function (print) {
|
|
41
|
-
return (0, print_utils_1.group)(print.spaced([
|
|
42
|
-
"dropKw",
|
|
1
|
+
import { group, join } from "../print_utils";
|
|
2
|
+
export const indexMap = {
|
|
3
|
+
create_index_stmt: (print) => group(join(print.dynamicLine(), [
|
|
4
|
+
print.spaced([
|
|
5
|
+
"createKw",
|
|
6
|
+
"orReplaceKw",
|
|
43
7
|
"indexTypeKw",
|
|
44
8
|
"indexKw",
|
|
45
9
|
"concurrentlyKw",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
10
|
+
"ifNotExistsKw",
|
|
11
|
+
"name",
|
|
48
12
|
"onKw",
|
|
49
13
|
"table",
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
14
|
+
"using",
|
|
15
|
+
"columns",
|
|
16
|
+
]),
|
|
17
|
+
...print("clauses"),
|
|
18
|
+
])),
|
|
19
|
+
index_specification: (print) => print.spaced(["expr", "opclass", "direction", "nullHandlingKw"]),
|
|
20
|
+
index_include_clause: (print) => print.spaced(["includeKw", "columns"]),
|
|
21
|
+
index_nulls_distinct_clause: (print) => print.spaced(["nullsDistinctKw"]),
|
|
22
|
+
index_nulls_not_distinct_clause: (print) => print.spaced(["nullsNotDistinctKw"]),
|
|
23
|
+
drop_index_stmt: (print) => group(print.spaced([
|
|
24
|
+
"dropKw",
|
|
25
|
+
"indexTypeKw",
|
|
26
|
+
"indexKw",
|
|
27
|
+
"concurrentlyKw",
|
|
28
|
+
"ifExistsKw",
|
|
29
|
+
"indexes",
|
|
30
|
+
"onKw",
|
|
31
|
+
"table",
|
|
32
|
+
"behaviorKw",
|
|
33
|
+
])),
|
|
34
|
+
verbose_all_columns: (print) => print.spaced("allColumnsKw"),
|
|
35
|
+
alter_index_stmt: (print) => group([
|
|
36
|
+
print.spaced(["alterKw", "indexKw", "ifExistsKw", "index"]),
|
|
37
|
+
print.dynamicLine(),
|
|
38
|
+
print("action"),
|
|
39
|
+
]),
|
|
40
|
+
alter_index_all_in_tablespace_stmt: (print) => group([
|
|
41
|
+
print.spaced([
|
|
42
|
+
"alterIndexKw",
|
|
43
|
+
"allInTablespaceKw",
|
|
44
|
+
"tablespace",
|
|
45
|
+
"ownedBy",
|
|
46
|
+
]),
|
|
47
|
+
print.dynamicLine(),
|
|
48
|
+
print("action"),
|
|
49
|
+
]),
|
|
50
|
+
reindex_stmt: (print) => group(print.spaced([
|
|
51
|
+
"reindexKw",
|
|
52
|
+
"options",
|
|
53
|
+
"targetKw",
|
|
54
|
+
"concurrentlyKw",
|
|
55
|
+
"name",
|
|
56
|
+
])),
|
|
57
|
+
reindex_option_concurrently: (print) => print.spaced(["concurrentlyKw", "value"]),
|
|
58
|
+
reindex_option_tablespace: (print) => print.spaced(["tablespaceKw", "name"]),
|
|
59
|
+
reindex_option_verbose: (print) => print.spaced(["verboseKw", "value"]),
|
|
87
60
|
};
|
package/dist/syntax/insert.js
CHANGED
|
@@ -1,50 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
]);
|
|
34
|
-
},
|
|
35
|
-
row_alias_clause: function (print, node) {
|
|
36
|
-
return (0, print_utils_1.group)([
|
|
37
|
-
print.spaced(["asKw", "rowAlias"]),
|
|
38
|
-
node.columnAliases
|
|
39
|
-
? (0, print_utils_1.indent)([print.dynamicLine(), print("columnAliases")])
|
|
40
|
-
: [],
|
|
41
|
-
]);
|
|
42
|
-
},
|
|
43
|
-
on_duplicate_key_update_clause: function (print) {
|
|
44
|
-
return (0, print_utils_1.group)([
|
|
45
|
-
print.spaced("onDuplicateKeyUpdateKw"),
|
|
46
|
-
(0, print_utils_1.indent)([print.dynamicLine(), print("assignments")]),
|
|
47
|
-
]);
|
|
48
|
-
},
|
|
49
|
-
overriding_clause: function (print) { return print.spaced("overridingKw"); },
|
|
1
|
+
import { join, group, indent } from "../print_utils";
|
|
2
|
+
export const insertMap = {
|
|
3
|
+
insert_stmt: (print) => group(join(print.dynamicLine(), print("clauses"))),
|
|
4
|
+
insert_clause: (print, node) => group([
|
|
5
|
+
print.spaced(["insertKw", "modifiers", "orAction", "intoKw", "table"]),
|
|
6
|
+
node.columns ? indent([print.dynamicLine(), print("columns")]) : [],
|
|
7
|
+
]),
|
|
8
|
+
values_clause: (print) => group([print("valuesKw"), indent([print.dynamicLine(), print("values")])]),
|
|
9
|
+
or_alternate_action: (print) => print.spaced(["orKw", "actionKw"]),
|
|
10
|
+
default: (print) => print("defaultKw"),
|
|
11
|
+
default_values: (print) => print.spaced("defaultValuesKw"),
|
|
12
|
+
upsert_clause: (print) => print.spaced(["onConflictKw", "conflictTarget", "where", "doKw", "action"]),
|
|
13
|
+
conflict_target_on_constraint: (print) => print.spaced(["onConstraintKw", "constraint"]),
|
|
14
|
+
upsert_action_nothing: (print) => print("nothingKw"),
|
|
15
|
+
upsert_action_update: (print) => group([
|
|
16
|
+
print("updateKw"),
|
|
17
|
+
indent([
|
|
18
|
+
print.dynamicLine(),
|
|
19
|
+
join(print.dynamicLine(), print(["set", "where"])),
|
|
20
|
+
]),
|
|
21
|
+
]),
|
|
22
|
+
row_alias_clause: (print, node) => group([
|
|
23
|
+
print.spaced(["asKw", "rowAlias"]),
|
|
24
|
+
node.columnAliases
|
|
25
|
+
? indent([print.dynamicLine(), print("columnAliases")])
|
|
26
|
+
: [],
|
|
27
|
+
]),
|
|
28
|
+
on_duplicate_key_update_clause: (print) => group([
|
|
29
|
+
print.spaced("onDuplicateKeyUpdateKw"),
|
|
30
|
+
indent([print.dynamicLine(), print("assignments")]),
|
|
31
|
+
]),
|
|
32
|
+
overriding_clause: (print) => print.spaced("overridingKw"),
|
|
50
33
|
};
|
package/dist/syntax/merge.js
CHANGED
|
@@ -1,35 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
(0, print_utils_1.group)([print("onKw"), (0, print_utils_1.indent)([print_utils_1.line, print("condition")])]),
|
|
12
|
-
]);
|
|
13
|
-
},
|
|
14
|
-
merge_when_clause: function (print, node) { return [
|
|
15
|
-
(0, print_utils_1.group)([
|
|
1
|
+
import { group, hardline, indent, join, line } from "../print_utils";
|
|
2
|
+
export const mergeMap = {
|
|
3
|
+
merge_stmt: (print) => group(join(hardline, print("clauses"))),
|
|
4
|
+
merge_clause: (print) => join(line, [
|
|
5
|
+
print.spaced(["mergeKw", "intoKw", "target"]),
|
|
6
|
+
print.spaced(["usingKw", "source"]),
|
|
7
|
+
group([print("onKw"), indent([line, print("condition")])]),
|
|
8
|
+
]),
|
|
9
|
+
merge_when_clause: (print, node) => [
|
|
10
|
+
group([
|
|
16
11
|
print.spaced(["whenKw", "matchedKw", "byKw"]),
|
|
17
|
-
node.condition ?
|
|
18
|
-
[
|
|
12
|
+
node.condition ? indent([line, print("condition")]) : [],
|
|
13
|
+
[line, print("thenKw")],
|
|
19
14
|
]),
|
|
20
|
-
|
|
21
|
-
]
|
|
22
|
-
merge_when_condition:
|
|
23
|
-
merge_action_delete:
|
|
24
|
-
merge_action_insert:
|
|
25
|
-
|
|
15
|
+
indent([hardline, group(print("action"))]),
|
|
16
|
+
],
|
|
17
|
+
merge_when_condition: (print) => print.spaced(["andKw", "expr"]),
|
|
18
|
+
merge_action_delete: (print) => print("deleteKw"),
|
|
19
|
+
merge_action_insert: (print, node) => [
|
|
20
|
+
group([
|
|
26
21
|
print("insertKw"),
|
|
27
|
-
node.columns ?
|
|
22
|
+
node.columns ? indent([hardline, print("columns")]) : [],
|
|
28
23
|
]),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
]
|
|
32
|
-
merge_action_insert_row_clause:
|
|
33
|
-
merge_action_update:
|
|
34
|
-
merge_action_do_nothing:
|
|
24
|
+
line,
|
|
25
|
+
join(hardline, print("clauses")),
|
|
26
|
+
],
|
|
27
|
+
merge_action_insert_row_clause: (print) => print("rowKw"),
|
|
28
|
+
merge_action_update: (print) => print.spaced(["updateKw", "set"]),
|
|
29
|
+
merge_action_do_nothing: (print) => print.spaced(["doNothingKw"]),
|
|
35
30
|
};
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.otherClausesMap = void 0;
|
|
4
|
-
var print_utils_1 = require("../print_utils");
|
|
5
|
-
exports.otherClausesMap = {
|
|
1
|
+
import { line, indent, group } from "../print_utils";
|
|
2
|
+
export const otherClausesMap = {
|
|
6
3
|
// CLUSTER BY clause
|
|
7
|
-
cluster_by_clause:
|
|
8
|
-
return (0, print_utils_1.group)([print.spaced("clusterByKw"), (0, print_utils_1.indent)([print_utils_1.line, print("columns")])]);
|
|
9
|
-
},
|
|
4
|
+
cluster_by_clause: (print) => group([print.spaced("clusterByKw"), indent([line, print("columns")])]),
|
|
10
5
|
// RETURNING clause
|
|
11
|
-
returning_clause:
|
|
12
|
-
return (0, print_utils_1.group)([print("returningKw"), (0, print_utils_1.indent)([print_utils_1.line, print("columns")])]);
|
|
13
|
-
},
|
|
6
|
+
returning_clause: (print) => group([print("returningKw"), indent([line, print("columns")])]),
|
|
14
7
|
// WHERE CURRENT OF clause
|
|
15
|
-
where_current_of_clause:
|
|
16
|
-
return print.spaced(["whereCurrentOfKw", "cursor"]);
|
|
17
|
-
},
|
|
8
|
+
where_current_of_clause: (print) => print.spaced(["whereCurrentOfKw", "cursor"]),
|
|
18
9
|
};
|
package/dist/syntax/parameter.js
CHANGED
|
@@ -1,31 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var expr_1 = require("./expr");
|
|
5
|
-
var print_utils_1 = require("../print_utils");
|
|
6
|
-
exports.parameterMap = {
|
|
1
|
+
import { printLiteral } from "./expr";
|
|
2
|
+
import { group } from "../print_utils";
|
|
3
|
+
export const parameterMap = {
|
|
7
4
|
// SET
|
|
8
|
-
set_parameter_stmt:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
set_parameter_clause: function (print) {
|
|
15
|
-
return print.spaced(["setKw", "name", "operator", "value"]);
|
|
16
|
-
},
|
|
17
|
-
local_parameter_value: function (print) { return print("localKw"); },
|
|
18
|
-
set_parameter_from_current_clause: function (print) {
|
|
19
|
-
return print.spaced(["setKw", "name", "fromCurrentKw"]);
|
|
20
|
-
},
|
|
5
|
+
set_parameter_stmt: (print) => group(print.spaced(["setKw", "modifierKw", "name", "operator", "value"])),
|
|
6
|
+
set_time_zone_parameter_stmt: (print) => group(print.spaced(["setKw", "modifierKw", "timeZoneKw", "value"])),
|
|
7
|
+
set_parameter_clause: (print) => print.spaced(["setKw", "name", "operator", "value"]),
|
|
8
|
+
local_parameter_value: (print) => print("localKw"),
|
|
9
|
+
set_parameter_from_current_clause: (print) => print.spaced(["setKw", "name", "fromCurrentKw"]),
|
|
21
10
|
// RESET
|
|
22
|
-
reset_parameter_stmt:
|
|
23
|
-
reset_parameter_clause:
|
|
24
|
-
all_parameters:
|
|
11
|
+
reset_parameter_stmt: (print) => group(print.spaced(["resetKw", "name"])),
|
|
12
|
+
reset_parameter_clause: (print) => print.spaced(["resetKw", "name"]),
|
|
13
|
+
all_parameters: (print) => print("allKw"),
|
|
25
14
|
// SHOW
|
|
26
|
-
show_parameter_stmt:
|
|
15
|
+
show_parameter_stmt: (print) => group(print.spaced(["showKw", "name"])),
|
|
27
16
|
/** cst-ignore: value */
|
|
28
|
-
boolean_on_off_literal:
|
|
29
|
-
return (0, expr_1.printLiteral)(node.valueKw, options);
|
|
30
|
-
},
|
|
17
|
+
boolean_on_off_literal: (print, node, path, options) => printLiteral(node.valueKw, options),
|
|
31
18
|
};
|
package/dist/syntax/policy.js
CHANGED
|
@@ -1,42 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
print.spaced(["alterPolicyKw", "name", "onKw", "table"]),
|
|
28
|
-
print.dynamicLine(),
|
|
29
|
-
(0, print_utils_1.join)(print.dynamicLine(), print("actions")),
|
|
30
|
-
]);
|
|
31
|
-
},
|
|
32
|
-
drop_policy_stmt: function (print) {
|
|
33
|
-
return (0, print_utils_1.group)(print.spaced([
|
|
34
|
-
"dropPolicyKw",
|
|
35
|
-
"ifExistsKw",
|
|
36
|
-
"name",
|
|
37
|
-
"onKw",
|
|
38
|
-
"table",
|
|
39
|
-
"behaviorKw",
|
|
40
|
-
]));
|
|
41
|
-
},
|
|
1
|
+
import { group, join } from "../print_utils";
|
|
2
|
+
export const policyMap = {
|
|
3
|
+
create_policy_stmt: (print, node) => group([
|
|
4
|
+
print.spaced(["createPolicyKw", "name", "onKw", "table"]),
|
|
5
|
+
node.clauses.length > 0 ? print.dynamicLine() : [],
|
|
6
|
+
join(print.dynamicLine(), print("clauses")),
|
|
7
|
+
]),
|
|
8
|
+
policy_permissive_clause: (print) => group(print.spaced(["asKw", "permissiveKw"])),
|
|
9
|
+
policy_restrictive_clause: (print) => group(print.spaced(["asKw", "restrictiveKw"])),
|
|
10
|
+
policy_command_clause: (print) => group(print.spaced(["forKw", "commandKw"])),
|
|
11
|
+
policy_roles_clause: (print) => group(print.spaced(["toKw", "roles"])),
|
|
12
|
+
policy_using_clause: (print) => group(print.spaced(["usingKw", "expr"])),
|
|
13
|
+
policy_check_clause: (print) => group(print.spaced(["withKw", "checkKw", "expr"])),
|
|
14
|
+
alter_policy_stmt: (print) => group([
|
|
15
|
+
print.spaced(["alterPolicyKw", "name", "onKw", "table"]),
|
|
16
|
+
print.dynamicLine(),
|
|
17
|
+
join(print.dynamicLine(), print("actions")),
|
|
18
|
+
]),
|
|
19
|
+
drop_policy_stmt: (print) => group(print.spaced([
|
|
20
|
+
"dropPolicyKw",
|
|
21
|
+
"ifExistsKw",
|
|
22
|
+
"name",
|
|
23
|
+
"onKw",
|
|
24
|
+
"table",
|
|
25
|
+
"behaviorKw",
|
|
26
|
+
])),
|
|
42
27
|
};
|
|
@@ -1,51 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.preparedStatementsMap = void 0;
|
|
13
|
-
var print_utils_1 = require("../print_utils");
|
|
14
|
-
exports.preparedStatementsMap = {
|
|
1
|
+
import { group, hardline, indent, join, line } from "../print_utils";
|
|
2
|
+
export const preparedStatementsMap = {
|
|
15
3
|
// EXECUTE
|
|
16
|
-
execute_stmt:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return (0, print_utils_1.group)(print.spaced(["executeKw", "name", "args"]));
|
|
4
|
+
execute_stmt: (print, node) => {
|
|
5
|
+
if (node.args?.type === "execute_using_clause") {
|
|
6
|
+
return group(print.spaced(["executeKw", "name", "args"]));
|
|
20
7
|
}
|
|
21
8
|
else {
|
|
22
|
-
return
|
|
9
|
+
return group([print.spaced(["executeKw", "name"]), print("args")]);
|
|
23
10
|
}
|
|
24
11
|
},
|
|
25
|
-
execute_immediate_stmt:
|
|
26
|
-
|
|
27
|
-
(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
execute_using_clause: function (print) {
|
|
35
|
-
return (0, print_utils_1.group)([print("usingKw"), (0, print_utils_1.indent)([print_utils_1.line, print("values")])]);
|
|
36
|
-
},
|
|
12
|
+
execute_immediate_stmt: (print) => group(join(hardline, [
|
|
13
|
+
group([
|
|
14
|
+
print.spaced(["executeKw", "immediateKw"]),
|
|
15
|
+
indent([line, print("expr")]),
|
|
16
|
+
]),
|
|
17
|
+
...print(["into", "using"]).map((clause) => group(clause)),
|
|
18
|
+
])),
|
|
19
|
+
execute_into_clause: (print) => print.spaced(["intoKw", "variables"]),
|
|
20
|
+
execute_using_clause: (print) => group([print("usingKw"), indent([line, print("values")])]),
|
|
37
21
|
// PREPARE
|
|
38
|
-
prepare_stmt:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
},
|
|
45
|
-
prepare_from_clause: function (print) {
|
|
46
|
-
return (0, print_utils_1.group)([print("fromKw"), (0, print_utils_1.indent)([print_utils_1.line, print("expr")])]);
|
|
47
|
-
},
|
|
22
|
+
prepare_stmt: (print) => group(join(" ", [
|
|
23
|
+
print("prepareKw"),
|
|
24
|
+
print(["name", "params"]),
|
|
25
|
+
print("source"),
|
|
26
|
+
])),
|
|
27
|
+
prepare_from_clause: (print) => group([print("fromKw"), indent([line, print("expr")])]),
|
|
48
28
|
// DEALLOCATE
|
|
49
|
-
deallocate_stmt:
|
|
50
|
-
deallocate_all:
|
|
29
|
+
deallocate_stmt: (print) => group(print.spaced(["deallocateKw", "name"])),
|
|
30
|
+
deallocate_all: (print) => print("allKw"),
|
|
51
31
|
};
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
language_clause: function (print) { return print.spaced(["languageKw", "name"]); },
|
|
10
|
-
as_clause: function (print, node) {
|
|
11
|
-
if ((0, node_utils_1.isStringLiteral)(node.expr) || (0, node_utils_1.isDynamicallyLoadedFunction)(node.expr)) {
|
|
1
|
+
import { isDynamicallyLoadedFunction, isStringLiteral } from "../node_utils";
|
|
2
|
+
import { hardline, indent } from "../print_utils";
|
|
3
|
+
export const procClauseMap = {
|
|
4
|
+
returns_clause: (print) => print.spaced(["returnsKw", "dataType"]),
|
|
5
|
+
determinism_clause: (print) => print.spaced("deterministicKw"),
|
|
6
|
+
language_clause: (print) => print.spaced(["languageKw", "name"]),
|
|
7
|
+
as_clause: (print, node) => {
|
|
8
|
+
if (isStringLiteral(node.expr) || isDynamicallyLoadedFunction(node.expr)) {
|
|
12
9
|
return print.spaced(["asKw", "expr"]);
|
|
13
10
|
}
|
|
14
|
-
return [print("asKw"),
|
|
15
|
-
},
|
|
16
|
-
with_connection_clause: function (print) {
|
|
17
|
-
return print.spaced(["withConnectionKw", "connection"]);
|
|
11
|
+
return [print("asKw"), indent([hardline, print("expr")])];
|
|
18
12
|
},
|
|
13
|
+
with_connection_clause: (print) => print.spaced(["withConnectionKw", "connection"]),
|
|
19
14
|
};
|