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/select.js
CHANGED
|
@@ -1,293 +1,224 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.selectMap = {
|
|
7
|
-
compound_select_stmt: function (print) {
|
|
8
|
-
return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.hardline, [print("left"), print.spaced("operator"), print("right")]));
|
|
9
|
-
},
|
|
10
|
-
select_stmt: function (print) { return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), print("clauses"))); },
|
|
1
|
+
import { isDefined } from "../utils";
|
|
2
|
+
import { join, line, hardline, indent, group, containsNewline, breakParent, } from "../print_utils";
|
|
3
|
+
export const selectMap = {
|
|
4
|
+
compound_select_stmt: (print) => group(join(hardline, [print("left"), print.spaced("operator"), print("right")])),
|
|
5
|
+
select_stmt: (print) => group(join(print.dynamicLine(), print("clauses"))),
|
|
11
6
|
// WITH clause
|
|
12
|
-
with_clause:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
common_table_expr: function (print, node) { return [
|
|
7
|
+
with_clause: (print) => group([
|
|
8
|
+
print.spaced(["withKw", "recursiveKw"]),
|
|
9
|
+
indent([line, print("tables")]),
|
|
10
|
+
]),
|
|
11
|
+
common_table_expr: (print, node) => [
|
|
19
12
|
print(["table", "columns"]),
|
|
20
13
|
" ",
|
|
21
14
|
print.spaced(["asKw", "materializedKw", "expr"]),
|
|
22
|
-
|
|
15
|
+
group([
|
|
23
16
|
node.search || node.cycle
|
|
24
|
-
?
|
|
17
|
+
? indent([line, print.separated(line, ["search", "cycle"])])
|
|
25
18
|
: [],
|
|
26
19
|
]),
|
|
27
|
-
]
|
|
28
|
-
cte_search_clause:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
cte_cycle_clause_values: function (print) {
|
|
43
|
-
return (0, print_utils_1.join)(print_utils_1.line, [
|
|
44
|
-
print.spaced(["toKw", "markValue"]),
|
|
45
|
-
print.spaced(["defaultKw", "defaultValue"]),
|
|
46
|
-
]);
|
|
47
|
-
},
|
|
20
|
+
],
|
|
21
|
+
cte_search_clause: (print) => group(join(line, [
|
|
22
|
+
[print.spaced("searchKw"), group(indent([line, print("columns")]))],
|
|
23
|
+
print.spaced(["setKw", "resultColumn"]),
|
|
24
|
+
])),
|
|
25
|
+
cte_cycle_clause: (print, node) => group(join(line, [
|
|
26
|
+
[print("cycleKw"), group(indent([line, print("columns")]))],
|
|
27
|
+
print.spaced(["setKw", "resultColumn"]),
|
|
28
|
+
node.values ? print("values") : undefined,
|
|
29
|
+
print.spaced(["usingKw", "pathColumn"]),
|
|
30
|
+
].filter(isDefined))),
|
|
31
|
+
cte_cycle_clause_values: (print) => join(line, [
|
|
32
|
+
print.spaced(["toKw", "markValue"]),
|
|
33
|
+
print.spaced(["defaultKw", "defaultValue"]),
|
|
34
|
+
]),
|
|
48
35
|
// SELECT clause
|
|
49
|
-
select_clause:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
select_as_struct: function (print) { return print.spaced(["asStructKw"]); },
|
|
62
|
-
select_as_value: function (print) { return print.spaced(["asValueKw"]); },
|
|
63
|
-
except_columns: function (print) { return print.spaced(["expr", "exceptKw", "columns"]); },
|
|
64
|
-
replace_columns: function (print) { return print.spaced(["expr", "replaceKw", "columns"]); },
|
|
36
|
+
select_clause: (print, node, path, opts) => group([
|
|
37
|
+
print.spaced(["selectKw", "modifiers"]),
|
|
38
|
+
node.columns ? indent([line, print("columns")]) : [],
|
|
39
|
+
containsNewline(node, opts) ? breakParent : [],
|
|
40
|
+
]),
|
|
41
|
+
select_all: (print) => print.spaced(["allKw"]),
|
|
42
|
+
select_distinct: (print) => print.spaced(["distinctKw"]),
|
|
43
|
+
select_distinct_on: (print) => group([print.spaced(["distinctOnKw", "columns"])]),
|
|
44
|
+
select_as_struct: (print) => print.spaced(["asStructKw"]),
|
|
45
|
+
select_as_value: (print) => print.spaced(["asValueKw"]),
|
|
46
|
+
except_columns: (print) => print.spaced(["expr", "exceptKw", "columns"]),
|
|
47
|
+
replace_columns: (print) => print.spaced(["expr", "replaceKw", "columns"]),
|
|
65
48
|
// FROM clause
|
|
66
|
-
from_clause:
|
|
67
|
-
|
|
68
|
-
},
|
|
69
|
-
join_expr: function (print, node) {
|
|
49
|
+
from_clause: (print) => group([print("fromKw"), indent([line, print("expr")])]),
|
|
50
|
+
join_expr: (print, node) => {
|
|
70
51
|
if (node.operator === ",") {
|
|
71
|
-
return
|
|
52
|
+
return join([",", hardline], print(["left", "right"]));
|
|
72
53
|
}
|
|
73
54
|
else {
|
|
74
55
|
return [
|
|
75
56
|
print("left"),
|
|
76
|
-
|
|
77
|
-
|
|
57
|
+
hardline,
|
|
58
|
+
group(join(" ", [
|
|
78
59
|
print.spaced("operator"),
|
|
79
60
|
[
|
|
80
61
|
print("right"),
|
|
81
62
|
node.specification
|
|
82
|
-
?
|
|
63
|
+
? indent([line, print(["specification"])])
|
|
83
64
|
: [],
|
|
84
65
|
],
|
|
85
66
|
])),
|
|
86
67
|
];
|
|
87
68
|
}
|
|
88
69
|
},
|
|
89
|
-
join_on_specification:
|
|
90
|
-
join_using_specification:
|
|
91
|
-
table_with_inheritance:
|
|
92
|
-
table_without_inheritance:
|
|
93
|
-
indexed_table:
|
|
94
|
-
not_indexed_table:
|
|
95
|
-
unnest_expr:
|
|
96
|
-
unnest_with_offset_expr:
|
|
97
|
-
pivot_expr:
|
|
98
|
-
pivot_for_in:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
unpivot_expr: function (print, node) { return [
|
|
70
|
+
join_on_specification: (print) => group(print.spaced(["onKw", "expr"])),
|
|
71
|
+
join_using_specification: (print) => group(print.spaced(["usingKw", "expr"])),
|
|
72
|
+
table_with_inheritance: (print) => [print("table"), " ", "*"],
|
|
73
|
+
table_without_inheritance: (print) => print.spaced(["onlyKw", "table"]),
|
|
74
|
+
indexed_table: (print) => print.spaced(["table", "indexedByKw", "index"]),
|
|
75
|
+
not_indexed_table: (print) => print.spaced(["table", "notIndexedKw"]),
|
|
76
|
+
unnest_expr: (print) => print(["unnestKw", "expr"]),
|
|
77
|
+
unnest_with_offset_expr: (print) => print.spaced(["unnest", "withOffsetKw"]),
|
|
78
|
+
pivot_expr: (print) => [print("left"), hardline, print(["pivotKw", "args"])],
|
|
79
|
+
pivot_for_in: (print) => group(join(line, [
|
|
80
|
+
group(print("aggregations")),
|
|
81
|
+
print.spaced(["forKw", "inputColumn"]),
|
|
82
|
+
print.spaced(["inKw", "pivotColumns"]),
|
|
83
|
+
])),
|
|
84
|
+
unpivot_expr: (print, node) => [
|
|
106
85
|
print("left"),
|
|
107
|
-
|
|
86
|
+
hardline,
|
|
108
87
|
(node.nullHandlingKw ? print.spaced : print)([
|
|
109
88
|
"unpivotKw",
|
|
110
89
|
"nullHandlingKw",
|
|
111
90
|
"args",
|
|
112
91
|
]),
|
|
113
|
-
]
|
|
114
|
-
unpivot_for_in:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
partitioned_table: function (print) {
|
|
135
|
-
return print.spaced(["table", "partitionKw", "partitions"]);
|
|
136
|
-
},
|
|
137
|
-
dual_table: function (print) { return print("dualKw"); },
|
|
138
|
-
lateral_derived_table: function (print) { return print.spaced(["lateralKw", "expr"]); },
|
|
139
|
-
rows_from_expr: function (print) { return print.spaced(["rowsFromKw", "expr"]); },
|
|
140
|
-
with_ordinality_expr: function (print) { return print.spaced(["expr", "withOrdinalityKw"]); },
|
|
141
|
-
func_call_with_column_definitions: function (print) {
|
|
142
|
-
return print.spaced(["funcCall", "asKw", "columns"]);
|
|
143
|
-
},
|
|
92
|
+
],
|
|
93
|
+
unpivot_for_in: (print) => group(join(line, [
|
|
94
|
+
print("valuesColumn"),
|
|
95
|
+
print.spaced(["forKw", "nameColumn"]),
|
|
96
|
+
print.spaced(["inKw", "unpivotColumns"]),
|
|
97
|
+
])),
|
|
98
|
+
tablesample_expr: (print) => group([
|
|
99
|
+
print("left"),
|
|
100
|
+
line,
|
|
101
|
+
print.spaced(["tablesampleKw", "method", "args", "repeatable"]),
|
|
102
|
+
]),
|
|
103
|
+
tablesample_method: (print) => print.spaced(["methodKw"]),
|
|
104
|
+
tablesample_percent: (print) => print.spaced(["percent", "percentKw"]),
|
|
105
|
+
tablesample_repeatable: (print) => print.spaced(["repeatableKw", "seed"]),
|
|
106
|
+
for_system_time_as_of_expr: (print) => group([print("left"), line, print.spaced(["forSystemTimeAsOfKw", "expr"])]),
|
|
107
|
+
partitioned_table: (print) => print.spaced(["table", "partitionKw", "partitions"]),
|
|
108
|
+
dual_table: (print) => print("dualKw"),
|
|
109
|
+
lateral_derived_table: (print) => print.spaced(["lateralKw", "expr"]),
|
|
110
|
+
rows_from_expr: (print) => print.spaced(["rowsFromKw", "expr"]),
|
|
111
|
+
with_ordinality_expr: (print) => print.spaced(["expr", "withOrdinalityKw"]),
|
|
112
|
+
func_call_with_column_definitions: (print) => print.spaced(["funcCall", "asKw", "columns"]),
|
|
144
113
|
// WHERE clause
|
|
145
|
-
where_clause:
|
|
146
|
-
return (0, print_utils_1.group)([print("whereKw"), (0, print_utils_1.indent)([print_utils_1.line, print("expr")])]);
|
|
147
|
-
},
|
|
114
|
+
where_clause: (print) => group([print("whereKw"), indent([line, print("expr")])]),
|
|
148
115
|
// ORDER BY clause
|
|
149
|
-
order_by_clause:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
sort_direction_asc: function (print) { return print("ascKw"); },
|
|
159
|
-
sort_direction_desc: function (print) { return print("descKw"); },
|
|
160
|
-
sort_direction_using_operator: function (print) {
|
|
161
|
-
return print.spaced(["usingKw", "operator"]);
|
|
162
|
-
},
|
|
116
|
+
order_by_clause: (print, node) => group([
|
|
117
|
+
print.spaced("orderByKw"),
|
|
118
|
+
indent([line, print.separated(line, ["specifications", "withRollupKw"])]),
|
|
119
|
+
]),
|
|
120
|
+
sort_specification: (print) => print.spaced(["expr", "direction", "nullHandlingKw"]),
|
|
121
|
+
sort_direction_asc: (print) => print("ascKw"),
|
|
122
|
+
sort_direction_desc: (print) => print("descKw"),
|
|
123
|
+
sort_direction_using_operator: (print) => print.spaced(["usingKw", "operator"]),
|
|
163
124
|
// GROUP BY clause
|
|
164
|
-
group_by_clause:
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
group_by_grouping_sets: function (print) {
|
|
173
|
-
return print.spaced(["groupingSetsKw", "columns"]);
|
|
174
|
-
},
|
|
175
|
-
group_by_all: function (print) { return print(["allKw"]); },
|
|
125
|
+
group_by_clause: (print, node) => group([
|
|
126
|
+
print.spaced(["groupByKw", "distinctKw"]),
|
|
127
|
+
indent([line, print.separated(line, ["columns", "withRollupKw"])]),
|
|
128
|
+
]),
|
|
129
|
+
group_by_rollup: (print) => print(["rollupKw", "columns"]),
|
|
130
|
+
group_by_cube: (print) => print(["cubeKw", "columns"]),
|
|
131
|
+
group_by_grouping_sets: (print) => print.spaced(["groupingSetsKw", "columns"]),
|
|
132
|
+
group_by_all: (print) => print(["allKw"]),
|
|
176
133
|
// PARTITION BY clause
|
|
177
|
-
partition_by_clause:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
]);
|
|
182
|
-
},
|
|
134
|
+
partition_by_clause: (print) => group([
|
|
135
|
+
print.spaced("partitionByKw"),
|
|
136
|
+
indent([line, print("specifications")]),
|
|
137
|
+
]),
|
|
183
138
|
// HAVING clause
|
|
184
|
-
having_clause:
|
|
185
|
-
return (0, print_utils_1.group)([print("havingKw"), (0, print_utils_1.indent)([print_utils_1.line, print("expr")])]);
|
|
186
|
-
},
|
|
139
|
+
having_clause: (print) => group([print("havingKw"), indent([line, print("expr")])]),
|
|
187
140
|
// QUALIFY clause
|
|
188
|
-
qualify_clause:
|
|
189
|
-
return (0, print_utils_1.group)([print("qualifyKw"), (0, print_utils_1.indent)([print_utils_1.line, print("expr")])]);
|
|
190
|
-
},
|
|
141
|
+
qualify_clause: (print) => group([print("qualifyKw"), indent([line, print("expr")])]),
|
|
191
142
|
// LIMIT clause
|
|
192
143
|
/** cst-ignore: count, offsetKw, offset */
|
|
193
|
-
limit_clause:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
limit_all: function (print) { return print("allKw"); },
|
|
204
|
-
limit_rows_examined: function (print) { return print.spaced(["rowsExaminedKw", "count"]); },
|
|
144
|
+
limit_clause: (print, node) => group([
|
|
145
|
+
print("limitKw"),
|
|
146
|
+
indent([
|
|
147
|
+
line,
|
|
148
|
+
printLimitValues(print, node),
|
|
149
|
+
node.rowsExamined ? [line, print("rowsExamined")] : [],
|
|
150
|
+
]),
|
|
151
|
+
]),
|
|
152
|
+
limit_all: (print) => print("allKw"),
|
|
153
|
+
limit_rows_examined: (print) => print.spaced(["rowsExaminedKw", "count"]),
|
|
205
154
|
// OFFSET clause
|
|
206
|
-
offset_clause:
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
]);
|
|
211
|
-
},
|
|
155
|
+
offset_clause: (print) => group([
|
|
156
|
+
print("offsetKw"),
|
|
157
|
+
indent([line, print.spaced(["offset", "rowsKw"])]),
|
|
158
|
+
]),
|
|
212
159
|
// FETCH clause
|
|
213
|
-
fetch_clause:
|
|
214
|
-
return print.spaced(["fetchKw", "count", "rowsKw", "withTiesKw"]);
|
|
215
|
-
},
|
|
160
|
+
fetch_clause: (print) => print.spaced(["fetchKw", "count", "rowsKw", "withTiesKw"]),
|
|
216
161
|
// WINDOW clause
|
|
217
|
-
window_clause:
|
|
218
|
-
|
|
219
|
-
return
|
|
162
|
+
window_clause: (print, node) => {
|
|
163
|
+
const lineType = node.namedWindows.items.length > 1 ? hardline : line;
|
|
164
|
+
return group([
|
|
220
165
|
print("windowKw"),
|
|
221
|
-
|
|
166
|
+
indent([lineType, print("namedWindows")]),
|
|
222
167
|
]);
|
|
223
168
|
},
|
|
224
|
-
named_window:
|
|
225
|
-
window_definition:
|
|
226
|
-
|
|
169
|
+
named_window: (print) => print.spaced(["name", "asKw", "window"]),
|
|
170
|
+
window_definition: (print, node) => {
|
|
171
|
+
const itemCount = [
|
|
227
172
|
node.baseWindowName,
|
|
228
173
|
node.partitionBy,
|
|
229
174
|
node.orderBy,
|
|
230
175
|
node.frame,
|
|
231
|
-
].filter(
|
|
232
|
-
|
|
233
|
-
return
|
|
176
|
+
].filter(isDefined).length;
|
|
177
|
+
const lineType = itemCount > 1 ? hardline : line;
|
|
178
|
+
return group(join(lineType, print(["baseWindowName", "partitionBy", "orderBy", "frame"])));
|
|
234
179
|
},
|
|
235
180
|
// INTO clause
|
|
236
|
-
into_table_clause:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
into_dumpfile_clause: function (print) { return print.spaced(["intoDumpfileKw", "filename"]); },
|
|
243
|
-
into_outfile_clause: function (print, node) {
|
|
244
|
-
var hasOptions = node.charset || node.fields || node.lines;
|
|
245
|
-
return (0, print_utils_1.group)([
|
|
181
|
+
into_table_clause: (print) => print.spaced(["intoKw", "kind", "tableKw", "name"]),
|
|
182
|
+
into_variables_clause: (print) => group([print("intoKw"), indent([line, print("variables")])]),
|
|
183
|
+
into_dumpfile_clause: (print) => print.spaced(["intoDumpfileKw", "filename"]),
|
|
184
|
+
into_outfile_clause: (print, node) => {
|
|
185
|
+
const hasOptions = node.charset || node.fields || node.lines;
|
|
186
|
+
return group([
|
|
246
187
|
print.spaced(["intoOutfileKw", "filename"]),
|
|
247
188
|
hasOptions
|
|
248
|
-
?
|
|
249
|
-
|
|
250
|
-
|
|
189
|
+
? indent([
|
|
190
|
+
hardline,
|
|
191
|
+
join(hardline, print(["charset", "fields", "lines"])),
|
|
251
192
|
])
|
|
252
193
|
: [],
|
|
253
194
|
]);
|
|
254
195
|
},
|
|
255
|
-
outfile_fields:
|
|
256
|
-
outfile_lines:
|
|
257
|
-
outfile_option_character_set:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
},
|
|
263
|
-
outfile_option_terminated_by: function (print) {
|
|
264
|
-
return print.spaced(["terminatedByKw", "value"]);
|
|
265
|
-
},
|
|
266
|
-
outfile_option_enclosed_by: function (print) {
|
|
267
|
-
return print.spaced(["optionallyKw", "enclosedByKw", "value"]);
|
|
268
|
-
},
|
|
269
|
-
outfile_option_escaped_by: function (print) { return print.spaced(["escapedByKw", "value"]); },
|
|
196
|
+
outfile_fields: (print) => print.spaced(["fieldsKw", "options"]),
|
|
197
|
+
outfile_lines: (print) => print.spaced(["linesKw", "options"]),
|
|
198
|
+
outfile_option_character_set: (print) => print.spaced(["characterSetKw", "value"]),
|
|
199
|
+
outfile_option_starting_by: (print) => print.spaced(["startingByKw", "value"]),
|
|
200
|
+
outfile_option_terminated_by: (print) => print.spaced(["terminatedByKw", "value"]),
|
|
201
|
+
outfile_option_enclosed_by: (print) => print.spaced(["optionallyKw", "enclosedByKw", "value"]),
|
|
202
|
+
outfile_option_escaped_by: (print) => print.spaced(["escapedByKw", "value"]),
|
|
270
203
|
// FOR clause (locking)
|
|
271
|
-
for_clause:
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
},
|
|
277
|
-
for_clause_tables: function (print) { return [
|
|
204
|
+
for_clause: (print, node) => group([
|
|
205
|
+
print.spaced(["forKw", "lockStrengthKw", "tables"]),
|
|
206
|
+
node.waitingKw ? indent([line, print.spaced("waitingKw")]) : [],
|
|
207
|
+
]),
|
|
208
|
+
for_clause_tables: (print) => [
|
|
278
209
|
print("ofKw"),
|
|
279
|
-
|
|
280
|
-
]
|
|
281
|
-
lock_in_share_mode_clause:
|
|
210
|
+
indent([line, print("tables")]),
|
|
211
|
+
],
|
|
212
|
+
lock_in_share_mode_clause: (print) => print.spaced("lockInShareModeKw"),
|
|
282
213
|
// TABLE clause
|
|
283
|
-
table_clause:
|
|
214
|
+
table_clause: (print) => print.spaced(["tableKw", "table"]),
|
|
284
215
|
};
|
|
285
|
-
|
|
216
|
+
const printLimitValues = (print, node) => {
|
|
286
217
|
if (node.offsetKw) {
|
|
287
218
|
return print.spaced(["count", "offsetKw", "offset"]);
|
|
288
219
|
}
|
|
289
220
|
else if (node.offset) {
|
|
290
|
-
return
|
|
221
|
+
return join([",", " "], print(["offset", "count"]));
|
|
291
222
|
}
|
|
292
223
|
else {
|
|
293
224
|
return print("count");
|
package/dist/syntax/sequence.js
CHANGED
|
@@ -1,53 +1,36 @@
|
|
|
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
|
-
|
|
36
|
-
return print.spaced(["incrementKw", "byKw", "value"]);
|
|
37
|
-
},
|
|
38
|
-
sequence_option_minvalue: function (print) { return print.spaced(["minvalueKw", "value"]); },
|
|
39
|
-
sequence_option_maxvalue: function (print) { return print.spaced(["maxvalueKw", "value"]); },
|
|
40
|
-
sequence_option_no_minvalue: function (print) { return print.spaced("noMinvalueKw"); },
|
|
41
|
-
sequence_option_no_maxvalue: function (print) { return print.spaced("noMaxvalueKw"); },
|
|
42
|
-
sequence_option_start: function (print) {
|
|
43
|
-
return print.spaced(["startKw", "withKw", "value"]);
|
|
44
|
-
},
|
|
45
|
-
sequence_option_restart: function (print) {
|
|
46
|
-
return print.spaced(["restartKw", "withKw", "value"]);
|
|
47
|
-
},
|
|
48
|
-
sequence_option_cache: function (print) { return print.spaced(["cacheKw", "value"]); },
|
|
49
|
-
sequence_option_cycle: function (print) { return print.spaced("cycleKw"); },
|
|
50
|
-
sequence_option_no_cycle: function (print) { return print.spaced("noCycleKw"); },
|
|
51
|
-
sequence_option_owned_by: function (print) { return print.spaced(["ownedByKw", "owner"]); },
|
|
52
|
-
sequence_option_list: function (print) { return (0, print_utils_1.join)(print_utils_1.line, print("options")); },
|
|
1
|
+
import { group, indent, join, line } from "../print_utils";
|
|
2
|
+
export const sequenceMap = {
|
|
3
|
+
create_sequence_stmt: (print, node) => group([
|
|
4
|
+
print.spaced(["createKw", "kind", "sequenceKw", "ifNotExistsKw", "name"]),
|
|
5
|
+
node.options.length > 0
|
|
6
|
+
? indent([print.dynamicLine(), join(line, print("options"))])
|
|
7
|
+
: [],
|
|
8
|
+
]),
|
|
9
|
+
alter_sequence_stmt: (print) => group([
|
|
10
|
+
print.spaced(["alterKw", "sequenceKw", "ifExistsKw", "sequence"]),
|
|
11
|
+
indent([print.dynamicLine(), join(line, print("actions"))]),
|
|
12
|
+
]),
|
|
13
|
+
drop_sequence_stmt: (print) => group(print.spaced([
|
|
14
|
+
"dropKw",
|
|
15
|
+
"sequenceKw",
|
|
16
|
+
"ifExistsKw",
|
|
17
|
+
"sequences",
|
|
18
|
+
"behaviorKw",
|
|
19
|
+
])),
|
|
20
|
+
sequence_option_sequence_name: (print) => print.spaced(["sequenceNameKw", "name"]),
|
|
21
|
+
sequence_option_logged: (print) => print.spaced("loggedKw"),
|
|
22
|
+
sequence_option_unlogged: (print) => print.spaced("unloggedKw"),
|
|
23
|
+
sequence_option_as_type: (print) => print.spaced(["asKw", "dataType"]),
|
|
24
|
+
sequence_option_increment: (print) => print.spaced(["incrementKw", "byKw", "value"]),
|
|
25
|
+
sequence_option_minvalue: (print) => print.spaced(["minvalueKw", "value"]),
|
|
26
|
+
sequence_option_maxvalue: (print) => print.spaced(["maxvalueKw", "value"]),
|
|
27
|
+
sequence_option_no_minvalue: (print) => print.spaced("noMinvalueKw"),
|
|
28
|
+
sequence_option_no_maxvalue: (print) => print.spaced("noMaxvalueKw"),
|
|
29
|
+
sequence_option_start: (print) => print.spaced(["startKw", "withKw", "value"]),
|
|
30
|
+
sequence_option_restart: (print) => print.spaced(["restartKw", "withKw", "value"]),
|
|
31
|
+
sequence_option_cache: (print) => print.spaced(["cacheKw", "value"]),
|
|
32
|
+
sequence_option_cycle: (print) => print.spaced("cycleKw"),
|
|
33
|
+
sequence_option_no_cycle: (print) => print.spaced("noCycleKw"),
|
|
34
|
+
sequence_option_owned_by: (print) => print.spaced(["ownedByKw", "owner"]),
|
|
35
|
+
sequence_option_list: (print) => join(line, print("options")),
|
|
53
36
|
};
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.subscriptionMap = void 0;
|
|
13
|
-
var print_utils_1 = require("../print_utils");
|
|
14
|
-
exports.subscriptionMap = {
|
|
15
|
-
create_subscription_stmt: function (print, node) {
|
|
16
|
-
return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.line, __spreadArray([
|
|
17
|
-
print.spaced(["createSubscriptionKw", "name"]),
|
|
18
|
-
print.spaced(["connectionKw", "connectionInfo"]),
|
|
19
|
-
print.spaced(["publicationKw", "publications"])
|
|
20
|
-
], (node.with ? [print.spaced(["with"])] : []), true)));
|
|
21
|
-
},
|
|
22
|
-
drop_subscription_stmt: function (print) {
|
|
23
|
-
return (0, print_utils_1.group)(print.spaced(["dropSubscriptionKw", "ifExistsKw", "name", "behaviorKw"]));
|
|
24
|
-
},
|
|
1
|
+
import { group, line, join } from "../print_utils";
|
|
2
|
+
export const subscriptionMap = {
|
|
3
|
+
create_subscription_stmt: (print, node) => group(join(line, [
|
|
4
|
+
print.spaced(["createSubscriptionKw", "name"]),
|
|
5
|
+
print.spaced(["connectionKw", "connectionInfo"]),
|
|
6
|
+
print.spaced(["publicationKw", "publications"]),
|
|
7
|
+
...(node.with ? [print.spaced(["with"])] : []),
|
|
8
|
+
])),
|
|
9
|
+
drop_subscription_stmt: (print) => group(print.spaced(["dropSubscriptionKw", "ifExistsKw", "name", "behaviorKw"])),
|
|
25
10
|
};
|