1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:27:35 +00:00

LibSQL: Make TupleDescriptor a shared pointer instead of a stack object

Tuple descriptors are basically the same for for example all rows in
a table. Makes sense to share them instead of copying them for every
single row.
This commit is contained in:
Jan de Visser 2021-07-13 13:47:08 -04:00 committed by Andreas Kling
parent 9e225d2d05
commit a5e28f2897
17 changed files with 95 additions and 94 deletions

View file

@ -37,14 +37,14 @@ class Index : public Core::Object {
public:
~Index() override = default;
TupleDescriptor descriptor() const { return m_descriptor; }
NonnullRefPtr<TupleDescriptor> descriptor() const { return m_descriptor; }
[[nodiscard]] bool duplicates_allowed() const { return !m_unique; }
[[nodiscard]] bool unique() const { return m_unique; }
[[nodiscard]] u32 pointer() const { return m_pointer; }
protected:
Index(Heap& heap, TupleDescriptor const&, bool unique, u32 pointer);
Index(Heap& heap, TupleDescriptor const&, u32 pointer);
Index(Heap& heap, NonnullRefPtr<TupleDescriptor> const&, bool unique, u32 pointer);
Index(Heap& heap, NonnullRefPtr<TupleDescriptor> const&, u32 pointer);
[[nodiscard]] Heap const& heap() const { return m_heap; }
[[nodiscard]] Heap& heap() { return m_heap; }
@ -55,7 +55,7 @@ protected:
private:
Heap& m_heap;
TupleDescriptor m_descriptor;
NonnullRefPtr<TupleDescriptor> m_descriptor;
bool m_unique { false };
u32 m_pointer { 0 };
};