1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-19861 Add intfastructure to have ENUM columns in INFORMATION_SCHEMA

This commit is contained in:
Alexander Barkov
2019-06-26 06:46:55 +04:00
parent 677133f1b3
commit 6f3612fa4d
5 changed files with 103 additions and 4 deletions

View File

@ -144,6 +144,54 @@ public:
};
class Typelib: public TYPELIB
{
public:
Typelib(uint count, const char **type_names, unsigned int *type_lengths)
{
TYPELIB::count= count;
TYPELIB::name= "";
TYPELIB::type_names= type_names;
TYPELIB::type_lengths= type_lengths;
}
uint max_octet_length() const
{
uint max_length= 0;
for (uint i= 0; i < TYPELIB::count; i++)
{
const uint length= TYPELIB::type_lengths[i];
set_if_bigger(max_length, length);
}
return max_length;
}
};
template<uint sz>
class TypelibBuffer: public Typelib
{
const char *m_type_names[sz + 1];
unsigned int m_type_lengths[sz + 1];
public:
TypelibBuffer(uint count, const LEX_CSTRING *values)
:Typelib(count, m_type_names, m_type_lengths)
{
DBUG_ASSERT(sz >= count);
for (uint i= 0; i < count; i++)
{
DBUG_ASSERT(values[i].str != NULL);
m_type_names[i]= values[i].str;
m_type_lengths[i]= values[i].length;
}
m_type_names[sz]= NullS; // End marker
m_type_lengths[sz]= 0; // End marker
}
TypelibBuffer(const LEX_CSTRING *values)
:TypelibBuffer(sz, values)
{ }
};
class Native: public Binary_string
{
public:
@ -6474,6 +6522,10 @@ public:
const Bit_addr &bit,
const Column_definition_attributes *attr,
uint32 flags) const;
Field *make_schema_field(TABLE *table,
const Record_addr &addr,
const ST_FIELD_INFO &def,
bool show_field) const;
};