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:
parent
c2c47fb9bb
commit
7ea54db430
Notes:
sideshowbarker
2024-07-18 01:19:19 +09:00
Author: https://github.com/JanDeVisser
Commit: 7ea54db430
Pull-request: https://github.com/SerenityOS/serenity/pull/10770
Reviewed-by: https://github.com/trflynn89 ✅
7 changed files with 27 additions and 25 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
namespace SQL {
|
||||
|
||||
struct TupleElementDescriptor {
|
||||
String schema { "" };
|
||||
String table { "" };
|
||||
String name { "" };
|
||||
SQLType type { SQLType::Text };
|
||||
Order order { Order::Ascending };
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -130,7 +130,7 @@ public:
|
|||
|
||||
[[nodiscard]] TupleElementDescriptor descriptor() const
|
||||
{
|
||||
return { "", type(), Order::Ascending };
|
||||
return { "", "", "", type(), Order::Ascending };
|
||||
}
|
||||
|
||||
static Value const& null();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue