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

LibSQL: Separate parsing of common-table-expression list

Statements like SELECT, INSERT, and UPDATE also optionally include this
list, so move its parsing out of parse_delete_statement(). Since it will
appear before the actual statement, parse it first in next_statement();
then only parse for statements that are allowed to include the list.
This commit is contained in:
Timothy Flynn 2021-04-21 17:12:06 -04:00 committed by Andreas Kling
parent 6a7d7624a7
commit 9331293e44
3 changed files with 46 additions and 21 deletions

View file

@ -54,6 +54,7 @@ TEST_CASE(create_table)
EXPECT(parse("CREATE TABLE test ( column1 varchar(.abc) )").is_error());
EXPECT(parse("CREATE TABLE test ( column1 varchar(0x) )").is_error());
EXPECT(parse("CREATE TABLE test ( column1 varchar(0xzzz) )").is_error());
EXPECT(parse("WITH table AS () CREATE TABLE test ( column1 );").is_error());
struct Column {
StringView name;
@ -118,6 +119,7 @@ TEST_CASE(drop_table)
EXPECT(parse("DROP TABLE").is_error());
EXPECT(parse("DROP TABLE test").is_error());
EXPECT(parse("DROP TABLE IF test;").is_error());
EXPECT(parse("WITH table AS () DROP TABLE test;").is_error());
auto validate = [](StringView sql, StringView expected_schema, StringView expected_table, bool expected_is_error_if_table_does_not_exist = true) {
auto result = parse(sql);