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

LibSQL: Add current statement to the ExecutionContext

Because SQL is the craptastic language that it is, sometimes expressions
need to know details about the calling statement. For example the tables
in the 'FROM' clause may be needed to determine which columns are
referenced in 'WHERE' expressions. So the current statement is added
to the ExecutionContext and a new 'execute' overload on Statement is
created which takes the Database and the Statement and builds an
ExecutionContaxt from those.
This commit is contained in:
Jan de Visser 2021-11-02 16:43:57 -04:00 committed by Andreas Kling
parent 7ea54db430
commit 1c50e9aadc
5 changed files with 25 additions and 4 deletions

View file

@ -0,0 +1,20 @@
/*
* 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 {
RefPtr<SQLResult> Statement::execute(AK::NonnullRefPtr<Database> database) const
{
ExecutionContext context { move(database), nullptr, this, nullptr };
return execute(context);
}
}