Skip to content

Commit

Permalink
convert all table name to lowercase.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachelint committed Dec 2, 2022
1 parent 4fa8220 commit 06cb112
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions sql/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,14 @@ impl TableName {
pub fn is_empty(&self) -> bool {
self.0 .0.is_empty()
}

// Normalize an identifer to a lowercase string unless the identifier is quoted.
fn normalize_ident(id: &Ident) -> String {
match id.quote_style {
Some(_) => id.value.clone(),
None => id.value.to_ascii_lowercase(),
}
}
}

impl ToString for TableName {
fn to_string(&self) -> String {
self.0
.0
.iter()
.map(Self::normalize_ident)
.map(|id| id.value.to_ascii_lowercase())
.collect::<Vec<_>>()
.join(".")
}
Expand Down

0 comments on commit 06cb112

Please sign in to comment.