ladybird/Userland/Libraries/LibSQL/AST/Statement.cpp
Timothy Flynn 17988bab75 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.
2022-11-30 11:43:13 +01:00

25 lines
581 B
C++

/*
* Copyright (c) 2021, Jan de Visser <jan@de-visser.net>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibSQL/AST/AST.h>
#include <LibSQL/Database.h>
#include <LibSQL/Meta.h>
#include <LibSQL/Row.h>
namespace SQL::AST {
ResultOr<ResultSet> Statement::execute(AK::NonnullRefPtr<Database> database) const
{
ExecutionContext context { move(database), this, nullptr };
auto result = TRY(execute(context));
// FIXME: When transactional sessions are supported, don't auto-commit modifications.
TRY(context.database->commit());
return result;
}
}