Skip to content

Commit

Permalink
fix nested string; add nested test
Browse files Browse the repository at this point in the history
  • Loading branch information
bearney74 committed Jun 6, 2022
1 parent 52bbf44 commit 043896b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/src/ast/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl ToSql for Expr {
Expr::Extract { field, expr } => {
format!(r#"EXTRACT({field} FROM "{}")"#, expr.to_sql())
}
Expr::Nested(expr) => format!("todo:Nested({})", expr.to_sql()),
Expr::Nested(expr) => format!("({})", expr.to_sql()),
Expr::Literal(s) => s.to_sql(),
Expr::TypedString { data_type, value } => format!("{data_type}(\"{value}\")"),
Expr::Case {
Expand Down Expand Up @@ -302,6 +302,11 @@ mod tests {
.to_sql()
);

assert_eq!(
"(id)",
Expr::Nested(Box::new(Expr::Identifier("id".to_owned()))).to_sql(),
);

assert_eq!(
"id BETWEEN low AND high",
Expr::Between {
Expand Down

0 comments on commit 043896b

Please sign in to comment.