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

LibSQL: Rewrite the SQL::Value type to be contained within one class

Currently, the Value class is essentially a "pImpl" wrapper around the
ValueImpl hierarchy of classes. This is a bit difficult to follow and
reason about, as methods jump between the Value class and its impl
classes.

This changes the Variant held by Value to instead store the specified
types (String, int, etc.) directly. In doing so, the ValueImpl classes
are removed, and all methods are now just concise Variant visitors.

As part of this rewrite, support for the "array" type is dropped (or
rather, just not re-implemented) as it was unused. If it's needed in the
future, support can be re-added.

This does retain the ability for non-NULL types to store NULL values
(i.e. an empty Optional). I tried dropping this support as well, but it
is depended upon by the on-disk storage classes in non-trivial ways.
This commit is contained in:
Timothy Flynn 2022-09-21 13:48:02 -04:00 committed by Ali Mohammad Pur
parent 7d41b46a7d
commit 1524288127
7 changed files with 640 additions and 1409 deletions

View file

@ -54,7 +54,7 @@ ResultOr<ResultSet> Select::execute(ExecutionContext& context) const
Tuple tuple(descriptor);
Vector<Tuple> rows;
descriptor->empend("__unity__"sv);
tuple.append(Value(SQLType::Boolean, true));
tuple.append(Value { true });
rows.append(tuple);
for (auto& table_descriptor : table_or_subquery_list()) {