Skip to main content

sqlparser/dialect/
generic.rs

1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18use crate::dialect::Dialect;
19
20/// A permissive, general purpose [`Dialect`], which parses a wide variety of SQL
21/// statements, from many different dialects.
22#[derive(#[automatically_derived]
impl ::core::fmt::Debug for GenericDialect {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::write_str(f, "GenericDialect")
    }
}Debug, #[automatically_derived]
impl ::core::default::Default for GenericDialect {
    #[inline]
    fn default() -> GenericDialect { GenericDialect {} }
}Default, #[automatically_derived]
impl ::core::clone::Clone for GenericDialect {
    #[inline]
    fn clone(&self) -> GenericDialect { *self }
}Clone, #[automatically_derived]
impl ::core::marker::Copy for GenericDialect { }Copy, #[automatically_derived]
impl ::core::cmp::PartialEq for GenericDialect {
    #[inline]
    fn eq(&self, other: &GenericDialect) -> bool { true }
}PartialEq, #[automatically_derived]
impl ::core::cmp::Eq for GenericDialect {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {}
}Eq, #[automatically_derived]
impl ::core::hash::Hash for GenericDialect {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {}
}Hash, #[automatically_derived]
impl ::core::cmp::PartialOrd for GenericDialect {
    #[inline]
    fn partial_cmp(&self, other: &GenericDialect)
        -> ::core::option::Option<::core::cmp::Ordering> {
        ::core::option::Option::Some(::core::cmp::Ordering::Equal)
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Ord for GenericDialect {
    #[inline]
    fn cmp(&self, other: &GenericDialect) -> ::core::cmp::Ordering {
        ::core::cmp::Ordering::Equal
    }
}Ord)]
23#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
24pub struct GenericDialect;
25
26impl Dialect for GenericDialect {
27    fn is_delimited_identifier_start(&self, ch: char) -> bool {
28        ch == '"' || ch == '`'
29    }
30
31    fn is_identifier_start(&self, ch: char) -> bool {
32        ch.is_alphabetic() || ch == '_' || ch == '#' || ch == '@'
33    }
34
35    fn is_identifier_part(&self, ch: char) -> bool {
36        ch.is_alphabetic()
37            || ch.is_ascii_digit()
38            || ch == '@'
39            || ch == '$'
40            || ch == '#'
41            || ch == '_'
42    }
43
44    fn supports_unicode_string_literal(&self) -> bool {
45        true
46    }
47
48    fn supports_group_by_expr(&self) -> bool {
49        true
50    }
51
52    fn supports_group_by_with_modifier(&self) -> bool {
53        true
54    }
55
56    fn supports_left_associative_joins_without_parens(&self) -> bool {
57        true
58    }
59
60    fn supports_connect_by(&self) -> bool {
61        true
62    }
63
64    fn supports_match_recognize(&self) -> bool {
65        true
66    }
67
68    fn supports_pipe_operator(&self) -> bool {
69        true
70    }
71
72    fn supports_start_transaction_modifier(&self) -> bool {
73        true
74    }
75
76    fn supports_window_function_null_treatment_arg(&self) -> bool {
77        true
78    }
79
80    fn supports_dictionary_syntax(&self) -> bool {
81        true
82    }
83
84    fn supports_window_clause_named_window_reference(&self) -> bool {
85        true
86    }
87
88    fn supports_parenthesized_set_variables(&self) -> bool {
89        true
90    }
91
92    fn supports_select_wildcard_except(&self) -> bool {
93        true
94    }
95
96    fn support_map_literal_syntax(&self) -> bool {
97        true
98    }
99
100    fn allow_extract_custom(&self) -> bool {
101        true
102    }
103
104    fn allow_extract_single_quotes(&self) -> bool {
105        true
106    }
107
108    fn supports_extract_comma_syntax(&self) -> bool {
109        true
110    }
111
112    fn supports_create_view_comment_syntax(&self) -> bool {
113        true
114    }
115
116    fn supports_parens_around_table_factor(&self) -> bool {
117        true
118    }
119
120    fn supports_values_as_table_factor(&self) -> bool {
121        true
122    }
123
124    fn supports_create_index_with_clause(&self) -> bool {
125        true
126    }
127
128    fn supports_explain_with_utility_options(&self) -> bool {
129        true
130    }
131
132    fn supports_limit_comma(&self) -> bool {
133        true
134    }
135
136    fn supports_from_first_select(&self) -> bool {
137        true
138    }
139
140    fn supports_projection_trailing_commas(&self) -> bool {
141        true
142    }
143
144    fn supports_asc_desc_in_column_definition(&self) -> bool {
145        true
146    }
147
148    fn supports_try_convert(&self) -> bool {
149        true
150    }
151
152    fn supports_bitwise_shift_operators(&self) -> bool {
153        true
154    }
155
156    fn supports_comment_on(&self) -> bool {
157        true
158    }
159
160    fn supports_load_extension(&self) -> bool {
161        true
162    }
163
164    fn supports_named_fn_args_with_assignment_operator(&self) -> bool {
165        true
166    }
167
168    fn supports_struct_literal(&self) -> bool {
169        true
170    }
171
172    fn supports_empty_projections(&self) -> bool {
173        true
174    }
175
176    fn supports_nested_comments(&self) -> bool {
177        true
178    }
179
180    fn supports_multiline_comment_hints(&self) -> bool {
181        true
182    }
183
184    fn supports_user_host_grantee(&self) -> bool {
185        true
186    }
187
188    fn supports_string_escape_constant(&self) -> bool {
189        true
190    }
191
192    fn supports_array_typedef_with_brackets(&self) -> bool {
193        true
194    }
195
196    fn supports_match_against(&self) -> bool {
197        true
198    }
199
200    fn supports_set_names(&self) -> bool {
201        true
202    }
203
204    fn supports_comma_separated_set_assignments(&self) -> bool {
205        true
206    }
207
208    fn supports_filter_during_aggregation(&self) -> bool {
209        true
210    }
211
212    fn supports_select_wildcard_exclude(&self) -> bool {
213        true
214    }
215
216    fn supports_data_type_signed_suffix(&self) -> bool {
217        true
218    }
219
220    fn supports_interval_options(&self) -> bool {
221        true
222    }
223
224    fn supports_quote_delimited_string(&self) -> bool {
225        true
226    }
227
228    fn supports_lambda_functions(&self) -> bool {
229        true
230    }
231
232    fn supports_select_wildcard_replace(&self) -> bool {
233        true
234    }
235
236    fn supports_select_wildcard_ilike(&self) -> bool {
237        true
238    }
239
240    fn supports_select_wildcard_rename(&self) -> bool {
241        true
242    }
243
244    fn supports_optimize_table(&self) -> bool {
245        true
246    }
247
248    fn supports_install(&self) -> bool {
249        true
250    }
251
252    fn supports_detach(&self) -> bool {
253        true
254    }
255
256    fn supports_prewhere(&self) -> bool {
257        true
258    }
259
260    fn supports_with_fill(&self) -> bool {
261        true
262    }
263
264    fn supports_limit_by(&self) -> bool {
265        true
266    }
267
268    fn supports_interpolate(&self) -> bool {
269        true
270    }
271
272    fn supports_settings(&self) -> bool {
273        true
274    }
275
276    fn supports_select_format(&self) -> bool {
277        true
278    }
279
280    fn supports_comment_optimizer_hint(&self) -> bool {
281        true
282    }
283
284    fn supports_constraint_keyword_without_name(&self) -> bool {
285        true
286    }
287}