Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
andicuko committed Mar 28, 2024
1 parent 23997f3 commit 2106d2a
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions src/sql/relation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,10 +776,9 @@ fn last(columns: &Hierarchy<Identifier>) -> Hierarchy<Identifier> {
.collect()
}

/// If the identifier is quoted we keep its name as it is
/// If it is unquoted we keep the lowercase name during parsing.
/// This allows us to quote any identifier when rendering the relation
/// to a query
/// Returns the identifier value. If it is quoted it returns its value
/// as it is whereas if unquoted it returns the lowercase value.
/// Used to create relations field's name.
fn lower_case_unquoted_ident(ident: &ast::Ident) -> String {
if let Some(_) = ident.quote_style {
ident.value.clone()
Expand Down Expand Up @@ -1591,27 +1590,6 @@ mod tests {
let mut database = postgresql::test_database();
let relations = database.relations();

let query_str = r#"
SELECT *
FROM table_2 AS t1 INNER JOIN table_2 AS t2 USING(x) INNER JOIN table_2 AS t3 USING(x)
WHERE x > 50
ORDER BY x, t2.y, t2.z
"#;
let query = parse(query_str).unwrap();
let relation = Relation::try_from(QueryWithRelations::new(
&query,
&relations
))
.unwrap();
relation.display_dot().unwrap();
let query: &str = &ast::Query::from(&relation).to_string();
println!("{query}");
_ = database
.query(query)
.unwrap()
.iter()
.map(ToString::to_string);

let query_str = r#"
SELECT *
FROM table_2 AS t1 INNER JOIN table_2 AS t2 USING(x) INNER JOIN table_2 AS t3 USING(x)
Expand Down

0 comments on commit 2106d2a

Please sign in to comment.