mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 18:32:28 -05:00
224804b424
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.
39 lines
654 B
C++
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);
|
|
}
|
|
|
|
}
|