mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 19:47:42 +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);
|
C_OBJECT(Heap);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr inline u32 current_version = 1;
|
static constexpr inline u32 current_version = 2;
|
||||||
|
|
||||||
virtual ~Heap() override;
|
virtual ~Heap() override;
|
||||||
|
|
||||||
|
|
|
@ -12,17 +12,20 @@
|
||||||
|
|
||||||
namespace SQL {
|
namespace SQL {
|
||||||
|
|
||||||
|
// 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) \
|
#define ENUMERATE_SQL_TYPES(S) \
|
||||||
S("null", 1, Null, int, sizeof(int)) \
|
S("null", Null) \
|
||||||
S("text", 2, Text, DeprecatedString, 65 + sizeof(u32)) \
|
S("text", Text) \
|
||||||
S("int", 4, Integer, int, sizeof(int)) \
|
S("int", Integer) \
|
||||||
S("float", 8, Float, double, sizeof(double)) \
|
S("float", Float) \
|
||||||
S("bool", 16, Boolean, bool, sizeof(bool)) \
|
S("bool", Boolean) \
|
||||||
S("tuple", 32, Tuple, int, sizeof(int))
|
S("tuple", Tuple)
|
||||||
|
|
||||||
enum class SQLType {
|
enum class SQLType {
|
||||||
#undef __ENUMERATE_SQL_TYPE
|
#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)
|
ENUMERATE_SQL_TYPES(__ENUMERATE_SQL_TYPE)
|
||||||
#undef __ENUMERATE_SQL_TYPE
|
#undef __ENUMERATE_SQL_TYPE
|
||||||
};
|
};
|
||||||
|
@ -31,7 +34,7 @@ constexpr StringView SQLType_name(SQLType t)
|
||||||
{
|
{
|
||||||
switch (t) {
|
switch (t) {
|
||||||
#undef __ENUMERATE_SQL_TYPE
|
#undef __ENUMERATE_SQL_TYPE
|
||||||
#define __ENUMERATE_SQL_TYPE(name, cardinal, type, impl, size) \
|
#define __ENUMERATE_SQL_TYPE(name, type) \
|
||||||
case SQLType::type: \
|
case SQLType::type: \
|
||||||
return name##sv;
|
return name##sv;
|
||||||
ENUMERATE_SQL_TYPES(__ENUMERATE_SQL_TYPE)
|
ENUMERATE_SQL_TYPES(__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) \
|
#define ENUMERATE_ORDERS(S) \
|
||||||
S(Ascending) \
|
S(Ascending) \
|
||||||
S(Descending)
|
S(Descending)
|
||||||
|
|
|
@ -92,7 +92,7 @@ StringView Value::type_name() const
|
||||||
{
|
{
|
||||||
switch (type()) {
|
switch (type()) {
|
||||||
#undef __ENUMERATE_SQL_TYPE
|
#undef __ENUMERATE_SQL_TYPE
|
||||||
#define __ENUMERATE_SQL_TYPE(name, cardinal, type, impl, size) \
|
#define __ENUMERATE_SQL_TYPE(name, type) \
|
||||||
case SQLType::type: \
|
case SQLType::type: \
|
||||||
return name##sv;
|
return name##sv;
|
||||||
ENUMERATE_SQL_TYPES(__ENUMERATE_SQL_TYPE)
|
ENUMERATE_SQL_TYPES(__ENUMERATE_SQL_TYPE)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue