mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibSQL: Gracefully react to unimplemented valid SQL
Fixes a crash that was caused by a syntax error which is difficult to catch by the parser: usually identifiers are accepted in column lists, but they are not in a list of column values to be inserted in an INSERT. Fixed this by putting in a heuristic check; we probably need a better way to do this. Included tests for this case. Also introduced a new SQL Error code, `NotYetImplemented`, and return that instead of crashing when encountering unimplemented SQL.
This commit is contained in:
committed by
Ali Mohammad Pur
parent
001949d77a
commit
c369626ac1
Notes:
sideshowbarker
2024-07-17 23:11:28 +09:00
Author: https://github.com/JanDeVisser Commit: https://github.com/SerenityOS/serenity/commit/c369626ac19 Pull-request: https://github.com/SerenityOS/serenity/pull/10911 Issue: https://github.com/SerenityOS/serenity/issues/10667 Issue: https://github.com/SerenityOS/serenity/issues/10730 Reviewed-by: https://github.com/Dexesttp Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/timschumi Reviewed-by: https://github.com/trflynn89 ✅
@@ -169,6 +169,10 @@ Value UnaryOperatorExpression::evaluate(ExecutionContext& context) const
|
||||
|
||||
Value ColumnNameExpression::evaluate(ExecutionContext& context) const
|
||||
{
|
||||
if (!context.current_row) {
|
||||
context.result->set_error(SQLErrorCode::SyntaxError, column_name());
|
||||
return Value::null();
|
||||
}
|
||||
auto& descriptor = *context.current_row->descriptor();
|
||||
VERIFY(context.current_row->size() == descriptor.size());
|
||||
Optional<size_t> index_in_row;
|
||||
|
||||
Reference in New Issue
Block a user