mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-11-06 08:10:58 +00:00
40 lines
779 B
C
40 lines
779 B
C
|
|
/*
|
||
|
|
* Copyright (c) 2021, Jan de Visser <jan@de-visser.net>
|
||
|
|
*
|
||
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
||
|
|
*/
|
||
|
|
|
||
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <AK/Vector.h>
|
||
|
|
#include <LibSQL/AST.h>
|
||
|
|
#include <LibSQL/Type.h>
|
||
|
|
|
||
|
|
namespace SQL {
|
||
|
|
|
||
|
|
struct TupleElement {
|
||
|
|
String name { "" };
|
||
|
|
SQLType type { SQLType::Text };
|
||
|
|
Order order { Order::Ascending };
|
||
|
|
|
||
|
|
bool operator==(TupleElement const&) const = default;
|
||
|
|
};
|
||
|
|
|
||
|
|
class TupleDescriptor : public Vector<TupleElement> {
|
||
|
|
public:
|
||
|
|
TupleDescriptor() = default;
|
||
|
|
TupleDescriptor(TupleDescriptor const&) = default;
|
||
|
|
~TupleDescriptor() = default;
|
||
|
|
|
||
|
|
[[nodiscard]] size_t data_length() const
|
||
|
|
{
|
||
|
|
size_t sz = sizeof(u32);
|
||
|
|
for (auto& part : *this) {
|
||
|
|
sz += size_of(part.type);
|
||
|
|
}
|
||
|
|
return sz;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
}
|