mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +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:
parent
9e225d2d05
commit
a5e28f2897
17 changed files with 95 additions and 94 deletions
|
@ -102,11 +102,11 @@ void IndexDef::append_column(String name, SQLType sql_type, Order sort_order)
|
|||
m_key_definition.append(part);
|
||||
}
|
||||
|
||||
TupleDescriptor IndexDef::to_tuple_descriptor() const
|
||||
NonnullRefPtr<TupleDescriptor> IndexDef::to_tuple_descriptor() const
|
||||
{
|
||||
TupleDescriptor ret;
|
||||
NonnullRefPtr<TupleDescriptor> ret = adopt_ref(*new TupleDescriptor);
|
||||
for (auto& part : m_key_definition) {
|
||||
ret.append({ part.name(), part.type(), part.sort_order() });
|
||||
ret->append({ part.name(), part.type(), part.sort_order() });
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -145,11 +145,11 @@ TableDef::TableDef(SchemaDef* schema, String name)
|
|||
{
|
||||
}
|
||||
|
||||
TupleDescriptor TableDef::to_tuple_descriptor() const
|
||||
NonnullRefPtr<TupleDescriptor> TableDef::to_tuple_descriptor() const
|
||||
{
|
||||
TupleDescriptor ret;
|
||||
NonnullRefPtr<TupleDescriptor> ret = adopt_ref(*new TupleDescriptor);
|
||||
for (auto& part : m_columns) {
|
||||
ret.append({ part.name(), part.type(), Order::Ascending });
|
||||
ret->append({ part.name(), part.type(), Order::Ascending });
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue