mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-9397 Split field.cc:calc_pack_length() into virtual methods in Type_handler
- Adding new virtual methods in Type_handler: * Column_definition_prepare_stage1() * Column_definition_prepare_stage2() * calc_pack_length() - Using new methods to remove type specific code in: * Global function calc_pack_length() * Column_definition::prepare_create_field() * The loop body mysql_prepare_create_table() * Column_definition::sp_prepare_create_field()
This commit is contained in:
215
sql/sql_type.h
215
sql/sql_type.h
@ -67,6 +67,7 @@ class Sort_param;
|
||||
class Arg_comparator;
|
||||
struct st_value;
|
||||
class Protocol;
|
||||
class handler;
|
||||
struct TABLE;
|
||||
struct SORT_FIELD_ATTR;
|
||||
|
||||
@ -549,6 +550,15 @@ protected:
|
||||
bool Item_send_time(Item *item, Protocol *protocol, st_value *buf) const;
|
||||
bool Item_send_date(Item *item, Protocol *protocol, st_value *buf) const;
|
||||
bool Item_send_datetime(Item *item, Protocol *protocol, st_value *buf) const;
|
||||
bool Column_definition_prepare_stage2_legacy(Column_definition *c,
|
||||
enum_field_types type)
|
||||
const;
|
||||
bool Column_definition_prepare_stage2_legacy_num(Column_definition *c,
|
||||
enum_field_types type)
|
||||
const;
|
||||
bool Column_definition_prepare_stage2_legacy_real(Column_definition *c,
|
||||
enum_field_types type)
|
||||
const;
|
||||
public:
|
||||
static const Type_handler *blob_type_handler(uint max_octet_length);
|
||||
static const Type_handler *string_type_handler(uint max_octet_length);
|
||||
@ -692,6 +702,14 @@ public:
|
||||
uint metadata,
|
||||
const Field *target) const= 0;
|
||||
virtual bool Column_definition_fix_attributes(Column_definition *c) const= 0;
|
||||
virtual bool Column_definition_prepare_stage1(THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
virtual bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const= 0;
|
||||
virtual Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -708,6 +726,7 @@ public:
|
||||
SORT_FIELD_ATTR *attr) const= 0;
|
||||
|
||||
virtual uint32 max_display_length(const Item *item) const= 0;
|
||||
virtual uint32 calc_pack_length(uint32 length) const= 0;
|
||||
virtual bool Item_save_in_value(Item *item, st_value *value) const= 0;
|
||||
virtual bool Item_param_set_from_value(THD *thd,
|
||||
Item_param *param,
|
||||
@ -935,6 +954,22 @@ public:
|
||||
DBUG_ASSERT(0);
|
||||
return true;
|
||||
}
|
||||
bool Column_definition_prepare_stage1(THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return true;
|
||||
}
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return true;
|
||||
}
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -959,6 +994,11 @@ public:
|
||||
DBUG_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
uint32 calc_pack_length(uint32 length) const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
uint Item_decimal_precision(const Item *item) const
|
||||
{
|
||||
DBUG_ASSERT(0);
|
||||
@ -1470,6 +1510,11 @@ public:
|
||||
void sortlength(THD *thd,
|
||||
const Type_std_attributes *item,
|
||||
SORT_FIELD_ATTR *attr) const;
|
||||
bool Column_definition_prepare_stage1(THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
uint32 max_display_length(const Item *item) const;
|
||||
uint Item_time_precision(Item *item) const
|
||||
{
|
||||
@ -1578,6 +1623,7 @@ public:
|
||||
const Name name() const { return m_name_tiny; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TINY; }
|
||||
uint32 max_display_length(const Item *item) const { return 4; }
|
||||
uint32 calc_pack_length(uint32 length) const { return 1; }
|
||||
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
|
||||
{
|
||||
return Item_send_tiny(item, protocol, buf);
|
||||
@ -1585,6 +1631,10 @@ public:
|
||||
Field *make_conversion_table_field(TABLE *TABLE, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_TINY); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1604,9 +1654,14 @@ public:
|
||||
return Item_send_short(item, protocol, buf);
|
||||
}
|
||||
uint32 max_display_length(const Item *item) const { return 6; }
|
||||
uint32 calc_pack_length(uint32 length) const { return 2; }
|
||||
Field *make_conversion_table_field(TABLE *TABLE, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_SHORT); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1625,6 +1680,7 @@ public:
|
||||
{
|
||||
return MY_INT32_NUM_DECIMAL_DIGITS;
|
||||
}
|
||||
uint32 calc_pack_length(uint32 length) const { return 4; }
|
||||
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
|
||||
{
|
||||
return Item_send_long(item, protocol, buf);
|
||||
@ -1632,6 +1688,10 @@ public:
|
||||
Field *make_conversion_table_field(TABLE *TABLE, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_LONG); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1647,6 +1707,7 @@ public:
|
||||
const Name name() const { return m_name_longlong; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONGLONG; }
|
||||
uint32 max_display_length(const Item *item) const { return 20; }
|
||||
uint32 calc_pack_length(uint32 length) const { return 8; }
|
||||
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
|
||||
{
|
||||
return Item_send_longlong(item, protocol, buf);
|
||||
@ -1654,6 +1715,12 @@ public:
|
||||
Field *make_conversion_table_field(TABLE *TABLE, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{
|
||||
return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_LONGLONG);
|
||||
}
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1673,9 +1740,14 @@ public:
|
||||
return Item_send_long(item, protocol, buf);
|
||||
}
|
||||
uint32 max_display_length(const Item *item) const { return 8; }
|
||||
uint32 calc_pack_length(uint32 length) const { return 3; }
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_INT24); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1691,6 +1763,7 @@ public:
|
||||
const Name name() const { return m_name_year; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_YEAR; }
|
||||
uint32 max_display_length(const Item *item) const;
|
||||
uint32 calc_pack_length(uint32 length) const { return 1; }
|
||||
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
|
||||
{
|
||||
return Item_send_short(item, protocol, buf);
|
||||
@ -1698,6 +1771,10 @@ public:
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_YEAR); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1713,6 +1790,7 @@ public:
|
||||
const Name name() const { return m_name_bit; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_BIT; }
|
||||
uint32 max_display_length(const Item *item) const;
|
||||
uint32 calc_pack_length(uint32 length) const { return length / 8; }
|
||||
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
|
||||
{
|
||||
return Item_send_str(item, protocol, buf);
|
||||
@ -1724,6 +1802,14 @@ public:
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage1(THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1740,6 +1826,7 @@ public:
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_FLOAT; }
|
||||
bool type_can_have_auto_increment_attribute() const { return true; }
|
||||
uint32 max_display_length(const Item *item) const { return 25; }
|
||||
uint32 calc_pack_length(uint32 length) const { return sizeof(float); }
|
||||
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
|
||||
{
|
||||
return Item_send_float(item, protocol, buf);
|
||||
@ -1748,6 +1835,10 @@ public:
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy_real(c, MYSQL_TYPE_FLOAT); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1764,6 +1855,7 @@ public:
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||
bool type_can_have_auto_increment_attribute() const { return true; }
|
||||
uint32 max_display_length(const Item *item) const { return 53; }
|
||||
uint32 calc_pack_length(uint32 length) const { return sizeof(double); }
|
||||
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const
|
||||
{
|
||||
return Item_send_double(item, protocol, buf);
|
||||
@ -1771,6 +1863,10 @@ public:
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy_real(c, MYSQL_TYPE_DOUBLE); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1821,10 +1917,18 @@ public:
|
||||
|
||||
class Type_handler_time: public Type_handler_time_common
|
||||
{
|
||||
/* number of bytes to store TIME(N) */
|
||||
static uint m_hires_bytes[MAX_DATETIME_PRECISION+1];
|
||||
public:
|
||||
static uint hires_bytes(uint dec) { return m_hires_bytes[dec]; }
|
||||
virtual ~Type_handler_time() {}
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_TIME); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1837,8 +1941,13 @@ class Type_handler_time2: public Type_handler_time_common
|
||||
public:
|
||||
virtual ~Type_handler_time2() {}
|
||||
enum_field_types real_field_type() const { return MYSQL_TYPE_TIME2; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_TIME2); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1889,8 +1998,13 @@ class Type_handler_date: public Type_handler_date_common
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_date() {}
|
||||
uint32 calc_pack_length(uint32 length) const { return 4; }
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_DATE); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1903,8 +2017,13 @@ class Type_handler_newdate: public Type_handler_date_common
|
||||
public:
|
||||
virtual ~Type_handler_newdate() {}
|
||||
enum_field_types real_field_type() const { return MYSQL_TYPE_NEWDATE; }
|
||||
uint32 calc_pack_length(uint32 length) const { return 3; }
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_NEWDATE); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1949,10 +2068,18 @@ public:
|
||||
|
||||
class Type_handler_datetime: public Type_handler_datetime_common
|
||||
{
|
||||
/* number of bytes to store DATETIME(N) */
|
||||
static uint m_hires_bytes[MAX_DATETIME_PRECISION + 1];
|
||||
public:
|
||||
static uint hires_bytes(uint dec) { return m_hires_bytes[dec]; }
|
||||
virtual ~Type_handler_datetime() {}
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_DATETIME); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -1965,8 +2092,13 @@ class Type_handler_datetime2: public Type_handler_datetime_common
|
||||
public:
|
||||
virtual ~Type_handler_datetime2() {}
|
||||
enum_field_types real_field_type() const { return MYSQL_TYPE_DATETIME2; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_DATETIME2); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -2015,10 +2147,18 @@ public:
|
||||
|
||||
class Type_handler_timestamp: public Type_handler_timestamp_common
|
||||
{
|
||||
/* number of bytes to store second_part part of the TIMESTAMP(N) */
|
||||
static uint m_sec_part_bytes[MAX_DATETIME_PRECISION + 1];
|
||||
public:
|
||||
static uint sec_part_bytes(uint dec) { return m_sec_part_bytes[dec]; }
|
||||
virtual ~Type_handler_timestamp() {}
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_TIMESTAMP); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -2031,8 +2171,15 @@ class Type_handler_timestamp2: public Type_handler_timestamp_common
|
||||
public:
|
||||
virtual ~Type_handler_timestamp2() {}
|
||||
enum_field_types real_field_type() const { return MYSQL_TYPE_TIMESTAMP2; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{
|
||||
return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_TIMESTAMP2);
|
||||
}
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -2047,11 +2194,16 @@ public:
|
||||
virtual ~Type_handler_olddecimal() {}
|
||||
const Name name() const { return m_name_decimal; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_DECIMAL; }
|
||||
uint32 calc_pack_length(uint32 length) const { return length; }
|
||||
const Type_handler *type_handler_for_tmp_table(const Item *item) const;
|
||||
const Type_handler *type_handler_for_union(const Item *item) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_DECIMAL); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -2066,9 +2218,18 @@ public:
|
||||
virtual ~Type_handler_newdecimal() {}
|
||||
const Name name() const { return m_name_decimal; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_NEWDECIMAL; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage1(THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -2087,11 +2248,21 @@ public:
|
||||
const Type_handler *type_handler_for_tmp_table(const Item *item) const;
|
||||
const Type_handler *type_handler_for_union(const Item *) const;
|
||||
uint32 max_display_length(const Item *item) const { return 0; }
|
||||
uint32 calc_pack_length(uint32 length) const { return 0; }
|
||||
bool Item_save_in_value(Item *item, st_value *value) const;
|
||||
bool Item_send(Item *item, Protocol *protocol, st_value *buf) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage1(THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy(c, MYSQL_TYPE_NULL); }
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -2117,6 +2288,7 @@ public:
|
||||
const Name name() const { return m_name_char; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_STRING; }
|
||||
bool is_param_long_data_type() const { return true; }
|
||||
uint32 calc_pack_length(uint32 length) const { return length; }
|
||||
const Type_handler *type_handler_for_tmp_table(const Item *item) const
|
||||
{
|
||||
return varstring_type_handler(item);
|
||||
@ -2124,6 +2296,9 @@ public:
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -2145,6 +2320,10 @@ public:
|
||||
return varstring_type_handler(item);
|
||||
}
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const
|
||||
{ return Column_definition_prepare_stage2_legacy_num(c, MYSQL_TYPE_STRING); }
|
||||
const Type_handler *type_handler_for_union(const Item *item) const
|
||||
{
|
||||
return varstring_type_handler(item);
|
||||
@ -2159,6 +2338,10 @@ public:
|
||||
virtual ~Type_handler_varchar() {}
|
||||
const Name name() const { return m_name_varchar; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
|
||||
uint32 calc_pack_length(uint32 length) const
|
||||
{
|
||||
return (length + (length < 256 ? 1: 2));
|
||||
}
|
||||
const Type_handler *type_handler_for_tmp_table(const Item *item) const
|
||||
{
|
||||
return varstring_type_handler(item);
|
||||
@ -2171,6 +2354,9 @@ public:
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -2197,6 +2383,9 @@ public:
|
||||
}
|
||||
bool is_param_long_data_type() const { return true; }
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
@ -2212,6 +2401,7 @@ public:
|
||||
virtual ~Type_handler_tiny_blob() {}
|
||||
const Name name() const { return m_name_tinyblob; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_TINY_BLOB; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
@ -2228,6 +2418,7 @@ public:
|
||||
virtual ~Type_handler_medium_blob() {}
|
||||
const Name name() const { return m_name_mediumblob; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_MEDIUM_BLOB; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
@ -2244,6 +2435,7 @@ public:
|
||||
virtual ~Type_handler_long_blob() {}
|
||||
const Name name() const { return m_name_longblob; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_LONG_BLOB; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
@ -2260,6 +2452,7 @@ public:
|
||||
virtual ~Type_handler_blob() {}
|
||||
const Name name() const { return m_name_blob; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_BLOB; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
@ -2278,6 +2471,7 @@ public:
|
||||
const Name name() const { return m_name_geometry; }
|
||||
enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
|
||||
bool is_param_long_data_type() const { return true; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
const Type_handler *type_handler_for_comparison() const;
|
||||
bool type_can_have_key_part() const
|
||||
{
|
||||
@ -2295,6 +2489,14 @@ public:
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage1(THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -2343,6 +2545,11 @@ public:
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems) const;
|
||||
bool Column_definition_prepare_stage1(THD *thd,
|
||||
MEM_ROOT *mem_root,
|
||||
Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
};
|
||||
|
||||
|
||||
@ -2353,9 +2560,13 @@ public:
|
||||
virtual ~Type_handler_enum() {}
|
||||
const Name name() const { return m_name_enum; }
|
||||
virtual enum_field_types real_field_type() const { return MYSQL_TYPE_ENUM; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
@ -2370,9 +2581,13 @@ public:
|
||||
virtual ~Type_handler_set() {}
|
||||
const Name name() const { return m_name_set; }
|
||||
virtual enum_field_types real_field_type() const { return MYSQL_TYPE_SET; }
|
||||
uint32 calc_pack_length(uint32 length) const;
|
||||
Field *make_conversion_table_field(TABLE *, uint metadata,
|
||||
const Field *target) const;
|
||||
bool Column_definition_fix_attributes(Column_definition *c) const;
|
||||
bool Column_definition_prepare_stage2(Column_definition *c,
|
||||
handler *file,
|
||||
ulonglong table_flags) const;
|
||||
Field *make_table_field(const LEX_CSTRING *name,
|
||||
const Record_addr &addr,
|
||||
const Type_all_attributes &attr,
|
||||
|
Reference in New Issue
Block a user