1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-9170 Get rid of LEX::length and LEX::dec

A preparatory task for:
  MDEV-4912 Add a plugin to field types (column types)
This commit is contained in:
Alexander Barkov
2015-11-23 18:55:01 +04:00
parent b7e9bf9122
commit d73cf394a5
5 changed files with 252 additions and 238 deletions

View File

@ -550,4 +550,74 @@ public:
};
struct Lex_length_and_dec_st
{
private:
const char *m_length;
const char *m_dec;
public:
void set(const char *length, const char *dec)
{
m_length= length;
m_dec= dec;
}
const char *length() const { return m_length; }
const char *dec() const { return m_dec; }
};
struct Lex_field_type_st: public Lex_length_and_dec_st
{
private:
enum_field_types m_type;
void set(enum_field_types type, const char *length, const char *dec)
{
m_type= type;
Lex_length_and_dec_st::set(length, dec);
}
public:
void set(enum_field_types type, Lex_length_and_dec_st length_and_dec)
{
m_type= type;
Lex_length_and_dec_st::operator=(length_and_dec);
}
void set(enum_field_types type, const char *length)
{
set(type, length, 0);
}
void set(enum_field_types type)
{
set(type, 0, 0);
}
enum_field_types field_type() const { return m_type; }
};
struct Lex_dyncol_type_st: public Lex_length_and_dec_st
{
private:
int m_type; // enum_dynamic_column_type is not visible here, so use int
public:
void set(int type, const char *length, const char *dec)
{
m_type= type;
Lex_length_and_dec_st::set(length, dec);
}
void set(int type, Lex_length_and_dec_st length_and_dec)
{
m_type= type;
Lex_length_and_dec_st::operator=(length_and_dec);
}
void set(int type, const char *length)
{
set(type, length, 0);
}
void set(int type)
{
set(type, 0, 0);
}
int dyncol_type() const { return m_type; }
};
#endif /* STRUCTS_INCLUDED */