ladybird/Tests/LibSQL
Jan de Visser b74721e604 LibSQL: Redesign Value implementation and add new types
The implemtation of the Value class was based on lambda member variables
implementing type-dependent behaviour. This was done to ensure that
Values can be used as stack-only objects; the simplest alternative,
virtual methods, forces them onto the heap. The problem with the the
lambda approach is that it bloats the Values (which are supposed to be
lightweight objects) quite considerably, because every object contains
more than a dozen function pointers.

The solution to address both problems (we want Values to be able to live
on the stack and be as lightweight as possible) chosen here is to
encapsulate type-dependent behaviour and state in an implementation
class, and let the Value be an AK::Variant of those implementation
classes. All methods of Value are now basically straight delegates to
the implementation object using the Variant::visit method.

One issue complicating matters is the addition of two aggregate types,
Tuple and Array, which each contain a Vector of Values. At this point
Tuples and Arrays (and potential future aggregate types) can't contain
these aggregate types. This is limiting and needs to be addressed.

Another area that needs attention is the nomenclature of things; it's
a bit of a tangle of 'ValueBlahBlah' and 'ImplBlahBlah'. It makes sense
right now I think but admit we probably can do better.

Other things included here:
- Added the Boolean and Null types (and Tuple and Array, see above).
- to_string now always succeeds and returns a String instead of an
  Optional. This had some impact on other sources.
- Added a lot of tests.
- Started moving the serialization mechanism more towards where I want
  it to be, i.e. a 'DataSerializer' object which just takes
  serialization and deserialization requests and knows for example how
  to store long strings out-of-line.

One last remark: There is obviously a naming clash between the Tuple
class and the Tuple Value type. This is intentional; I plan to make the
Tuple class a subclass of Value (and hence Key and Row as well).
2021-08-21 22:03:30 +02:00
..
CMakeLists.txt LibSQL+SQLServer: Build SQLServer system service 2021-07-08 17:55:59 +04:30
TestSqlBtreeIndex.cpp LibSQL: Make TupleDescriptor a shared pointer instead of a stack object 2021-08-21 22:03:30 +02:00
TestSqlDatabase.cpp LibSQL: Redesign Value implementation and add new types 2021-08-21 22:03:30 +02:00
TestSqlExpressionParser.cpp LibSQL: Make lexer and parser more standard SQL compliant 2021-06-24 00:36:53 +02:00
TestSqlHashIndex.cpp LibSQL: Make TupleDescriptor a shared pointer instead of a stack object 2021-08-21 22:03:30 +02:00
TestSqlStatementParser.cpp LibSQL: Move Order and Nulls enums from SQL::AST to SQL namespace 2021-07-08 17:55:59 +04:30
TestSqlValueAndTuple.cpp LibSQL: Redesign Value implementation and add new types 2021-08-21 22:03:30 +02:00