1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +00:00

LibSQL: Handle statements with malformed exists expressions correctly

Previously, statements containing malformed exists expressions such as:

`INSERT INTO t(a) VALUES (SELECT 1)`;

could cause the parser to crash. The parser will now return an error
message instead.
This commit is contained in:
Tim Ledbetter 2023-04-12 23:47:00 +01:00 committed by Tim Flynn
parent 880878e552
commit 896d1e4f42
3 changed files with 75 additions and 20 deletions

View file

@ -77,10 +77,10 @@ private:
RefPtr<Expression> parse_column_name_expression(DeprecatedString with_parsed_identifier = {}, bool with_parsed_period = false);
RefPtr<Expression> parse_unary_operator_expression();
RefPtr<Expression> parse_binary_operator_expression(NonnullRefPtr<Expression> lhs);
RefPtr<Expression> parse_chained_expression();
RefPtr<Expression> parse_chained_expression(bool surrounded_by_parentheses = true);
RefPtr<Expression> parse_cast_expression();
RefPtr<Expression> parse_case_expression();
RefPtr<Expression> parse_exists_expression(bool invert_expression, TokenType opening_token = TokenType::Exists);
RefPtr<Expression> parse_exists_expression(bool invert_expression);
RefPtr<Expression> parse_collate_expression(NonnullRefPtr<Expression> expression);
RefPtr<Expression> parse_is_expression(NonnullRefPtr<Expression> expression);
RefPtr<Expression> parse_match_expression(NonnullRefPtr<Expression> lhs, bool invert_expression);