Thanks to visit codestin.com
Credit goes to docs.rs

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(Debug, Default)]
23pub struct GenericDialect;
24
25impl Dialect for GenericDialect {
26    fn is_delimited_identifier_start(&self, ch: char) -> bool {
27        ch == '"' || ch == '`'
28    }
29
30    fn is_identifier_start(&self, ch: char) -> bool {
31        ch.is_alphabetic() || ch == '_' || ch == '#' || ch == '@'
32    }
33
34    fn is_identifier_part(&self, ch: char) -> bool {
35        ch.is_alphabetic()
36            || ch.is_ascii_digit()
37            || ch == '@'
38            || ch == '$'
39            || ch == '#'
40            || ch == '_'
41    }
42
43    fn supports_unicode_string_literal(&self) -> bool {
44        true
45    }
46
47    fn supports_group_by_expr(&self) -> bool {
48        true
49    }
50
51    fn supports_group_by_with_modifier(&self) -> bool {
52        true
53    }
54
55    fn supports_connect_by(&self) -> bool {
56        true
57    }
58
59    fn supports_match_recognize(&self) -> bool {
60        true
61    }
62
63    fn supports_start_transaction_modifier(&self) -> bool {
64        true
65    }
66
67    fn supports_window_function_null_treatment_arg(&self) -> bool {
68        true
69    }
70
71    fn supports_dictionary_syntax(&self) -> bool {
72        true
73    }
74
75    fn supports_window_clause_named_window_reference(&self) -> bool {
76        true
77    }
78
79    fn supports_parenthesized_set_variables(&self) -> bool {
80        true
81    }
82
83    fn supports_select_wildcard_except(&self) -> bool {
84        true
85    }
86
87    fn support_map_literal_syntax(&self) -> bool {
88        true
89    }
90
91    fn allow_extract_custom(&self) -> bool {
92        true
93    }
94
95    fn allow_extract_single_quotes(&self) -> bool {
96        true
97    }
98
99    fn supports_create_index_with_clause(&self) -> bool {
100        true
101    }
102
103    fn supports_explain_with_utility_options(&self) -> bool {
104        true
105    }
106
107    fn supports_limit_comma(&self) -> bool {
108        true
109    }
110
111    fn supports_asc_desc_in_column_definition(&self) -> bool {
112        true
113    }
114
115    fn supports_try_convert(&self) -> bool {
116        true
117    }
118
119    fn supports_comment_on(&self) -> bool {
120        true
121    }
122
123    fn supports_load_extension(&self) -> bool {
124        true
125    }
126
127    fn supports_named_fn_args_with_assignment_operator(&self) -> bool {
128        true
129    }
130
131    fn supports_struct_literal(&self) -> bool {
132        true
133    }
134
135    fn supports_empty_projections(&self) -> bool {
136        true
137    }
138
139    fn supports_nested_comments(&self) -> bool {
140        true
141    }
142
143    fn supports_user_host_grantee(&self) -> bool {
144        true
145    }
146
147    fn supports_string_escape_constant(&self) -> bool {
148        true
149    }
150
151    fn supports_array_typedef_with_brackets(&self) -> bool {
152        true
153    }
154
155    fn supports_match_against(&self) -> bool {
156        true
157    }
158
159    fn supports_set_names(&self) -> bool {
160        true
161    }
162
163    fn supports_comma_separated_set_assignments(&self) -> bool {
164        true
165    }
166
167    fn supports_filter_during_aggregation(&self) -> bool {
168        true
169    }
170}