mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 02:13:56 +09:00
LibSQL: Move Order and Nulls enums from SQL::AST to SQL namespace
The Order enum is used in the Meta component of LibSQL. Using this enum meant having to include the monster AST/AST.h include file. Furthermore, they are sort of basic and therefore can live in the general SQL namespace. Moved to LibSQL/Type.h. Also introduced a new class, SQLResult, which is needed in future patches.
This commit is contained in:
parent
633dc74606
commit
30691549fd
Notes:
sideshowbarker
2024-07-18 10:04:43 +09:00
Author: https://github.com/JanDeVisser
Commit: 30691549fd
Pull-request: https://github.com/SerenityOS/serenity/pull/8306
Reviewed-by: https://github.com/MaxWipfli
Reviewed-by: https://github.com/alimpfard ✅
Reviewed-by: https://github.com/trflynn89 ✅
13 changed files with 205 additions and 52 deletions
|
@ -174,6 +174,15 @@ String Tuple::to_string() const
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
Vector<String> Tuple::to_string_vector() const
|
||||
{
|
||||
Vector<String> ret;
|
||||
for (auto& value : m_data) {
|
||||
ret.append(value.to_string().value());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t Tuple::size() const
|
||||
{
|
||||
size_t sz = sizeof(u32);
|
||||
|
@ -203,7 +212,7 @@ int Tuple::compare(const Tuple& other) const
|
|||
for (auto ix = 0u; ix < num_values; ix++) {
|
||||
auto ret = m_data[ix].compare(other.m_data[ix]);
|
||||
if (ret != 0) {
|
||||
if ((ix < m_descriptor.size()) && m_descriptor[ix].order == AST::Order::Descending)
|
||||
if ((ix < m_descriptor.size()) && m_descriptor[ix].order == Order::Descending)
|
||||
ret = -ret;
|
||||
return ret;
|
||||
}
|
||||
|
@ -223,7 +232,7 @@ int Tuple::match(const Tuple& other) const
|
|||
return -1;
|
||||
auto ret = m_data[my_index.value()].compare(other_value);
|
||||
if (ret != 0)
|
||||
return (m_descriptor[my_index.value()].order == AST::Order::Descending) ? -ret : ret;
|
||||
return (m_descriptor[my_index.value()].order == Order::Descending) ? -ret : ret;
|
||||
other_index++;
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue