1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibSQL: Add 'schema' and 'table' to TupleElementDescriptor

These are needed to distinguish columns from different tables with the
same column name in one and the same (joined) Tuple. Not quite happy
yet with this API; I think some sort of hierarchical structure would be
better but we'll burn that bridge when we get there :^)
This commit is contained in:
Jan de Visser 2021-11-02 16:39:00 -04:00 committed by Andreas Kling
parent c2c47fb9bb
commit 7ea54db430
Notes: sideshowbarker 2024-07-18 01:19:19 +09:00
7 changed files with 27 additions and 25 deletions

View file

@ -118,7 +118,7 @@ NonnullRefPtr<TupleDescriptor> IndexDef::to_tuple_descriptor() const
{
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;
}
@ -161,7 +161,7 @@ NonnullRefPtr<TupleDescriptor> TableDef::to_tuple_descriptor() const
{
NonnullRefPtr<TupleDescriptor> ret = adopt_ref(*new TupleDescriptor);
for (auto& part : m_columns) {
ret->append({ part.name(), part.type(), Order::Ascending });
ret->append({ parent()->name(), name(), part.name(), part.type(), Order::Ascending });
}
return ret;
}

View file

@ -13,6 +13,8 @@
namespace SQL {
struct TupleElementDescriptor {
String schema { "" };
String table { "" };
String name { "" };
SQLType type { SQLType::Text };
Order order { Order::Ascending };

View file

@ -1014,7 +1014,7 @@ void TupleImpl::infer_descriptor()
void TupleImpl::extend_descriptor(Value const& value)
{
VERIFY(m_descriptor_inferred);
m_descriptor->empend("", value.type(), Order::Ascending);
m_descriptor->empend("", "", "", value.type(), Order::Ascending);
}
bool TupleImpl::validate_before_assignment(Vector<Value> const& values)

View file

@ -130,7 +130,7 @@ public:
[[nodiscard]] TupleElementDescriptor descriptor() const
{
return { "", type(), Order::Ascending };
return { "", "", "", type(), Order::Ascending };
}
static Value const& null();