serenity/Userland/Libraries/LibSQL/Key.cpp
Jan de Visser 224804b424 LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer
Unfortunately this patch is quite large.

The main functionality included are a BTree index implementation and
the Heap class which manages persistent storage.

Also included are a Key subclass of the Tuple class, which is a
specialization for index key tuples. This "dragged in" the Meta layer,
which has classes defining SQL objects like tables and indexes.
2021-06-19 22:06:45 +02:00

39 lines
654 B
C++

/*
* Copyright (c) 2021, Jan de Visser <jan@de-visser.net>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibSQL/Key.h>
#include <LibSQL/Meta.h>
namespace SQL {
Key::Key()
: Tuple()
{
}
Key::Key(TupleDescriptor const& descriptor)
: Tuple(descriptor)
{
}
Key::Key(RefPtr<IndexDef> index)
: Tuple(index->to_tuple_descriptor())
, m_index(index)
{
}
Key::Key(TupleDescriptor const& descriptor, ByteBuffer& buffer, size_t& offset)
: Tuple(descriptor, buffer, offset)
{
}
Key::Key(RefPtr<IndexDef> index, ByteBuffer& buffer, size_t& offset)
: Key(index->to_tuple_descriptor())
{
deserialize(buffer, offset);
}
}