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:
parent
0cfb5eec32
commit
9022cf99ff
5 changed files with 125 additions and 55 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue