mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 11:37:16 +02: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:
committed by
Andreas Kling
parent
0cfb5eec32
commit
9022cf99ff
Notes:
sideshowbarker
2024-07-18 01:54:09 +09:00
Author: https://github.com/JanDeVisser Commit: https://github.com/SerenityOS/serenity/commit/9022cf99ffd Pull-request: https://github.com/SerenityOS/serenity/pull/10598 Reviewed-by: https://github.com/trflynn89 ✅
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user