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

LibSQL: Add better error handling to evaluate and execute methods

There was a lot of `VERIFY_NOT_REACHED` error handling going on. Fixed
most of those.

A bit of a caveat is that after every `evaluate` call for expressions
that are part of a statement the error status of the `SQLResult` return
value must be called.
This commit is contained in:
Jan de Visser 2021-10-23 10:46:33 -04:00 committed by Andreas Kling
parent 0cfb5eec32
commit 9022cf99ff
5 changed files with 125 additions and 55 deletions

View file

@ -39,12 +39,16 @@ RefPtr<SQLResult> Select::execute(ExecutionContext& context) const
context.current_row = &row;
if (where_clause()) {
auto where_result = where_clause()->evaluate(context);
if (context.result->has_error())
return context.result;
if (!where_result)
continue;
}
tuple.clear();
for (auto& col : columns) {
auto value = col.expression()->evaluate(context);
if (context.result->has_error())
return context.result;
tuple.append(value);
}
context.result->append(tuple);