Add support for == operator for Sqlite (#970)

This commit is contained in:
Ilya 2023-09-20 04:31:11 +03:00 committed by GitHub
parent f6e4be4c15
commit 71c35d4dfd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -885,6 +885,7 @@ impl<'a> Tokenizer<'a> {
chars.next(); // consume
match chars.peek() {
Some('>') => self.consume_and_return(chars, Token::RArrow),
Some('=') => self.consume_and_return(chars, Token::DoubleEq),
_ => Ok(Some(Token::Eq)),
}
}

View file

@ -61,6 +61,14 @@ fn parse_create_virtual_table() {
sqlite_and_generic().verified_stmt(sql);
}
#[test]
fn double_equality_operator() {
// Sqlite supports this operator: https://www.sqlite.org/lang_expr.html#binaryops
let input = "SELECT a==b FROM t";
let expected = "SELECT a = b FROM t";
let _ = sqlite_and_generic().one_statement_parses_to(input, expected);
}
#[test]
fn parse_create_table_auto_increment() {
let sql = "CREATE TABLE foo (bar INT PRIMARY KEY AUTOINCREMENT)";