File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -30,4 +30,8 @@ impl Dialect for MySqlDialect {
30
30
fn is_identifier_part ( & self , ch : char ) -> bool {
31
31
self . is_identifier_start ( ch) || ( ch >= '0' && ch <= '9' )
32
32
}
33
+
34
+ fn is_delimited_identifier_start ( & self , ch : char ) -> bool {
35
+ ch == '`'
36
+ }
33
37
}
Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ fn parse_create_table_auto_increment() {
106
106
assert_eq ! ( name. to_string( ) , "foo" ) ;
107
107
assert_eq ! (
108
108
vec![ ColumnDef {
109
- name: "bar" . into ( ) ,
109
+ name: Ident :: new ( "bar" ) ,
110
110
data_type: DataType :: Int ,
111
111
collation: None ,
112
112
options: vec![
@@ -129,6 +129,29 @@ fn parse_create_table_auto_increment() {
129
129
}
130
130
}
131
131
132
+ #[ test]
133
+ fn parse_quote_identifiers ( ) {
134
+ let sql = "CREATE TABLE `PRIMARY` (`BEGIN` INT PRIMARY KEY)" ;
135
+ match mysql ( ) . verified_stmt ( sql) {
136
+ Statement :: CreateTable { name, columns, .. } => {
137
+ assert_eq ! ( name. to_string( ) , "`PRIMARY`" ) ;
138
+ assert_eq ! (
139
+ vec![ ColumnDef {
140
+ name: Ident :: with_quote( '`' , "BEGIN" ) ,
141
+ data_type: DataType :: Int ,
142
+ collation: None ,
143
+ options: vec![ ColumnOptionDef {
144
+ name: None ,
145
+ option: ColumnOption :: Unique { is_primary: true }
146
+ } ] ,
147
+ } ] ,
148
+ columns
149
+ ) ;
150
+ }
151
+ _ => unreachable ! ( ) ,
152
+ }
153
+ }
154
+
132
155
fn mysql ( ) -> TestedDialects {
133
156
TestedDialects {
134
157
dialects : vec ! [ Box :: new( MySqlDialect { } ) ] ,
You can’t perform that action at this time.
0 commit comments