Commit 74551b2b authored by Alexander Barkov's avatar Alexander Barkov

Cleanup: removing Type_handler members m_name_xxx

Hiding the definitions inside Type_handler_xxx::name().

This is needed to avoid exporting members with MYSQL_PLUGIN_IMPORT,
which would be needed to compile data type plugins on Windows.
parent 9b1866fd
...@@ -1395,48 +1395,173 @@ uint Type_handler_time::m_hires_bytes[MAX_DATETIME_PRECISION + 1]= ...@@ -1395,48 +1395,173 @@ uint Type_handler_time::m_hires_bytes[MAX_DATETIME_PRECISION + 1]=
{ 3, 4, 4, 5, 5, 5, 6 }; { 3, 4, 4, 5, 5, 5, 6 };
/***************************************************************************/ /***************************************************************************/
const Name Type_handler_row::m_name_row(STRING_WITH_LEN("row")); const Name Type_handler_row::name() const
{
const Name Type_handler_null::m_name_null(STRING_WITH_LEN("null")); static Name tmp(STRING_WITH_LEN("row"));
return tmp;
const Name }
Type_handler_string::m_name_char(STRING_WITH_LEN("char")),
Type_handler_var_string::m_name_var_string(STRING_WITH_LEN("varchar")), const Name Type_handler_null::name() const
Type_handler_varchar::m_name_varchar(STRING_WITH_LEN("varchar")), {
Type_handler_hex_hybrid::m_name_hex_hybrid(STRING_WITH_LEN("hex_hybrid")), static Name tmp(STRING_WITH_LEN("null"));
Type_handler_tiny_blob::m_name_tinyblob(STRING_WITH_LEN("tinyblob")), return tmp;
Type_handler_medium_blob::m_name_mediumblob(STRING_WITH_LEN("mediumblob")), }
Type_handler_long_blob::m_name_longblob(STRING_WITH_LEN("longblob")),
Type_handler_blob::m_name_blob(STRING_WITH_LEN("blob")); const Name Type_handler_string::name() const
{
const Name static Name tmp(STRING_WITH_LEN("char"));
Type_handler_enum::m_name_enum(STRING_WITH_LEN("enum")), return tmp;
Type_handler_set::m_name_set(STRING_WITH_LEN("set")); }
const Name const Name Type_handler_var_string::name() const
Type_handler_bool::m_name_bool(STRING_WITH_LEN("boolean")), {
Type_handler_tiny::m_name_tiny(STRING_WITH_LEN("tinyint")), static Name tmp(STRING_WITH_LEN("varchar"));
Type_handler_short::m_name_short(STRING_WITH_LEN("smallint")), return tmp;
Type_handler_long::m_name_int(STRING_WITH_LEN("int")), }
Type_handler_longlong::m_name_longlong(STRING_WITH_LEN("bigint")),
Type_handler_int24::m_name_mediumint(STRING_WITH_LEN("mediumint")), const Name Type_handler_varchar::name() const
Type_handler_year::m_name_year(STRING_WITH_LEN("year")), {
Type_handler_bit::m_name_bit(STRING_WITH_LEN("bit")); static Name tmp(STRING_WITH_LEN("varchar"));
return tmp;
const Name }
Type_handler_float::m_name_float(STRING_WITH_LEN("float")),
Type_handler_double::m_name_double(STRING_WITH_LEN("double")); const Name Type_handler_hex_hybrid::name() const
{
const Name static Name tmp(STRING_WITH_LEN("hex_hybrid"));
Type_handler_olddecimal::m_name_decimal(STRING_WITH_LEN("decimal")), return tmp;
Type_handler_newdecimal::m_name_decimal(STRING_WITH_LEN("decimal")); }
const Name const Name Type_handler_tiny_blob::name() const
Type_handler_time_common::m_name_time(STRING_WITH_LEN("time")), {
Type_handler_date_common::m_name_date(STRING_WITH_LEN("date")), static Name tmp(STRING_WITH_LEN("tinyblob"));
Type_handler_datetime_common::m_name_datetime(STRING_WITH_LEN("datetime")), return tmp;
Type_handler_timestamp_common::m_name_timestamp(STRING_WITH_LEN("timestamp")); }
const Name Type_handler_medium_blob::name() const
{
static Name tmp(STRING_WITH_LEN("mediumblob"));
return tmp;
}
const Name Type_handler_long_blob::name() const
{
static Name tmp(STRING_WITH_LEN("longblob"));
return tmp;
}
const Name Type_handler_blob::name() const
{
static Name tmp(STRING_WITH_LEN("blob"));
return tmp;
}
const Name Type_handler_enum::name() const
{
static Name tmp(STRING_WITH_LEN("enum"));
return tmp;
}
const Name Type_handler_set::name() const
{
static Name tmp(STRING_WITH_LEN("set"));
return tmp;
}
const Name Type_handler_bool::name() const
{
static Name tmp(STRING_WITH_LEN("boolean"));
return tmp;
}
const Name Type_handler_tiny::name() const
{
static Name tmp(STRING_WITH_LEN("tinyint"));
return tmp;
}
const Name Type_handler_short::name() const
{
static Name tmp(STRING_WITH_LEN("smallint"));
return tmp;
}
const Name Type_handler_long::name() const
{
static Name tmp(STRING_WITH_LEN("int"));
return tmp;
}
const Name Type_handler_longlong::name() const
{
static Name tmp(STRING_WITH_LEN("bigint"));
return tmp;
}
const Name Type_handler_int24::name() const
{
static Name tmp(STRING_WITH_LEN("mediumint"));
return tmp;
}
const Name Type_handler_year::name() const
{
static Name tmp(STRING_WITH_LEN("year"));
return tmp;
}
const Name Type_handler_bit::name() const
{
static Name tmp(STRING_WITH_LEN("bit"));
return tmp;
}
const Name Type_handler_float::name() const
{
static Name tmp(STRING_WITH_LEN("float"));
return tmp;
}
const Name Type_handler_double::name() const
{
static Name tmp(STRING_WITH_LEN("double"));
return tmp;
}
const Name Type_handler_olddecimal::name() const
{
static Name tmp(STRING_WITH_LEN("decimal"));
return tmp;
}
const Name Type_handler_newdecimal::name() const
{
static Name tmp(STRING_WITH_LEN("decimal"));
return tmp;
}
const Name Type_handler_time_common::name() const
{
static Name tmp(STRING_WITH_LEN("time"));
return tmp;
}
const Name Type_handler_date_common::name() const
{
static Name tmp(STRING_WITH_LEN("date"));
return tmp;
}
const Name Type_handler_datetime_common::name() const
{
static Name tmp(STRING_WITH_LEN("datetime"));
return tmp;
}
const Name Type_handler_timestamp_common::name() const
{
static Name tmp(STRING_WITH_LEN("timestamp"));
return tmp;
}
const Name Type_handler_utiny::name() const const Name Type_handler_utiny::name() const
{ {
......
...@@ -3917,10 +3917,9 @@ class Type_handler ...@@ -3917,10 +3917,9 @@ class Type_handler
*/ */
class Type_handler_row: public Type_handler class Type_handler_row: public Type_handler
{ {
static const Name m_name_row;
public: public:
virtual ~Type_handler_row() {} virtual ~Type_handler_row() {}
const Name name() const override { return m_name_row; } const Name name() const override;
const Name &default_value() const override; const Name &default_value() const override;
bool validate_implicit_default_value(THD *thd, bool validate_implicit_default_value(THD *thd,
const Column_definition &def) const const Column_definition &def) const
...@@ -5023,10 +5022,9 @@ class Type_handler_general_purpose_string: public Type_handler_string_result ...@@ -5023,10 +5022,9 @@ class Type_handler_general_purpose_string: public Type_handler_string_result
class Type_handler_tiny: public Type_handler_general_purpose_int class Type_handler_tiny: public Type_handler_general_purpose_int
{ {
static const Name m_name_tiny;
public: public:
virtual ~Type_handler_tiny() {} virtual ~Type_handler_tiny() {}
const Name name() const override { return m_name_tiny; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_TINY; } enum_field_types field_type() const override { return MYSQL_TYPE_TINY; }
const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_unsigned() const override;
const Type_handler *type_handler_signed() const override; const Type_handler *type_handler_signed() const override;
...@@ -5083,10 +5081,9 @@ class Type_handler_utiny: public Type_handler_tiny ...@@ -5083,10 +5081,9 @@ class Type_handler_utiny: public Type_handler_tiny
class Type_handler_short: public Type_handler_general_purpose_int class Type_handler_short: public Type_handler_general_purpose_int
{ {
static const Name m_name_short;
public: public:
virtual ~Type_handler_short() {} virtual ~Type_handler_short() {}
const Name name() const override { return m_name_short; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_SHORT; } enum_field_types field_type() const override { return MYSQL_TYPE_SHORT; }
const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_unsigned() const override;
const Type_handler *type_handler_signed() const override; const Type_handler *type_handler_signed() const override;
...@@ -5143,10 +5140,9 @@ class Type_handler_ushort: public Type_handler_short ...@@ -5143,10 +5140,9 @@ class Type_handler_ushort: public Type_handler_short
class Type_handler_long: public Type_handler_general_purpose_int class Type_handler_long: public Type_handler_general_purpose_int
{ {
static const Name m_name_int;
public: public:
virtual ~Type_handler_long() {} virtual ~Type_handler_long() {}
const Name name() const override { return m_name_int; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_LONG; } enum_field_types field_type() const override { return MYSQL_TYPE_LONG; }
const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_unsigned() const override;
const Type_handler *type_handler_signed() const override; const Type_handler *type_handler_signed() const override;
...@@ -5203,9 +5199,8 @@ class Type_handler_ulong: public Type_handler_long ...@@ -5203,9 +5199,8 @@ class Type_handler_ulong: public Type_handler_long
class Type_handler_bool: public Type_handler_long class Type_handler_bool: public Type_handler_long
{ {
static const Name m_name_bool;
public: public:
const Name name() const override { return m_name_bool; } const Name name() const override;
bool is_bool_type() const override { return true; } bool is_bool_type() const override { return true; }
const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_unsigned() const override;
const Type_handler *type_handler_signed() const override; const Type_handler *type_handler_signed() const override;
...@@ -5216,10 +5211,9 @@ class Type_handler_bool: public Type_handler_long ...@@ -5216,10 +5211,9 @@ class Type_handler_bool: public Type_handler_long
class Type_handler_longlong: public Type_handler_general_purpose_int class Type_handler_longlong: public Type_handler_general_purpose_int
{ {
static const Name m_name_longlong;
public: public:
virtual ~Type_handler_longlong() {} virtual ~Type_handler_longlong() {}
const Name name() const override{ return m_name_longlong; } const Name name() const override;
enum_field_types field_type() const override{ return MYSQL_TYPE_LONGLONG; } enum_field_types field_type() const override{ return MYSQL_TYPE_LONGLONG; }
const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_unsigned() const override;
const Type_handler *type_handler_signed() const override; const Type_handler *type_handler_signed() const override;
...@@ -5292,10 +5286,9 @@ class Type_handler_vers_trx_id: public Type_handler_ulonglong ...@@ -5292,10 +5286,9 @@ class Type_handler_vers_trx_id: public Type_handler_ulonglong
class Type_handler_int24: public Type_handler_general_purpose_int class Type_handler_int24: public Type_handler_general_purpose_int
{ {
static const Name m_name_mediumint;
public: public:
virtual ~Type_handler_int24() {} virtual ~Type_handler_int24() {}
const Name name() const override { return m_name_mediumint; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_INT24; } enum_field_types field_type() const override { return MYSQL_TYPE_INT24; }
const Type_handler *type_handler_unsigned() const override; const Type_handler *type_handler_unsigned() const override;
const Type_handler *type_handler_signed() const override; const Type_handler *type_handler_signed() const override;
...@@ -5345,10 +5338,9 @@ class Type_handler_uint24: public Type_handler_int24 ...@@ -5345,10 +5338,9 @@ class Type_handler_uint24: public Type_handler_int24
class Type_handler_year: public Type_handler_int_result class Type_handler_year: public Type_handler_int_result
{ {
static const Name m_name_year;
public: public:
virtual ~Type_handler_year() {} virtual ~Type_handler_year() {}
const Name name() const override { return m_name_year; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_YEAR; } enum_field_types field_type() const override { return MYSQL_TYPE_YEAR; }
uint flags() const override { return UNSIGNED_FLAG; } uint flags() const override { return UNSIGNED_FLAG; }
protocol_send_type_t protocol_send_type() const override protocol_send_type_t protocol_send_type() const override
...@@ -5401,10 +5393,9 @@ class Type_handler_year: public Type_handler_int_result ...@@ -5401,10 +5393,9 @@ class Type_handler_year: public Type_handler_int_result
class Type_handler_bit: public Type_handler_int_result class Type_handler_bit: public Type_handler_int_result
{ {
static const Name m_name_bit;
public: public:
virtual ~Type_handler_bit() {} virtual ~Type_handler_bit() {}
const Name name() const override { return m_name_bit; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_BIT; } enum_field_types field_type() const override { return MYSQL_TYPE_BIT; }
uint flags() const override { return UNSIGNED_FLAG; } uint flags() const override { return UNSIGNED_FLAG; }
protocol_send_type_t protocol_send_type() const override protocol_send_type_t protocol_send_type() const override
...@@ -5460,10 +5451,9 @@ class Type_handler_bit: public Type_handler_int_result ...@@ -5460,10 +5451,9 @@ class Type_handler_bit: public Type_handler_int_result
class Type_handler_float: public Type_handler_real_result class Type_handler_float: public Type_handler_real_result
{ {
static const Name m_name_float;
public: public:
virtual ~Type_handler_float() {} virtual ~Type_handler_float() {}
const Name name() const override { return m_name_float; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_FLOAT; } enum_field_types field_type() const override { return MYSQL_TYPE_FLOAT; }
protocol_send_type_t protocol_send_type() const override protocol_send_type_t protocol_send_type() const override
{ {
...@@ -5520,10 +5510,9 @@ class Type_handler_float: public Type_handler_real_result ...@@ -5520,10 +5510,9 @@ class Type_handler_float: public Type_handler_real_result
class Type_handler_double: public Type_handler_real_result class Type_handler_double: public Type_handler_real_result
{ {
static const Name m_name_double;
public: public:
virtual ~Type_handler_double() {} virtual ~Type_handler_double() {}
const Name name() const override { return m_name_double; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_DOUBLE; } enum_field_types field_type() const override { return MYSQL_TYPE_DOUBLE; }
protocol_send_type_t protocol_send_type() const override protocol_send_type_t protocol_send_type() const override
{ {
...@@ -5581,10 +5570,9 @@ class Type_handler_double: public Type_handler_real_result ...@@ -5581,10 +5570,9 @@ class Type_handler_double: public Type_handler_real_result
class Type_handler_time_common: public Type_handler_temporal_result class Type_handler_time_common: public Type_handler_temporal_result
{ {
static const Name m_name_time;
public: public:
virtual ~Type_handler_time_common() { } virtual ~Type_handler_time_common() { }
const Name name() const override { return m_name_time; } const Name name() const override;
const Name &default_value() const override; const Name &default_value() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_TIME; } enum_field_types field_type() const override { return MYSQL_TYPE_TIME; }
enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
...@@ -5775,10 +5763,9 @@ class Type_handler_temporal_with_date: public Type_handler_temporal_result ...@@ -5775,10 +5763,9 @@ class Type_handler_temporal_with_date: public Type_handler_temporal_result
class Type_handler_date_common: public Type_handler_temporal_with_date class Type_handler_date_common: public Type_handler_temporal_with_date
{ {
static const Name m_name_date;
public: public:
virtual ~Type_handler_date_common() {} virtual ~Type_handler_date_common() {}
const Name name() const override { return m_name_date; } const Name name() const override;
const Name &default_value() const override; const Name &default_value() const override;
const Type_handler *type_handler_for_comparison() const override; const Type_handler *type_handler_for_comparison() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_DATE; } enum_field_types field_type() const override { return MYSQL_TYPE_DATE; }
...@@ -5894,10 +5881,9 @@ class Type_handler_newdate: public Type_handler_date_common ...@@ -5894,10 +5881,9 @@ class Type_handler_newdate: public Type_handler_date_common
class Type_handler_datetime_common: public Type_handler_temporal_with_date class Type_handler_datetime_common: public Type_handler_temporal_with_date
{ {
static const Name m_name_datetime;
public: public:
virtual ~Type_handler_datetime_common() {} virtual ~Type_handler_datetime_common() {}
const Name name() const override { return m_name_datetime; } const Name name() const override;
const Name &default_value() const override; const Name &default_value() const override;
const Type_handler *type_handler_for_comparison() const override; const Type_handler *type_handler_for_comparison() const override;
enum_field_types field_type() const override enum_field_types field_type() const override
...@@ -6032,12 +6018,11 @@ class Type_handler_datetime2: public Type_handler_datetime_common ...@@ -6032,12 +6018,11 @@ class Type_handler_datetime2: public Type_handler_datetime_common
class Type_handler_timestamp_common: public Type_handler_temporal_with_date class Type_handler_timestamp_common: public Type_handler_temporal_with_date
{ {
static const Name m_name_timestamp;
protected: protected:
bool TIME_to_native(THD *, const MYSQL_TIME *from, Native *to, uint dec) const; bool TIME_to_native(THD *, const MYSQL_TIME *from, Native *to, uint dec) const;
public: public:
virtual ~Type_handler_timestamp_common() {} virtual ~Type_handler_timestamp_common() {}
const Name name() const override { return m_name_timestamp; } const Name name() const override;
const Name &default_value() const override; const Name &default_value() const override;
const Type_handler *type_handler_for_comparison() const override; const Type_handler *type_handler_for_comparison() const override;
const Type_handler *type_handler_for_native_format() const override; const Type_handler *type_handler_for_native_format() const override;
...@@ -6192,10 +6177,9 @@ class Type_handler_timestamp2: public Type_handler_timestamp_common ...@@ -6192,10 +6177,9 @@ class Type_handler_timestamp2: public Type_handler_timestamp_common
class Type_handler_olddecimal: public Type_handler_decimal_result class Type_handler_olddecimal: public Type_handler_decimal_result
{ {
static const Name m_name_decimal;
public: public:
virtual ~Type_handler_olddecimal() {} virtual ~Type_handler_olddecimal() {}
const Name name() const override { return m_name_decimal; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_DECIMAL; } enum_field_types field_type() const override { return MYSQL_TYPE_DECIMAL; }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
uint32 calc_pack_length(uint32 length) const override { return length; } uint32 calc_pack_length(uint32 length) const override { return length; }
...@@ -6228,10 +6212,9 @@ class Type_handler_olddecimal: public Type_handler_decimal_result ...@@ -6228,10 +6212,9 @@ class Type_handler_olddecimal: public Type_handler_decimal_result
class Type_handler_newdecimal: public Type_handler_decimal_result class Type_handler_newdecimal: public Type_handler_decimal_result
{ {
static const Name m_name_decimal;
public: public:
virtual ~Type_handler_newdecimal() {} virtual ~Type_handler_newdecimal() {}
const Name name() const override { return m_name_decimal; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_NEWDECIMAL; } enum_field_types field_type() const override { return MYSQL_TYPE_NEWDECIMAL; }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
uint32 calc_pack_length(uint32 length) const override; uint32 calc_pack_length(uint32 length) const override;
...@@ -6271,10 +6254,9 @@ class Type_handler_newdecimal: public Type_handler_decimal_result ...@@ -6271,10 +6254,9 @@ class Type_handler_newdecimal: public Type_handler_decimal_result
class Type_handler_null: public Type_handler_general_purpose_string class Type_handler_null: public Type_handler_general_purpose_string
{ {
static const Name m_name_null;
public: public:
virtual ~Type_handler_null() {} virtual ~Type_handler_null() {}
const Name name() const override { return m_name_null; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_NULL; } enum_field_types field_type() const override { return MYSQL_TYPE_NULL; }
enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr) enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
const override const override
...@@ -6339,10 +6321,9 @@ class Type_handler_longstr: public Type_handler_general_purpose_string ...@@ -6339,10 +6321,9 @@ class Type_handler_longstr: public Type_handler_general_purpose_string
class Type_handler_string: public Type_handler_longstr class Type_handler_string: public Type_handler_longstr
{ {
static const Name m_name_char;
public: public:
virtual ~Type_handler_string() {} virtual ~Type_handler_string() {}
const Name name() const override { return m_name_char; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_STRING; } enum_field_types field_type() const override { return MYSQL_TYPE_STRING; }
bool is_param_long_data_type() const override { return true; } bool is_param_long_data_type() const override { return true; }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
...@@ -6380,10 +6361,9 @@ class Type_handler_string: public Type_handler_longstr ...@@ -6380,10 +6361,9 @@ class Type_handler_string: public Type_handler_longstr
/* Old varchar */ /* Old varchar */
class Type_handler_var_string: public Type_handler_string class Type_handler_var_string: public Type_handler_string
{ {
static const Name m_name_var_string;
public: public:
virtual ~Type_handler_var_string() {} virtual ~Type_handler_var_string() {}
const Name name() const override { return m_name_var_string; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_VAR_STRING; } enum_field_types field_type() const override { return MYSQL_TYPE_VAR_STRING; }
enum_field_types real_field_type() const override { return MYSQL_TYPE_STRING; } enum_field_types real_field_type() const override { return MYSQL_TYPE_STRING; }
enum_field_types traditional_merge_field_type() const override enum_field_types traditional_merge_field_type() const override
...@@ -6412,10 +6392,9 @@ class Type_handler_var_string: public Type_handler_string ...@@ -6412,10 +6392,9 @@ class Type_handler_var_string: public Type_handler_string
class Type_handler_varchar: public Type_handler_longstr class Type_handler_varchar: public Type_handler_longstr
{ {
static const Name m_name_varchar;
public: public:
virtual ~Type_handler_varchar() {} virtual ~Type_handler_varchar() {}
const Name name() const override { return m_name_varchar; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_VARCHAR; } enum_field_types field_type() const override { return MYSQL_TYPE_VARCHAR; }
enum_field_types type_code_for_protocol() const override enum_field_types type_code_for_protocol() const override
{ {
...@@ -6469,10 +6448,9 @@ class Type_handler_varchar: public Type_handler_longstr ...@@ -6469,10 +6448,9 @@ class Type_handler_varchar: public Type_handler_longstr
class Type_handler_hex_hybrid: public Type_handler_varchar class Type_handler_hex_hybrid: public Type_handler_varchar
{ {
static const Name m_name_hex_hybrid;
public: public:
virtual ~Type_handler_hex_hybrid() {} virtual ~Type_handler_hex_hybrid() {}
const Name name() const override { return m_name_hex_hybrid; } const Name name() const override;
const Type_handler *cast_to_int_type_handler() const override; const Type_handler *cast_to_int_type_handler() const override;
const Type_handler *type_handler_for_system_time() const override; const Type_handler *type_handler_for_system_time() const override;
}; };
...@@ -6571,11 +6549,10 @@ class Type_handler_blob_common: public Type_handler_longstr ...@@ -6571,11 +6549,10 @@ class Type_handler_blob_common: public Type_handler_longstr
class Type_handler_tiny_blob: public Type_handler_blob_common class Type_handler_tiny_blob: public Type_handler_blob_common
{ {
static const Name m_name_tinyblob;
public: public:
virtual ~Type_handler_tiny_blob() {} virtual ~Type_handler_tiny_blob() {}
uint length_bytes() const override { return 1; } uint length_bytes() const override { return 1; }
const Name name() const override { return m_name_tinyblob; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_TINY_BLOB; } enum_field_types field_type() const override { return MYSQL_TYPE_TINY_BLOB; }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
uint32 calc_pack_length(uint32 length) const override; uint32 calc_pack_length(uint32 length) const override;
...@@ -6590,11 +6567,10 @@ class Type_handler_tiny_blob: public Type_handler_blob_common ...@@ -6590,11 +6567,10 @@ class Type_handler_tiny_blob: public Type_handler_blob_common
class Type_handler_medium_blob: public Type_handler_blob_common class Type_handler_medium_blob: public Type_handler_blob_common
{ {
static const Name m_name_mediumblob;
public: public:
virtual ~Type_handler_medium_blob() {} virtual ~Type_handler_medium_blob() {}
uint length_bytes() const override { return 3; } uint length_bytes() const override { return 3; }
const Name name() const override { return m_name_mediumblob; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_MEDIUM_BLOB; } enum_field_types field_type() const override { return MYSQL_TYPE_MEDIUM_BLOB; }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
uint32 calc_pack_length(uint32 length) const override; uint32 calc_pack_length(uint32 length) const override;
...@@ -6609,11 +6585,10 @@ class Type_handler_medium_blob: public Type_handler_blob_common ...@@ -6609,11 +6585,10 @@ class Type_handler_medium_blob: public Type_handler_blob_common
class Type_handler_long_blob: public Type_handler_blob_common class Type_handler_long_blob: public Type_handler_blob_common
{ {
static const Name m_name_longblob;
public: public:
virtual ~Type_handler_long_blob() {} virtual ~Type_handler_long_blob() {}
uint length_bytes() const override { return 4; } uint length_bytes() const override { return 4; }
const Name name() const override { return m_name_longblob; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_LONG_BLOB; } enum_field_types field_type() const override { return MYSQL_TYPE_LONG_BLOB; }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
uint32 calc_pack_length(uint32 length) const override; uint32 calc_pack_length(uint32 length) const override;
...@@ -6630,11 +6605,10 @@ class Type_handler_long_blob: public Type_handler_blob_common ...@@ -6630,11 +6605,10 @@ class Type_handler_long_blob: public Type_handler_blob_common
class Type_handler_blob: public Type_handler_blob_common class Type_handler_blob: public Type_handler_blob_common
{ {
static const Name m_name_blob;
public: public:
virtual ~Type_handler_blob() {} virtual ~Type_handler_blob() {}
uint length_bytes() const override { return 2; } uint length_bytes() const override { return 2; }
const Name name() const override { return m_name_blob; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_BLOB; } enum_field_types field_type() const override { return MYSQL_TYPE_BLOB; }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
uint32 calc_pack_length(uint32 length) const override; uint32 calc_pack_length(uint32 length) const override;
...@@ -6707,10 +6681,9 @@ class Type_handler_typelib: public Type_handler_general_purpose_string ...@@ -6707,10 +6681,9 @@ class Type_handler_typelib: public Type_handler_general_purpose_string
class Type_handler_enum: public Type_handler_typelib class Type_handler_enum: public Type_handler_typelib
{ {
static const Name m_name_enum;
public: public:
virtual ~Type_handler_enum() {} virtual ~Type_handler_enum() {}
const Name name() const override { return m_name_enum; } const Name name() const override;
enum_field_types real_field_type() const override { return MYSQL_TYPE_ENUM; } enum_field_types real_field_type() const override { return MYSQL_TYPE_ENUM; }
enum_field_types traditional_merge_field_type() const override enum_field_types traditional_merge_field_type() const override
{ {
...@@ -6747,10 +6720,9 @@ class Type_handler_enum: public Type_handler_typelib ...@@ -6747,10 +6720,9 @@ class Type_handler_enum: public Type_handler_typelib
class Type_handler_set: public Type_handler_typelib class Type_handler_set: public Type_handler_typelib
{ {
static const Name m_name_set;
public: public:
virtual ~Type_handler_set() {} virtual ~Type_handler_set() {}
const Name name() const override { return m_name_set; } const Name name() const override;
enum_field_types real_field_type() const override { return MYSQL_TYPE_SET; } enum_field_types real_field_type() const override { return MYSQL_TYPE_SET; }
enum_field_types traditional_merge_field_type() const override enum_field_types traditional_merge_field_type() const override
{ {
......
...@@ -23,23 +23,53 @@ ...@@ -23,23 +23,53 @@
#include "sql_type_geom.h" #include "sql_type_geom.h"
#include "item_geofunc.h" #include "item_geofunc.h"
const Name const Name Type_handler_geometry::name() const
Type_handler_geometry:: {
m_name_geometry(STRING_WITH_LEN("geometry")), static const Name tmp(STRING_WITH_LEN("geometry"));
Type_handler_point:: return tmp;
m_name_point(STRING_WITH_LEN("point")), }
Type_handler_linestring::
m_name_linestring(STRING_WITH_LEN("linestring")), const Name Type_handler_point::name() const
Type_handler_polygon:: {
m_name_polygon(STRING_WITH_LEN("polygon")), static const Name tmp(STRING_WITH_LEN("point"));
Type_handler_multipoint:: return tmp;
m_name_multipoint(STRING_WITH_LEN("multipoint")), }
Type_handler_multilinestring::
m_name_multilinestring(STRING_WITH_LEN("multilinestring")), const Name Type_handler_linestring::name() const
Type_handler_multipolygon:: {
m_name_multipolygon(STRING_WITH_LEN("multipolygon")), static const Name tmp(STRING_WITH_LEN("linestring"));
Type_handler_geometrycollection:: return tmp;
m_name_geometrycollection(STRING_WITH_LEN("geometrycollection")); }
const Name Type_handler_polygon::name() const
{
static const Name tmp(STRING_WITH_LEN("polygon"));
return tmp;
}
const Name Type_handler_multipoint::name() const
{
static const Name tmp(STRING_WITH_LEN("multipoint"));
return tmp;
}
const Name Type_handler_multilinestring::name() const
{
static const Name tmp(STRING_WITH_LEN("multilinestring"));
return tmp;
}
const Name Type_handler_multipolygon::name() const
{
static const Name tmp(STRING_WITH_LEN("multipolygon"));
return tmp;
}
const Name Type_handler_geometrycollection::name() const
{
static const Name tmp(STRING_WITH_LEN("geometrycollection"));
return tmp;
}
Type_handler_geometry type_handler_geometry; Type_handler_geometry type_handler_geometry;
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
class Type_handler_geometry: public Type_handler_string_result class Type_handler_geometry: public Type_handler_string_result
{ {
static const Name m_name_geometry;
public: public:
enum geometry_types enum geometry_types
{ {
...@@ -42,7 +41,7 @@ class Type_handler_geometry: public Type_handler_string_result ...@@ -42,7 +41,7 @@ class Type_handler_geometry: public Type_handler_string_result
static const Type_handler_geometry *type_handler_geom_by_type(uint type); static const Type_handler_geometry *type_handler_geom_by_type(uint type);
public: public:
virtual ~Type_handler_geometry() {} virtual ~Type_handler_geometry() {}
const Name name() const override { return m_name_geometry; } const Name name() const override;
enum_field_types field_type() const override { return MYSQL_TYPE_GEOMETRY; } enum_field_types field_type() const override { return MYSQL_TYPE_GEOMETRY; }
bool is_param_long_data_type() const override { return true; } bool is_param_long_data_type() const override { return true; }
uint32 max_display_length_for_field(const Conv_source &src) const override; uint32 max_display_length_for_field(const Conv_source &src) const override;
...@@ -172,12 +171,11 @@ class Type_handler_geometry: public Type_handler_string_result ...@@ -172,12 +171,11 @@ class Type_handler_geometry: public Type_handler_string_result
class Type_handler_point: public Type_handler_geometry class Type_handler_point: public Type_handler_geometry
{ {
static const Name m_name_point;
// Binary length of a POINT value: 4 byte SRID + 21 byte WKB POINT // Binary length of a POINT value: 4 byte SRID + 21 byte WKB POINT
static uint octet_length() { return 25; } static uint octet_length() { return 25; }
public: public:
geometry_types geometry_type() const override { return GEOM_POINT; } geometry_types geometry_type() const override { return GEOM_POINT; }
const Name name() const override { return m_name_point; } const Name name() const override;
Item *make_constructor_item(THD *thd, List<Item> *args) const override; Item *make_constructor_item(THD *thd, List<Item> *args) const override;
bool Key_part_spec_init_primary(Key_part_spec *part, bool Key_part_spec_init_primary(Key_part_spec *part,
const Column_definition &def, const Column_definition &def,
...@@ -197,60 +195,54 @@ class Type_handler_point: public Type_handler_geometry ...@@ -197,60 +195,54 @@ class Type_handler_point: public Type_handler_geometry
class Type_handler_linestring: public Type_handler_geometry class Type_handler_linestring: public Type_handler_geometry
{ {
static const Name m_name_linestring;
public: public:
geometry_types geometry_type() const override { return GEOM_LINESTRING; } geometry_types geometry_type() const override { return GEOM_LINESTRING; }
const Name name() const override { return m_name_linestring; } const Name name() const override;
Item *make_constructor_item(THD *thd, List<Item> *args) const override; Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
class Type_handler_polygon: public Type_handler_geometry class Type_handler_polygon: public Type_handler_geometry
{ {
static const Name m_name_polygon;
public: public:
geometry_types geometry_type() const override { return GEOM_POLYGON; } geometry_types geometry_type() const override { return GEOM_POLYGON; }
const Name name() const override { return m_name_polygon; } const Name name() const override;
Item *make_constructor_item(THD *thd, List<Item> *args) const override; Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
class Type_handler_multipoint: public Type_handler_geometry class Type_handler_multipoint: public Type_handler_geometry
{ {
static const Name m_name_multipoint;
public: public:
geometry_types geometry_type() const override { return GEOM_MULTIPOINT; } geometry_types geometry_type() const override { return GEOM_MULTIPOINT; }
const Name name() const override { return m_name_multipoint; } const Name name() const override;
Item *make_constructor_item(THD *thd, List<Item> *args) const override; Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
class Type_handler_multilinestring: public Type_handler_geometry class Type_handler_multilinestring: public Type_handler_geometry
{ {
static const Name m_name_multilinestring;
public: public:
geometry_types geometry_type() const override { return GEOM_MULTILINESTRING; } geometry_types geometry_type() const override { return GEOM_MULTILINESTRING; }
const Name name() const override { return m_name_multilinestring; } const Name name() const override;
Item *make_constructor_item(THD *thd, List<Item> *args) const override; Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
class Type_handler_multipolygon: public Type_handler_geometry class Type_handler_multipolygon: public Type_handler_geometry
{ {
static const Name m_name_multipolygon;
public: public:
geometry_types geometry_type() const override { return GEOM_MULTIPOLYGON; } geometry_types geometry_type() const override { return GEOM_MULTIPOLYGON; }
const Name name() const override { return m_name_multipolygon; } const Name name() const override;
Item *make_constructor_item(THD *thd, List<Item> *args) const override; Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
class Type_handler_geometrycollection: public Type_handler_geometry class Type_handler_geometrycollection: public Type_handler_geometry
{ {
static const Name m_name_geometrycollection;
public: public:
geometry_types geometry_type() const override { return GEOM_GEOMETRYCOLLECTION; } geometry_types geometry_type() const override { return GEOM_GEOMETRYCOLLECTION; }
const Name name() const override { return m_name_geometrycollection; } const Name name() const override;
Item *make_constructor_item(THD *thd, List<Item> *args) const override; Item *make_constructor_item(THD *thd, List<Item> *args) const override;
}; };
......
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