Commit d73cf394 authored by Alexander Barkov's avatar Alexander Barkov

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

A preparatory task for:
  MDEV-4912 Add a plugin to field types (column types)
parent b7e9bf91
......@@ -2039,6 +2039,33 @@ enum Cast_target
};
struct Lex_cast_type_st: public Lex_length_and_dec_st
{
private:
Cast_target m_type;
public:
void set(Cast_target type, const char *length, const char *dec)
{
m_type= type;
Lex_length_and_dec_st::set(length, dec);
}
void set(Cast_target type, Lex_length_and_dec_st length_and_dec)
{
m_type= type;
Lex_length_and_dec_st::operator=(length_and_dec);
}
void set(Cast_target type, const char *length)
{
set(type, length, 0);
}
void set(Cast_target type)
{
set(type, 0, 0);
}
Cast_target type() const { return m_type; }
};
class Item_func_row_count :public Item_int_func
{
public:
......
......@@ -506,7 +506,6 @@ void lex_start(THD *thd)
lex->parsing_options.reset();
lex->empty_field_list_on_rset= 0;
lex->select_lex.select_number= 1;
lex->length=0;
lex->part_info= 0;
lex->select_lex.in_sum_expr=0;
lex->select_lex.ftfunc_list_alloc.empty();
......
......@@ -2396,7 +2396,6 @@ struct LEX: public Query_tables_list
Explain_query *explain;
// type information
char *length,*dec;
CHARSET_INFO *charset;
LEX_STRING name;
......@@ -2856,7 +2855,7 @@ struct LEX: public Query_tables_list
void restore_set_statement_var();
void init_last_field(Create_field *field, const char *name, CHARSET_INFO *cs);
void set_last_field_type(enum enum_field_types type);
void set_last_field_type(const Lex_field_type_st &type);
bool set_bincmp(CHARSET_INFO *cs, bool bin);
// Check if "KEY IF NOT EXISTS name" used outside of ALTER context
bool check_add_key(DDL_options_st ddl)
......
This diff is collapsed.
......@@ -550,4 +550,74 @@ class DDL_options: public DDL_options_st
};
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 */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment