1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibSQL: Immediately commit database modifications (for now)

This ensures tables survive the database connection quitting. LibSQL
does not have transactional sessions yet, and probably won't for a
while, so let's just commit each modification as it comes.
This commit is contained in:
Timothy Flynn 2022-10-27 09:06:13 -04:00 committed by Linus Groh
parent 8f3c22718e
commit 17988bab75
2 changed files with 7 additions and 12 deletions

View file

@ -66,17 +66,7 @@ ErrorOr<void> Database::open()
return {};
}
Database::~Database()
{
// This crashes if the database can't commit. It's recommended to commit
// before the Database goes out of scope so the application can handle
// errors.
// Maybe we should enforce that by having a VERIFY here that there are no
// pending writes. But that's a new API on Heap so let's not do that right
// now.
if (is_open())
MUST(commit());
}
Database::~Database() = default;
ErrorOr<void> Database::commit()
{