diff options
author | Jan de Visser <jan@de-visser.net> | 2021-07-13 13:47:08 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-21 22:03:30 +0200 |
commit | a5e28f2897cf0b93084e964334bc59ac6fd695c1 (patch) | |
tree | 26a25611423903ce9fad77566623a1e8a16e1945 /Userland/Libraries/LibSQL/Key.h | |
parent | 9e225d2d05bbed76cd12004397105229c6f27708 (diff) | |
download | serenity-a5e28f2897cf0b93084e964334bc59ac6fd695c1.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibSQL/Key.h')
-rw-r--r-- | Userland/Libraries/LibSQL/Key.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Userland/Libraries/LibSQL/Key.h b/Userland/Libraries/LibSQL/Key.h index 7a3cb8beab..edc12a40b7 100644 --- a/Userland/Libraries/LibSQL/Key.h +++ b/Userland/Libraries/LibSQL/Key.h @@ -14,16 +14,17 @@ namespace SQL { class Key : public Tuple { public: - Key() = default; - explicit Key(TupleDescriptor const&); - explicit Key(RefPtr<IndexDef>); - Key(TupleDescriptor const&, ByteBuffer&, size_t& offset); + Key(); + explicit Key(NonnullRefPtr<TupleDescriptor> const&); + explicit Key(NonnullRefPtr<IndexDef>); + Key(NonnullRefPtr<TupleDescriptor> const&, ByteBuffer&, size_t& offset); Key(RefPtr<IndexDef>, ByteBuffer&, size_t& offset); + Key(Key const&) = default; RefPtr<IndexDef> index() const { return m_index; } [[nodiscard]] virtual size_t data_length() const override { return Tuple::data_length() + sizeof(u32); } private: - RefPtr<IndexDef> m_index; + RefPtr<IndexDef> m_index { nullptr }; }; } |