mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28:11 +00:00
LibSQL: Remove unnecessary values from the ENUMERATE_SQL_TYPES macro
Removing the bitmask-esque values from the enumeration necessitates a Heap version bump.
This commit is contained in:
parent
b5fd96b7ac
commit
264db4fc40
3 changed files with 16 additions and 27 deletions
|
@ -33,7 +33,7 @@ class Heap : public Core::Object {
|
|||
C_OBJECT(Heap);
|
||||
|
||||
public:
|
||||
static constexpr inline u32 current_version = 1;
|
||||
static constexpr inline u32 current_version = 2;
|
||||
|
||||
virtual ~Heap() override;
|
||||
|
||||
|
|
|
@ -12,17 +12,20 @@
|
|||
|
||||
namespace SQL {
|
||||
|
||||
#define ENUMERATE_SQL_TYPES(S) \
|
||||
S("null", 1, Null, int, sizeof(int)) \
|
||||
S("text", 2, Text, DeprecatedString, 65 + sizeof(u32)) \
|
||||
S("int", 4, Integer, int, sizeof(int)) \
|
||||
S("float", 8, Float, double, sizeof(double)) \
|
||||
S("bool", 16, Boolean, bool, sizeof(bool)) \
|
||||
S("tuple", 32, Tuple, int, sizeof(int))
|
||||
// Adding to this list is fine, but changing the order of any value here will result in LibSQL
|
||||
// becoming unable to read existing .db files. If the order must absolutely be changed, be sure
|
||||
// to bump Heap::current_version.
|
||||
#define ENUMERATE_SQL_TYPES(S) \
|
||||
S("null", Null) \
|
||||
S("text", Text) \
|
||||
S("int", Integer) \
|
||||
S("float", Float) \
|
||||
S("bool", Boolean) \
|
||||
S("tuple", Tuple)
|
||||
|
||||
enum class SQLType {
|
||||
#undef __ENUMERATE_SQL_TYPE
|
||||
#define __ENUMERATE_SQL_TYPE(name, cardinal, type, impl, size) type = cardinal,
|
||||
#define __ENUMERATE_SQL_TYPE(name, type) type,
|
||||
ENUMERATE_SQL_TYPES(__ENUMERATE_SQL_TYPE)
|
||||
#undef __ENUMERATE_SQL_TYPE
|
||||
};
|
||||
|
@ -31,8 +34,8 @@ constexpr StringView SQLType_name(SQLType t)
|
|||
{
|
||||
switch (t) {
|
||||
#undef __ENUMERATE_SQL_TYPE
|
||||
#define __ENUMERATE_SQL_TYPE(name, cardinal, type, impl, size) \
|
||||
case SQLType::type: \
|
||||
#define __ENUMERATE_SQL_TYPE(name, type) \
|
||||
case SQLType::type: \
|
||||
return name##sv;
|
||||
ENUMERATE_SQL_TYPES(__ENUMERATE_SQL_TYPE)
|
||||
#undef __ENUMERATE_SQL_TYPE
|
||||
|
@ -41,20 +44,6 @@ constexpr StringView SQLType_name(SQLType t)
|
|||
}
|
||||
}
|
||||
|
||||
constexpr size_t size_of(SQLType t)
|
||||
{
|
||||
switch (t) {
|
||||
#undef __ENUMERATE_SQL_TYPE
|
||||
#define __ENUMERATE_SQL_TYPE(name, cardinal, type, impl, size) \
|
||||
case SQLType::type: \
|
||||
return size;
|
||||
ENUMERATE_SQL_TYPES(__ENUMERATE_SQL_TYPE)
|
||||
#undef __ENUMERATE_SQL_TYPE
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
#define ENUMERATE_ORDERS(S) \
|
||||
S(Ascending) \
|
||||
S(Descending)
|
||||
|
|
|
@ -92,8 +92,8 @@ StringView Value::type_name() const
|
|||
{
|
||||
switch (type()) {
|
||||
#undef __ENUMERATE_SQL_TYPE
|
||||
#define __ENUMERATE_SQL_TYPE(name, cardinal, type, impl, size) \
|
||||
case SQLType::type: \
|
||||
#define __ENUMERATE_SQL_TYPE(name, type) \
|
||||
case SQLType::type: \
|
||||
return name##sv;
|
||||
ENUMERATE_SQL_TYPES(__ENUMERATE_SQL_TYPE)
|
||||
#undef __ENUMERATE_SQL_TYPE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue