Add support for escaping single quote strings

This commit is contained in:
Justin Haug 2019-04-22 13:32:05 -04:00
parent 5b464e6b1a
commit 80dccf6885
3 changed files with 39 additions and 2 deletions

View file

@ -148,6 +148,23 @@ fn parse_projection_nested_type() {
//TODO: add assertions
}
#[test]
fn parse_escaped_single_quote_string_predicate() {
use self::ASTNode::*;
use self::SQLOperator::*;
let sql = "SELECT id, fname, lname FROM customer \
WHERE salary != 'Jim''s salary'";
let ast = verified_only_select(sql);
assert_eq!(
Some(SQLBinaryExpr {
left: Box::new(SQLIdentifier("salary".to_string())),
op: NotEq,
right: Box::new(SQLValue(Value::SingleQuotedString("Jim's salary".to_string())))
}),
ast.selection,
);
}
#[test]
fn parse_compound_expr_1() {
use self::ASTNode::*;