1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:38:10 +00: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:
Jan de Visser 2021-06-27 21:00:08 -04:00 committed by Ali Mohammad Pur
parent 633dc74606
commit 30691549fd
13 changed files with 205 additions and 52 deletions

View file

@ -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;