mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 22:08:59 +00:00
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.
38 lines
755 B
C++
38 lines
755 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/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;
|
|
}
|
|
};
|
|
|
|
}
|