mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
LibSQL: Do not crash when SELECTing from an empty table
The crash was caused by getting the first element of an empty vector.
This commit is contained in:
parent
373b467302
commit
f1f0770d68
2 changed files with 13 additions and 2 deletions
|
@ -177,6 +177,17 @@ TEST_CASE(insert_without_column_names)
|
|||
EXPECT_EQ(rows_or_error.value().size(), 2u);
|
||||
}
|
||||
|
||||
TEST_CASE(select_from_empty_table)
|
||||
{
|
||||
ScopeGuard guard([]() { unlink(db_name); });
|
||||
auto database = SQL::Database::construct(db_name);
|
||||
EXPECT(!database->open().is_error());
|
||||
create_table(database);
|
||||
auto result = execute(database, "SELECT * FROM TestSchema.TestTable;");
|
||||
EXPECT(!result.is_error());
|
||||
EXPECT(!result.has_results());
|
||||
}
|
||||
|
||||
TEST_CASE(select_from_table)
|
||||
{
|
||||
ScopeGuard guard([]() { unlink(db_name); });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue