1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:18:11 +00:00
serenity/Userland/Libraries/LibSQL/AST
Timothy Flynn 2397836f8e LibSQL+SQLServer: Introduce and use ResultOr<ValueType>
The result of a SQL statement execution is either:
    1. An error.
    2. The list of rows inserted, deleted, selected, etc.

(2) is currently represented by a combination of the Result class and
the ResultSet list it holds. This worked okay, but issues start to
arise when trying to use Result in non-statement contexts (for example,
when introducing Result to SQL expression execution).

What we really need is for Result to be a thin wrapper that represents
both (1) and (2), and to not have any explicit members like a ResultSet.
So this commit removes ResultSet from Result, and introduces ResultOr,
which is just an alias for AK::ErrorOrr. Statement execution now returns
ResultOr<ResultSet> instead of Result. This further opens the door for
expression execution to return ResultOr<Value> in the future.

Lastly, this moves some other context held by Result over to ResultSet.
This includes the row count (which is really just the size of ResultSet)
and the command for which the result is for.
2022-02-10 23:11:13 +01:00
..
AST.h LibSQL+SQLServer: Introduce and use ResultOr<ValueType> 2022-02-10 23:11:13 +01:00
CreateSchema.cpp LibSQL+SQLServer: Introduce and use ResultOr<ValueType> 2022-02-10 23:11:13 +01:00
CreateTable.cpp LibSQL+SQLServer: Introduce and use ResultOr<ValueType> 2022-02-10 23:11:13 +01:00
Describe.cpp LibSQL+SQLServer: Introduce and use ResultOr<ValueType> 2022-02-10 23:11:13 +01:00
Expression.cpp LibSQL+SQLServer: Return the new Result class from statement executions 2022-02-10 12:20:35 +00:00
Insert.cpp LibSQL+SQLServer: Introduce and use ResultOr<ValueType> 2022-02-10 23:11:13 +01:00
Lexer.cpp Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
Lexer.h Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
Parser.cpp LibSQL: Update list of expected statements 2022-02-09 15:35:37 +00:00
Parser.h LibSQL: Implement a DESCRIBE TABLE statement 2022-02-05 00:35:03 +01:00
Select.cpp LibSQL+SQLServer: Introduce and use ResultOr<ValueType> 2022-02-10 23:11:13 +01:00
Statement.cpp LibSQL+SQLServer: Introduce and use ResultOr<ValueType> 2022-02-10 23:11:13 +01:00
SyntaxHighlighter.cpp LibSQL: Make lexer and parser more standard SQL compliant 2021-06-24 00:36:53 +02:00
SyntaxHighlighter.h LibSQL: Move Lexer and Parser machinery to AST directory 2021-06-24 00:36:53 +02:00
Token.cpp Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
Token.h LibSQL: Implement a DESCRIBE TABLE statement 2022-02-05 00:35:03 +01:00