2021-11-02 16:43:57 -04:00
|
|
|
/*
|
|
|
|
|
* 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 {
|
|
|
|
|
|
2022-02-10 14:43:00 -05:00
|
|
|
ResultOr<ResultSet> Statement::execute(AK::NonnullRefPtr<Database> database) const
|
2021-11-02 16:43:57 -04:00
|
|
|
{
|
2022-02-10 14:53:51 -05:00
|
|
|
ExecutionContext context { move(database), this, nullptr };
|
2022-10-27 09:06:13 -04:00
|
|
|
auto result = TRY(execute(context));
|
|
|
|
|
|
|
|
|
|
// FIXME: When transactional sessions are supported, don't auto-commit modifications.
|
|
|
|
|
TRY(context.database->commit());
|
|
|
|
|
|
|
|
|
|
return result;
|
2021-11-02 16:43:57 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|