fix(Core/Database): fix wrong Field::IsNull() return value on null binary fields (#5975)

This commit is contained in:
Axel Cocat
2021-05-21 01:13:49 +02:00
committed by GitHub
parent fe6db2ff96
commit 983d4b5771

View File

@@ -242,6 +242,10 @@ public:
[[nodiscard]] bool IsNull() const
{
if (IsBinary() && data.length == 0)
{
return true;
}
return data.value == nullptr;
}
@@ -351,6 +355,18 @@ protected:
data.type == MYSQL_TYPE_LONGLONG );
}
[[nodiscard]] bool IsBinary() const
{
return (
data.type == MYSQL_TYPE_TINY_BLOB ||
data.type == MYSQL_TYPE_MEDIUM_BLOB ||
data.type == MYSQL_TYPE_LONG_BLOB ||
data.type == MYSQL_TYPE_BLOB ||
data.type == MYSQL_TYPE_VAR_STRING ||
data.type == MYSQL_TYPE_STRING
);
}
void GetBinarySizeChecked(uint8* buf, size_t size) const;
private: