mirror of
https://github.com/RGBCube/serenity
synced 2025-07-10 04:07: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:
parent
9e225d2d05
commit
a5e28f2897
17 changed files with 95 additions and 94 deletions
|
@ -135,9 +135,9 @@ TEST_CASE(order_int_values)
|
|||
|
||||
TEST_CASE(tuple)
|
||||
{
|
||||
SQL::TupleDescriptor descriptor;
|
||||
descriptor.append({ "col1", SQL::SQLType::Text, SQL::Order::Ascending });
|
||||
descriptor.append({ "col2", SQL::SQLType::Integer, SQL::Order::Descending });
|
||||
NonnullRefPtr<SQL::TupleDescriptor> descriptor = adopt_ref(*new SQL::TupleDescriptor);
|
||||
descriptor->append({ "col1", SQL::SQLType::Text, SQL::Order::Ascending });
|
||||
descriptor->append({ "col2", SQL::SQLType::Integer, SQL::Order::Descending });
|
||||
SQL::Tuple tuple(descriptor);
|
||||
|
||||
tuple["col1"] = "Test";
|
||||
|
@ -148,9 +148,9 @@ TEST_CASE(tuple)
|
|||
|
||||
TEST_CASE(serialize_tuple)
|
||||
{
|
||||
SQL::TupleDescriptor descriptor;
|
||||
descriptor.append({ "col1", SQL::SQLType::Text, SQL::Order::Ascending });
|
||||
descriptor.append({ "col2", SQL::SQLType::Integer, SQL::Order::Descending });
|
||||
NonnullRefPtr<SQL::TupleDescriptor> descriptor = adopt_ref(*new SQL::TupleDescriptor);
|
||||
descriptor->append({ "col1", SQL::SQLType::Text, SQL::Order::Ascending });
|
||||
descriptor->append({ "col2", SQL::SQLType::Integer, SQL::Order::Descending });
|
||||
SQL::Tuple tuple(descriptor);
|
||||
|
||||
tuple["col1"] = "Test";
|
||||
|
@ -169,9 +169,9 @@ TEST_CASE(serialize_tuple)
|
|||
|
||||
TEST_CASE(copy_tuple)
|
||||
{
|
||||
SQL::TupleDescriptor descriptor;
|
||||
descriptor.append({ "col1", SQL::SQLType::Text, SQL::Order::Ascending });
|
||||
descriptor.append({ "col2", SQL::SQLType::Integer, SQL::Order::Descending });
|
||||
NonnullRefPtr<SQL::TupleDescriptor> descriptor = adopt_ref(*new SQL::TupleDescriptor);
|
||||
descriptor->append({ "col1", SQL::SQLType::Text, SQL::Order::Ascending });
|
||||
descriptor->append({ "col2", SQL::SQLType::Integer, SQL::Order::Descending });
|
||||
SQL::Tuple tuple(descriptor);
|
||||
|
||||
tuple["col1"] = "Test";
|
||||
|
@ -187,9 +187,9 @@ TEST_CASE(copy_tuple)
|
|||
|
||||
TEST_CASE(compare_tuples)
|
||||
{
|
||||
SQL::TupleDescriptor descriptor;
|
||||
descriptor.append({ "col1", SQL::SQLType::Text, SQL::Order::Ascending });
|
||||
descriptor.append({ "col2", SQL::SQLType::Integer, SQL::Order::Descending });
|
||||
NonnullRefPtr<SQL::TupleDescriptor> descriptor = adopt_ref(*new SQL::TupleDescriptor);
|
||||
descriptor->append({ "col1", SQL::SQLType::Text, SQL::Order::Ascending });
|
||||
descriptor->append({ "col2", SQL::SQLType::Integer, SQL::Order::Descending });
|
||||
|
||||
SQL::Tuple tuple1(descriptor);
|
||||
tuple1["col1"] = "Test";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue