cleanup: data type plugins
simplify type naming (less boilerplate code). don't force a plugin to specify the name twice.
This commit is contained in:
parent
779978217c
commit
00c3a28820
@ -36,7 +36,7 @@
|
||||
struct st_mariadb_data_type
|
||||
{
|
||||
int interface_version;
|
||||
const class Type_handler *type_handler;
|
||||
class Type_handler *type_handler;
|
||||
};
|
||||
|
||||
|
||||
|
@ -625,5 +625,5 @@ void thd_wakeup_subsequent_commits(THD* thd, int wakeup_error);
|
||||
struct st_mariadb_data_type
|
||||
{
|
||||
int interface_version;
|
||||
const class Type_handler *type_handler;
|
||||
class Type_handler *type_handler;
|
||||
};
|
||||
|
@ -176,7 +176,7 @@ maria_declare_plugin(type_inet)
|
||||
{
|
||||
MariaDB_DATA_TYPE_PLUGIN, // the plugin type (see include/mysql/plugin.h)
|
||||
&plugin_descriptor_type_inet6,// pointer to type-specific plugin descriptor
|
||||
type_handler_inet6.name().ptr(),// plugin name
|
||||
"inet6", // plugin name
|
||||
"MariaDB Corporation", // plugin author
|
||||
"Data type INET6", // the plugin description
|
||||
PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
|
||||
|
@ -318,11 +318,6 @@ class Type_handler_inet6: public Type_handler
|
||||
public:
|
||||
~Type_handler_inet6() override {}
|
||||
|
||||
const Name name() const override
|
||||
{
|
||||
static const Name name(STRING_WITH_LEN("inet6"));
|
||||
return name;
|
||||
}
|
||||
const Type_collection *type_collection() const override;
|
||||
const Name &default_value() const override
|
||||
{
|
||||
|
@ -64,11 +64,6 @@ public:
|
||||
class Type_handler_test_int8: public Type_handler_longlong
|
||||
{
|
||||
public:
|
||||
const Name name() const override
|
||||
{
|
||||
static Name name(STRING_WITH_LEN("test_int8"));
|
||||
return name;
|
||||
}
|
||||
const Type_collection *type_collection() const override
|
||||
{
|
||||
return &type_collection_test;
|
||||
@ -126,11 +121,6 @@ public:
|
||||
class Type_handler_test_double: public Type_handler_double
|
||||
{
|
||||
public:
|
||||
const Name name() const override
|
||||
{
|
||||
static Name name(STRING_WITH_LEN("test_double"));
|
||||
return name;
|
||||
}
|
||||
const Type_collection *type_collection() const override
|
||||
{
|
||||
return &type_collection_test;
|
||||
@ -302,7 +292,7 @@ maria_declare_plugin(type_test)
|
||||
{
|
||||
MariaDB_DATA_TYPE_PLUGIN, // the plugin type (see include/mysql/plugin.h)
|
||||
&plugin_descriptor_type_test_int8, // pointer to type-specific plugin descriptor
|
||||
type_handler_test_int8.name().ptr(), // plugin name
|
||||
"test_int8", // plugin name
|
||||
"MariaDB Corporation", // plugin author
|
||||
"Data type TEST_INT8", // the plugin description
|
||||
PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
|
||||
@ -317,7 +307,7 @@ maria_declare_plugin(type_test)
|
||||
{
|
||||
MariaDB_DATA_TYPE_PLUGIN, // the plugin type (see include/mysql/plugin.h)
|
||||
&plugin_descriptor_type_test_double, // pointer to type-specific plugin descriptor
|
||||
type_handler_test_double.name().ptr(), // plugin name
|
||||
"test_double", // plugin name
|
||||
"MariaDB Corporation", // plugin author
|
||||
"Data type TEST_DOUBLE", // the plugin description
|
||||
PLUGIN_LICENSE_GPL, // the plugin license (see include/mysql/plugin.h)
|
||||
|
20
sql/field.h
20
sql/field.h
@ -2421,7 +2421,9 @@ class Field_tiny :public Field_int
|
||||
{
|
||||
const Type_handler_general_purpose_int *type_handler_priv() const
|
||||
{
|
||||
return is_unsigned() ? &type_handler_utiny : &type_handler_stiny;
|
||||
if (is_unsigned())
|
||||
return &type_handler_utiny;
|
||||
return &type_handler_stiny;
|
||||
}
|
||||
public:
|
||||
Field_tiny(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||
@ -2476,7 +2478,9 @@ class Field_short :public Field_int
|
||||
{
|
||||
const Type_handler_general_purpose_int *type_handler_priv() const
|
||||
{
|
||||
return is_unsigned() ? &type_handler_ushort : &type_handler_sshort;
|
||||
if (is_unsigned())
|
||||
return &type_handler_ushort;
|
||||
return &type_handler_sshort;
|
||||
}
|
||||
public:
|
||||
Field_short(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||
@ -2527,7 +2531,9 @@ class Field_medium :public Field_int
|
||||
{
|
||||
const Type_handler_general_purpose_int *type_handler_priv() const
|
||||
{
|
||||
return is_unsigned() ? &type_handler_uint24 : &type_handler_sint24;
|
||||
if (is_unsigned())
|
||||
return &type_handler_uint24;
|
||||
return &type_handler_sint24;
|
||||
}
|
||||
public:
|
||||
Field_medium(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||
@ -2571,7 +2577,9 @@ class Field_long :public Field_int
|
||||
{
|
||||
const Type_handler_general_purpose_int *type_handler_priv() const
|
||||
{
|
||||
return is_unsigned() ? &type_handler_ulong : &type_handler_slong;
|
||||
if (is_unsigned())
|
||||
return &type_handler_ulong;
|
||||
return &type_handler_slong;
|
||||
}
|
||||
public:
|
||||
Field_long(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||
@ -2626,7 +2634,9 @@ class Field_longlong :public Field_int
|
||||
{
|
||||
const Type_handler_general_purpose_int *type_handler_priv() const
|
||||
{
|
||||
return is_unsigned() ? &type_handler_ulonglong : &type_handler_slonglong;
|
||||
if (is_unsigned())
|
||||
return &type_handler_ulonglong;
|
||||
return &type_handler_slonglong;
|
||||
}
|
||||
public:
|
||||
Field_longlong(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||
|
@ -5423,8 +5423,10 @@ bool Item_func_get_user_var::fix_length_and_dec()
|
||||
collation.set(&my_charset_numeric, DERIVATION_NUMERIC);
|
||||
fix_char_length(MAX_BIGINT_WIDTH);
|
||||
decimals=0;
|
||||
set_handler(unsigned_flag ? &type_handler_ulonglong :
|
||||
&type_handler_slonglong);
|
||||
if (unsigned_flag)
|
||||
set_handler(&type_handler_ulonglong);
|
||||
else
|
||||
set_handler(&type_handler_slonglong);
|
||||
break;
|
||||
case STRING_RESULT:
|
||||
collation.set(m_var_entry->charset(), DERIVATION_IMPLICIT);
|
||||
|
@ -2523,8 +2523,9 @@ public:
|
||||
String *val_str(String *str);
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
return unsigned_flag ? &type_handler_ulonglong :
|
||||
&type_handler_slonglong;
|
||||
if (unsigned_flag)
|
||||
return &type_handler_ulonglong;
|
||||
return &type_handler_slonglong;
|
||||
}
|
||||
bool fix_length_and_dec() { decimals= 0; max_length= 21; return FALSE; }
|
||||
Item *get_copy(THD *thd)
|
||||
|
@ -1649,8 +1649,9 @@ public:
|
||||
my_decimal *val_decimal(my_decimal *);
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
return unsigned_flag ? &type_handler_ulonglong :
|
||||
&type_handler_slonglong;
|
||||
if (unsigned_flag)
|
||||
return &type_handler_ulonglong;
|
||||
return &type_handler_slonglong;
|
||||
}
|
||||
bool fix_length_and_dec() { decimals=0; max_length=21; return FALSE; }
|
||||
Item *copy_or_same(THD* thd);
|
||||
|
@ -109,8 +109,9 @@ public:
|
||||
{ max_length=11; }
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
return unsigned_flag ? &type_handler_ulonglong :
|
||||
&type_handler_slonglong;
|
||||
if (unsigned_flag)
|
||||
return &type_handler_ulonglong;
|
||||
return &type_handler_slonglong;
|
||||
}
|
||||
void set(double nr) { value=(longlong) nr; }
|
||||
void set(longlong nr) { value=nr; }
|
||||
|
@ -106,6 +106,8 @@ extern int finalize_audit_plugin(st_plugin_int *plugin);
|
||||
extern int initialize_encryption_plugin(st_plugin_int *plugin);
|
||||
extern int finalize_encryption_plugin(st_plugin_int *plugin);
|
||||
|
||||
extern int initialize_data_type_plugin(st_plugin_int *plugin);
|
||||
|
||||
/*
|
||||
The number of elements in both plugin_type_initialize and
|
||||
plugin_type_deinitialize should equal to the number of plugins
|
||||
@ -114,8 +116,8 @@ extern int finalize_encryption_plugin(st_plugin_int *plugin);
|
||||
plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
|
||||
{
|
||||
0, ha_initialize_handlerton, 0, 0,initialize_schema_table,
|
||||
initialize_audit_plugin, 0, 0, 0, initialize_encryption_plugin, 0,
|
||||
0 // FUNCTION
|
||||
initialize_audit_plugin, 0, 0, 0, initialize_encryption_plugin,
|
||||
initialize_data_type_plugin, 0
|
||||
};
|
||||
|
||||
plugin_type_init plugin_type_deinitialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
|
||||
|
308
sql/sql_type.cc
308
sql/sql_type.cc
@ -32,61 +32,62 @@ const DTCollation &DTCollation_numeric::singleton()
|
||||
return tmp;
|
||||
}
|
||||
|
||||
Named_type_handler<Type_handler_row> type_handler_row("row");
|
||||
|
||||
Type_handler_row type_handler_row;
|
||||
Named_type_handler<Type_handler_null> type_handler_null("null");
|
||||
|
||||
Type_handler_null type_handler_null;
|
||||
Named_type_handler<Type_handler_bool> type_handler_bool("boolean");
|
||||
Named_type_handler<Type_handler_tiny> type_handler_stiny("tinyint");
|
||||
Named_type_handler<Type_handler_short> type_handler_sshort("smallint");
|
||||
Named_type_handler<Type_handler_long> type_handler_slong("int");
|
||||
Named_type_handler<Type_handler_int24> type_handler_sint24("mediumint");
|
||||
Named_type_handler<Type_handler_longlong> type_handler_slonglong("bigint");
|
||||
Named_type_handler<Type_handler_utiny> type_handler_utiny("tiny unsigned");
|
||||
Named_type_handler<Type_handler_ushort> type_handler_ushort("smallint unsigned");
|
||||
Named_type_handler<Type_handler_ulong> type_handler_ulong("int unsigned");
|
||||
Named_type_handler<Type_handler_uint24> type_handler_uint24("mediumint unsigned");
|
||||
Named_type_handler<Type_handler_ulonglong> type_handler_ulonglong("bigint unsigned");
|
||||
Named_type_handler<Type_handler_vers_trx_id> type_handler_vers_trx_id("bigint unsigned");
|
||||
Named_type_handler<Type_handler_float> type_handler_float("float");
|
||||
Named_type_handler<Type_handler_double> type_handler_double("double");
|
||||
Named_type_handler<Type_handler_bit> type_handler_bit("bit");
|
||||
|
||||
Type_handler_bool type_handler_bool;
|
||||
Type_handler_tiny type_handler_stiny;
|
||||
Type_handler_short type_handler_sshort;
|
||||
Type_handler_long type_handler_slong;
|
||||
Type_handler_int24 type_handler_sint24;
|
||||
Type_handler_longlong type_handler_slonglong;
|
||||
Type_handler_utiny type_handler_utiny;
|
||||
Type_handler_ushort type_handler_ushort;
|
||||
Type_handler_ulong type_handler_ulong;
|
||||
Type_handler_uint24 type_handler_uint24;
|
||||
Type_handler_ulonglong type_handler_ulonglong;
|
||||
Type_handler_vers_trx_id type_handler_vers_trx_id;
|
||||
Type_handler_float type_handler_float;
|
||||
Type_handler_double type_handler_double;
|
||||
Type_handler_bit type_handler_bit;
|
||||
Named_type_handler<Type_handler_olddecimal> type_handler_olddecimal("decimal");
|
||||
Named_type_handler<Type_handler_newdecimal> type_handler_newdecimal("decimal");
|
||||
|
||||
Type_handler_olddecimal type_handler_olddecimal;
|
||||
Type_handler_newdecimal type_handler_newdecimal;
|
||||
Named_type_handler<Type_handler_year> type_handler_year("year");
|
||||
Named_type_handler<Type_handler_year> type_handler_year2("year");
|
||||
Named_type_handler<Type_handler_time> type_handler_time("time");
|
||||
Named_type_handler<Type_handler_date> type_handler_date("date");
|
||||
Named_type_handler<Type_handler_timestamp> type_handler_timestamp("timestamp");
|
||||
Named_type_handler<Type_handler_timestamp2> type_handler_timestamp2("timestamp");
|
||||
Named_type_handler<Type_handler_datetime> type_handler_datetime("datetime");
|
||||
Named_type_handler<Type_handler_time2> type_handler_time2("time");
|
||||
Named_type_handler<Type_handler_newdate> type_handler_newdate("date");
|
||||
Named_type_handler<Type_handler_datetime2> type_handler_datetime2("datetime");
|
||||
|
||||
Type_handler_year type_handler_year;
|
||||
Type_handler_year type_handler_year2;
|
||||
Type_handler_time type_handler_time;
|
||||
Type_handler_date type_handler_date;
|
||||
Type_handler_timestamp type_handler_timestamp;
|
||||
Type_handler_timestamp2 type_handler_timestamp2;
|
||||
Type_handler_datetime type_handler_datetime;
|
||||
Type_handler_time2 type_handler_time2;
|
||||
Type_handler_newdate type_handler_newdate;
|
||||
Type_handler_datetime2 type_handler_datetime2;
|
||||
Named_type_handler<Type_handler_enum> type_handler_enum("enum");
|
||||
Named_type_handler<Type_handler_set> type_handler_set("set");
|
||||
|
||||
Type_handler_enum type_handler_enum;
|
||||
Type_handler_set type_handler_set;
|
||||
Named_type_handler<Type_handler_string> type_handler_string("char");
|
||||
Named_type_handler<Type_handler_var_string> type_handler_var_string("varchar");
|
||||
Named_type_handler<Type_handler_varchar> type_handler_varchar("varchar");
|
||||
Named_type_handler<Type_handler_hex_hybrid> type_handler_hex_hybrid("hex_hybrid");
|
||||
Named_type_handler<Type_handler_varchar_compressed> type_handler_varchar_compressed("varchar");
|
||||
|
||||
Type_handler_string type_handler_string;
|
||||
Type_handler_var_string type_handler_var_string;
|
||||
Type_handler_varchar type_handler_varchar;
|
||||
Type_handler_hex_hybrid type_handler_hex_hybrid;
|
||||
Type_handler_varchar_compressed type_handler_varchar_compressed;
|
||||
|
||||
Type_handler_tiny_blob type_handler_tiny_blob;
|
||||
Type_handler_medium_blob type_handler_medium_blob;
|
||||
Type_handler_long_blob type_handler_long_blob;
|
||||
Type_handler_blob type_handler_blob;
|
||||
Type_handler_blob_compressed type_handler_blob_compressed;
|
||||
Named_type_handler<Type_handler_tiny_blob> type_handler_tiny_blob("tinyblob");
|
||||
Named_type_handler<Type_handler_medium_blob> type_handler_medium_blob("mediumblob");
|
||||
Named_type_handler<Type_handler_long_blob> type_handler_long_blob("longblob");
|
||||
Named_type_handler<Type_handler_blob> type_handler_blob("blob");
|
||||
Named_type_handler<Type_handler_blob_compressed> type_handler_blob_compressed("blob");
|
||||
|
||||
Type_handler_interval_DDhhmmssff type_handler_interval_DDhhmmssff;
|
||||
|
||||
Vers_type_timestamp vers_type_timestamp;
|
||||
Vers_type_trx vers_type_trx;
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
|
||||
class Type_collection_std: public Type_collection
|
||||
@ -1460,210 +1461,6 @@ uint Type_handler_datetime::m_hires_bytes[MAX_DATETIME_PRECISION + 1]=
|
||||
uint Type_handler_time::m_hires_bytes[MAX_DATETIME_PRECISION + 1]=
|
||||
{ 3, 4, 4, 5, 5, 5, 6 };
|
||||
|
||||
/***************************************************************************/
|
||||
const Name Type_handler_row::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("row"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const Name Type_handler_null::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("null"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const Name Type_handler_string::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("char"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const Name Type_handler_var_string::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("varchar"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const Name Type_handler_varchar::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("varchar"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const Name Type_handler_hex_hybrid::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("hex_hybrid"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const Name Type_handler_tiny_blob::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("tinyblob"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("tiny unsigned"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
const Name Type_handler_ushort::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("smallint unsigned"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
const Name Type_handler_uint24::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("mediumint unsigned"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
const Name Type_handler_ulong::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("int unsigned"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
const Name Type_handler_ulonglong::name() const
|
||||
{
|
||||
static Name tmp(STRING_WITH_LEN("bigint unsigned"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
const Name Type_handler::version() const
|
||||
@ -4889,9 +4686,9 @@ bool Type_handler_int_result::
|
||||
func->unsigned_flag is not reliably set yet.
|
||||
It will be set by the call below (copied from args[0]).
|
||||
*/
|
||||
const Type_handler *h= is_unsigned() ?
|
||||
&type_handler_ulonglong :
|
||||
&type_handler_slonglong;
|
||||
const Type_handler *h= is_unsigned()
|
||||
? (Type_handler *)&type_handler_ulonglong
|
||||
: (Type_handler *)&type_handler_slonglong;
|
||||
return func->fix_length_and_dec_numeric(h);
|
||||
}
|
||||
|
||||
@ -9202,3 +8999,16 @@ Charset::eq_collation_specific_names(CHARSET_INFO *cs) const
|
||||
LEX_CSTRING name1= Charset(cs).collation_specific_name();
|
||||
return name0.length && !cmp(&name0, &name1);
|
||||
}
|
||||
|
||||
int initialize_data_type_plugin(st_plugin_int *plugin)
|
||||
{
|
||||
st_mariadb_data_type *data= (st_mariadb_data_type*) plugin->plugin->info;
|
||||
data->type_handler->set_name(Name(plugin->name));
|
||||
if (plugin->plugin->init && plugin->plugin->init(NULL))
|
||||
{
|
||||
sql_print_error("Plugin '%s' init function returned error.",
|
||||
plugin->name.str);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
154
sql/sql_type.h
154
sql/sql_type.h
@ -3111,6 +3111,11 @@ public:
|
||||
LEX_CSTRING::str= str_arg;
|
||||
LEX_CSTRING::length= length_arg;
|
||||
}
|
||||
Name(const LEX_CSTRING &lcs)
|
||||
{
|
||||
LEX_CSTRING::str= lcs.str;
|
||||
LEX_CSTRING::length= lcs.length;
|
||||
}
|
||||
const char *ptr() const { return LEX_CSTRING::str; }
|
||||
uint length() const { return (uint) LEX_CSTRING::length; }
|
||||
const LEX_CSTRING &lex_cstring() const { return *this; }
|
||||
@ -3291,7 +3296,7 @@ public:
|
||||
const Column_definition *row_start,
|
||||
const Column_definition *row_end) const;
|
||||
};
|
||||
extern MYSQL_PLUGIN_IMPORT Vers_type_timestamp vers_type_timestamp;
|
||||
extern Vers_type_timestamp vers_type_timestamp;
|
||||
|
||||
|
||||
class Vers_type_trx: public Vers_type_handler
|
||||
@ -3305,11 +3310,12 @@ public:
|
||||
const Column_definition *row_start,
|
||||
const Column_definition *row_end) const;
|
||||
};
|
||||
extern MYSQL_PLUGIN_IMPORT Vers_type_trx vers_type_trx;
|
||||
extern Vers_type_trx vers_type_trx;
|
||||
|
||||
|
||||
class Type_handler
|
||||
{
|
||||
Name m_name;
|
||||
protected:
|
||||
const Name version_mysql56() const;
|
||||
const Name version_mariadb53() const;
|
||||
@ -3320,10 +3326,8 @@ protected:
|
||||
bool maybe_null, bool null_value,
|
||||
bool unsigned_flag,
|
||||
longlong value) const;
|
||||
bool
|
||||
Item_func_or_sum_illegal_param(const char *name) const;
|
||||
bool
|
||||
Item_func_or_sum_illegal_param(const Item_func_or_sum *) const;
|
||||
bool Item_func_or_sum_illegal_param(const char *name) const;
|
||||
bool Item_func_or_sum_illegal_param(const Item_func_or_sum *) const;
|
||||
bool check_null(const Item *item, st_value *value) const;
|
||||
bool Item_send_str(Item *item, Protocol *protocol, st_value *buf) const;
|
||||
bool Item_send_tiny(Item *item, Protocol *protocol, st_value *buf) const;
|
||||
@ -3377,7 +3381,9 @@ public:
|
||||
static void partition_field_type_not_allowed(const LEX_CSTRING &field_name);
|
||||
static bool partition_field_check_result_type(Item *item,
|
||||
Item_result expected_type);
|
||||
virtual const Name name() const= 0;
|
||||
|
||||
void set_name(Name n) { DBUG_ASSERT(!m_name.ptr()); m_name= n; }
|
||||
const Name name() const { return m_name; }
|
||||
virtual const Name version() const;
|
||||
virtual const Name &default_value() const= 0;
|
||||
virtual uint32 flags() const { return 0; }
|
||||
@ -3536,6 +3542,7 @@ public:
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Type_handler() : m_name(0,0) {}
|
||||
virtual ~Type_handler() {}
|
||||
/**
|
||||
Determines MariaDB traditional scalar data types that always present
|
||||
@ -4020,7 +4027,6 @@ class Type_handler_row: public Type_handler
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_row() {}
|
||||
const Name name() const override;
|
||||
const Name &default_value() const override;
|
||||
bool validate_implicit_default_value(THD *thd,
|
||||
const Column_definition &def) const
|
||||
@ -5179,7 +5185,6 @@ class Type_handler_tiny: public Type_handler_general_purpose_int
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_tiny() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_TINY; }
|
||||
const Type_handler *type_handler_unsigned() const override;
|
||||
const Type_handler *type_handler_signed() const override;
|
||||
@ -5223,7 +5228,6 @@ public:
|
||||
class Type_handler_utiny: public Type_handler_tiny
|
||||
{
|
||||
public:
|
||||
const Name name() const override;
|
||||
uint flags() const override { return UNSIGNED_FLAG; }
|
||||
const Type_limits_int *type_limits_int() const override;
|
||||
};
|
||||
@ -5233,7 +5237,6 @@ class Type_handler_short: public Type_handler_general_purpose_int
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_short() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_SHORT; }
|
||||
const Type_handler *type_handler_unsigned() const override;
|
||||
const Type_handler *type_handler_signed() const override;
|
||||
@ -5277,7 +5280,6 @@ public:
|
||||
class Type_handler_ushort: public Type_handler_short
|
||||
{
|
||||
public:
|
||||
const Name name() const override;
|
||||
uint flags() const override { return UNSIGNED_FLAG; }
|
||||
const Type_limits_int *type_limits_int() const override;
|
||||
};
|
||||
@ -5287,7 +5289,6 @@ class Type_handler_long: public Type_handler_general_purpose_int
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_long() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_LONG; }
|
||||
const Type_handler *type_handler_unsigned() const override;
|
||||
const Type_handler *type_handler_signed() const override;
|
||||
@ -5331,7 +5332,6 @@ public:
|
||||
class Type_handler_ulong: public Type_handler_long
|
||||
{
|
||||
public:
|
||||
const Name name() const override;
|
||||
uint flags() const override { return UNSIGNED_FLAG; }
|
||||
const Type_limits_int *type_limits_int() const override;
|
||||
};
|
||||
@ -5340,7 +5340,6 @@ public:
|
||||
class Type_handler_bool: public Type_handler_long
|
||||
{
|
||||
public:
|
||||
const Name name() const override;
|
||||
bool is_bool_type() const override { return true; }
|
||||
const Type_handler *type_handler_unsigned() const override;
|
||||
const Type_handler *type_handler_signed() const override;
|
||||
@ -5353,7 +5352,6 @@ class Type_handler_longlong: public Type_handler_general_purpose_int
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_longlong() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override{ return MYSQL_TYPE_LONGLONG; }
|
||||
const Type_handler *type_handler_unsigned() const override;
|
||||
const Type_handler *type_handler_signed() const override;
|
||||
@ -5401,7 +5399,6 @@ public:
|
||||
class Type_handler_ulonglong: public Type_handler_longlong
|
||||
{
|
||||
public:
|
||||
const Name name() const override;
|
||||
uint flags() const override { return UNSIGNED_FLAG; }
|
||||
const Type_limits_int *type_limits_int() const override;
|
||||
};
|
||||
@ -5423,7 +5420,6 @@ class Type_handler_int24: public Type_handler_general_purpose_int
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_int24() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_INT24; }
|
||||
const Type_handler *type_handler_unsigned() const override;
|
||||
const Type_handler *type_handler_signed() const override;
|
||||
@ -5460,7 +5456,6 @@ public:
|
||||
class Type_handler_uint24: public Type_handler_int24
|
||||
{
|
||||
public:
|
||||
const Name name() const override;
|
||||
uint flags() const override { return UNSIGNED_FLAG; }
|
||||
const Type_limits_int *type_limits_int() const override;
|
||||
};
|
||||
@ -5470,7 +5465,6 @@ class Type_handler_year: public Type_handler_int_result
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_year() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_YEAR; }
|
||||
uint flags() const override { return UNSIGNED_FLAG; }
|
||||
protocol_send_type_t protocol_send_type() const override
|
||||
@ -5521,7 +5515,6 @@ class Type_handler_bit: public Type_handler_int_result
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_bit() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_BIT; }
|
||||
uint flags() const override { return UNSIGNED_FLAG; }
|
||||
protocol_send_type_t protocol_send_type() const override
|
||||
@ -5581,7 +5574,6 @@ class Type_handler_float: public Type_handler_real_result
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_float() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_FLOAT; }
|
||||
protocol_send_type_t protocol_send_type() const override
|
||||
{
|
||||
@ -5635,7 +5627,6 @@ class Type_handler_double: public Type_handler_real_result
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_double() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_DOUBLE; }
|
||||
protocol_send_type_t protocol_send_type() const override
|
||||
{
|
||||
@ -5690,7 +5681,6 @@ class Type_handler_time_common: public Type_handler_temporal_result
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_time_common() { }
|
||||
const Name name() const override;
|
||||
const Name &default_value() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_TIME; }
|
||||
enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
|
||||
@ -5894,7 +5884,6 @@ class Type_handler_date_common: public Type_handler_temporal_with_date
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_date_common() {}
|
||||
const Name name() const override;
|
||||
const Name &default_value() const override;
|
||||
const Type_handler *type_handler_for_comparison() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_DATE; }
|
||||
@ -6020,7 +6009,6 @@ class Type_handler_datetime_common: public Type_handler_temporal_with_date
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_datetime_common() {}
|
||||
const Name name() const override;
|
||||
const Name &default_value() const override;
|
||||
const Type_handler *type_handler_for_comparison() const override;
|
||||
enum_field_types field_type() const override
|
||||
@ -6170,7 +6158,6 @@ protected:
|
||||
bool TIME_to_native(THD *, const MYSQL_TIME *from, Native *to, uint dec) const;
|
||||
public:
|
||||
virtual ~Type_handler_timestamp_common() {}
|
||||
const Name name() const override;
|
||||
const Name &default_value() const override;
|
||||
const Type_handler *type_handler_for_comparison() const override;
|
||||
const Type_handler *type_handler_for_native_format() const override;
|
||||
@ -6333,7 +6320,6 @@ class Type_handler_olddecimal: public Type_handler_decimal_result
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_olddecimal() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_DECIMAL; }
|
||||
uint32 max_display_length_for_field(const Conv_source &src) const override;
|
||||
uint32 calc_pack_length(uint32 length) const override { return length; }
|
||||
@ -6368,7 +6354,6 @@ class Type_handler_newdecimal: public Type_handler_decimal_result
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_newdecimal() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_NEWDECIMAL; }
|
||||
uint32 max_display_length_for_field(const Conv_source &src) const override;
|
||||
uint32 calc_pack_length(uint32 length) const override;
|
||||
@ -6411,7 +6396,6 @@ class Type_handler_null: public Type_handler_general_purpose_string
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_null() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_NULL; }
|
||||
enum_dynamic_column_type dyncol_type(const Type_all_attributes *attr)
|
||||
const override
|
||||
@ -6481,7 +6465,6 @@ class Type_handler_string: public Type_handler_longstr
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_string() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_STRING; }
|
||||
ulong KEY_pack_flags(uint column_nr) const override
|
||||
{
|
||||
@ -6536,7 +6519,6 @@ class Type_handler_var_string: public Type_handler_string
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_var_string() {}
|
||||
const Name name() const override;
|
||||
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 traditional_merge_field_type() const override
|
||||
@ -6567,7 +6549,6 @@ class Type_handler_varchar: public Type_handler_longstr
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_varchar() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_VARCHAR; }
|
||||
ulong KEY_pack_flags(uint column_nr) const override
|
||||
{
|
||||
@ -6640,7 +6621,6 @@ class Type_handler_hex_hybrid: public Type_handler_varchar
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_hex_hybrid() {}
|
||||
const Name name() const override;
|
||||
const Type_handler *cast_to_int_type_handler() const override;
|
||||
};
|
||||
|
||||
@ -6761,7 +6741,6 @@ class Type_handler_tiny_blob: public Type_handler_blob_common
|
||||
public:
|
||||
virtual ~Type_handler_tiny_blob() {}
|
||||
uint length_bytes() const override { return 1; }
|
||||
const Name name() const override;
|
||||
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 calc_pack_length(uint32 length) const override;
|
||||
@ -6779,7 +6758,6 @@ class Type_handler_medium_blob: public Type_handler_blob_common
|
||||
public:
|
||||
virtual ~Type_handler_medium_blob() {}
|
||||
uint length_bytes() const override { return 3; }
|
||||
const Name name() const override;
|
||||
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 calc_pack_length(uint32 length) const override;
|
||||
@ -6797,7 +6775,6 @@ class Type_handler_long_blob: public Type_handler_blob_common
|
||||
public:
|
||||
virtual ~Type_handler_long_blob() {}
|
||||
uint length_bytes() const override { return 4; }
|
||||
const Name name() const override;
|
||||
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 calc_pack_length(uint32 length) const override;
|
||||
@ -6817,7 +6794,6 @@ class Type_handler_blob: public Type_handler_blob_common
|
||||
public:
|
||||
virtual ~Type_handler_blob() {}
|
||||
uint length_bytes() const override { return 2; }
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_BLOB; }
|
||||
uint32 max_display_length_for_field(const Conv_source &src) const override;
|
||||
uint32 calc_pack_length(uint32 length) const override;
|
||||
@ -6896,7 +6872,6 @@ class Type_handler_enum: public Type_handler_typelib
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_enum() {}
|
||||
const Name name() const override;
|
||||
enum_field_types real_field_type() const override { return MYSQL_TYPE_ENUM; }
|
||||
enum_field_types traditional_merge_field_type() const override
|
||||
{
|
||||
@ -6939,7 +6914,6 @@ class Type_handler_set: public Type_handler_typelib
|
||||
{
|
||||
public:
|
||||
virtual ~Type_handler_set() {}
|
||||
const Name name() const override;
|
||||
enum_field_types real_field_type() const override { return MYSQL_TYPE_SET; }
|
||||
enum_field_types traditional_merge_field_type() const override
|
||||
{
|
||||
@ -7083,62 +7057,71 @@ public:
|
||||
const Type_handler *h0, const Type_handler *h1);
|
||||
};
|
||||
|
||||
/*
|
||||
Helper template to simplify creating builtin types with names.
|
||||
Plugin types inherit from Type_handler_xxx types that do not set the name in
|
||||
the constructor, as sql_plugin.cc sets the type name from the plugin name.
|
||||
*/
|
||||
template <typename TypeHandler>
|
||||
class Named_type_handler : public TypeHandler
|
||||
{
|
||||
public:
|
||||
Named_type_handler(const char *n) : TypeHandler()
|
||||
{ Type_handler::set_name(Name(n, strlen(n))); }
|
||||
};
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_row type_handler_row;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_null type_handler_null;
|
||||
extern Named_type_handler<Type_handler_row> type_handler_row;
|
||||
extern Named_type_handler<Type_handler_null> type_handler_null;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_float type_handler_float;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_double type_handler_double;
|
||||
extern Named_type_handler<Type_handler_float> type_handler_float;
|
||||
extern Named_type_handler<Type_handler_double> type_handler_double;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_bit type_handler_bit;
|
||||
extern Named_type_handler<Type_handler_bit> type_handler_bit;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_enum type_handler_enum;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_set type_handler_set;
|
||||
extern Named_type_handler<Type_handler_enum> type_handler_enum;
|
||||
extern Named_type_handler<Type_handler_set> type_handler_set;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_string type_handler_string;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_var_string type_handler_var_string;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_varchar type_handler_varchar;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_varchar_compressed
|
||||
type_handler_varchar_compressed;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_hex_hybrid type_handler_hex_hybrid;
|
||||
extern Named_type_handler<Type_handler_string> type_handler_string;
|
||||
extern Named_type_handler<Type_handler_var_string> type_handler_var_string;
|
||||
extern Named_type_handler<Type_handler_varchar> type_handler_varchar;
|
||||
extern Named_type_handler<Type_handler_varchar_compressed> type_handler_varchar_compressed;
|
||||
extern Named_type_handler<Type_handler_hex_hybrid> type_handler_hex_hybrid;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_tiny_blob type_handler_tiny_blob;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_medium_blob type_handler_medium_blob;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_long_blob type_handler_long_blob;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_blob type_handler_blob;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_blob_compressed
|
||||
type_handler_blob_compressed;
|
||||
extern Named_type_handler<Type_handler_tiny_blob> type_handler_tiny_blob;
|
||||
extern Named_type_handler<Type_handler_medium_blob> type_handler_medium_blob;
|
||||
extern Named_type_handler<Type_handler_long_blob> type_handler_long_blob;
|
||||
extern Named_type_handler<Type_handler_blob> type_handler_blob;
|
||||
extern Named_type_handler<Type_handler_blob_compressed> type_handler_blob_compressed;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_bool type_handler_bool;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_tiny type_handler_stiny;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_short type_handler_sshort;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_int24 type_handler_sint24;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_long type_handler_slong;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_longlong type_handler_slonglong;
|
||||
extern Named_type_handler<Type_handler_bool> type_handler_bool;
|
||||
extern Named_type_handler<Type_handler_tiny> type_handler_stiny;
|
||||
extern Named_type_handler<Type_handler_short> type_handler_sshort;
|
||||
extern Named_type_handler<Type_handler_int24> type_handler_sint24;
|
||||
extern Named_type_handler<Type_handler_long> type_handler_slong;
|
||||
extern Named_type_handler<Type_handler_longlong> type_handler_slonglong;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_utiny type_handler_utiny;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_ushort type_handler_ushort;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_uint24 type_handler_uint24;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_ulong type_handler_ulong;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_ulonglong type_handler_ulonglong;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_vers_trx_id type_handler_vers_trx_id;
|
||||
extern Named_type_handler<Type_handler_utiny> type_handler_utiny;
|
||||
extern Named_type_handler<Type_handler_ushort> type_handler_ushort;
|
||||
extern Named_type_handler<Type_handler_uint24> type_handler_uint24;
|
||||
extern Named_type_handler<Type_handler_ulong> type_handler_ulong;
|
||||
extern Named_type_handler<Type_handler_ulonglong> type_handler_ulonglong;
|
||||
extern Named_type_handler<Type_handler_vers_trx_id> type_handler_vers_trx_id;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_newdecimal type_handler_newdecimal;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_olddecimal type_handler_olddecimal;
|
||||
extern Named_type_handler<Type_handler_newdecimal> type_handler_newdecimal;
|
||||
extern Named_type_handler<Type_handler_olddecimal> type_handler_olddecimal;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_year type_handler_year;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_year type_handler_year2;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_newdate type_handler_newdate;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_date type_handler_date;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_time type_handler_time;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_time2 type_handler_time2;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_datetime type_handler_datetime;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_datetime2 type_handler_datetime2;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_timestamp type_handler_timestamp;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_timestamp2 type_handler_timestamp2;
|
||||
extern Named_type_handler<Type_handler_year> type_handler_year;
|
||||
extern Named_type_handler<Type_handler_year> type_handler_year2;
|
||||
extern Named_type_handler<Type_handler_newdate> type_handler_newdate;
|
||||
extern Named_type_handler<Type_handler_date> type_handler_date;
|
||||
extern Named_type_handler<Type_handler_time> type_handler_time;
|
||||
extern Named_type_handler<Type_handler_time2> type_handler_time2;
|
||||
extern Named_type_handler<Type_handler_datetime> type_handler_datetime;
|
||||
extern Named_type_handler<Type_handler_datetime2> type_handler_datetime2;
|
||||
extern Named_type_handler<Type_handler_timestamp> type_handler_timestamp;
|
||||
extern Named_type_handler<Type_handler_timestamp2> type_handler_timestamp2;
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_interval_DDhhmmssff
|
||||
type_handler_interval_DDhhmmssff;
|
||||
extern Type_handler_interval_DDhhmmssff type_handler_interval_DDhhmmssff;
|
||||
|
||||
class Type_aggregator
|
||||
{
|
||||
@ -7229,7 +7212,6 @@ public:
|
||||
bool init();
|
||||
};
|
||||
|
||||
|
||||
extern Type_handler_data *type_handler_data;
|
||||
|
||||
#endif /* SQL_TYPE_H_INCLUDED */
|
||||
|
@ -23,68 +23,17 @@
|
||||
#include "sql_type_geom.h"
|
||||
#include "item_geofunc.h"
|
||||
|
||||
const Name Type_handler_geometry::name() const
|
||||
{
|
||||
static const Name tmp(STRING_WITH_LEN("geometry"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const Name Type_handler_point::name() const
|
||||
{
|
||||
static const Name tmp(STRING_WITH_LEN("point"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
const Name Type_handler_linestring::name() const
|
||||
{
|
||||
static const Name tmp(STRING_WITH_LEN("linestring"));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
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_point type_handler_point;
|
||||
Type_handler_linestring type_handler_linestring;
|
||||
Type_handler_polygon type_handler_polygon;
|
||||
Type_handler_multipoint type_handler_multipoint;
|
||||
Type_handler_multilinestring type_handler_multilinestring;
|
||||
Type_handler_multipolygon type_handler_multipolygon;
|
||||
Type_handler_geometrycollection type_handler_geometrycollection;
|
||||
|
||||
Named_type_handler<Type_handler_geometry> type_handler_geometry("geometry");
|
||||
Named_type_handler<Type_handler_point> type_handler_point("point");
|
||||
Named_type_handler<Type_handler_linestring> type_handler_linestring("linestring");
|
||||
Named_type_handler<Type_handler_polygon> type_handler_polygon("polygon");
|
||||
Named_type_handler<Type_handler_multipoint> type_handler_multipoint("multipoint");
|
||||
Named_type_handler<Type_handler_multilinestring> type_handler_multilinestring("multilinestring");
|
||||
Named_type_handler<Type_handler_multipolygon> type_handler_multipolygon("multipolygon");
|
||||
Named_type_handler<Type_handler_geometrycollection> type_handler_geometrycollection("geometrycollection");
|
||||
|
||||
Type_collection_geometry type_collection_geometry;
|
||||
|
||||
|
||||
const Type_handler_geometry *
|
||||
Type_handler_geometry::type_handler_geom_by_type(uint type)
|
||||
{
|
||||
|
@ -41,7 +41,6 @@ public:
|
||||
static const Type_handler_geometry *type_handler_geom_by_type(uint type);
|
||||
public:
|
||||
virtual ~Type_handler_geometry() {}
|
||||
const Name name() const override;
|
||||
enum_field_types field_type() const override { return MYSQL_TYPE_GEOMETRY; }
|
||||
bool is_param_long_data_type() const override { return true; }
|
||||
uint32 max_display_length_for_field(const Conv_source &src) const override;
|
||||
@ -181,7 +180,6 @@ class Type_handler_point: public Type_handler_geometry
|
||||
static uint octet_length() { return 25; }
|
||||
public:
|
||||
geometry_types geometry_type() const override { return GEOM_POINT; }
|
||||
const Name name() const override;
|
||||
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
|
||||
bool Key_part_spec_init_primary(Key_part_spec *part,
|
||||
const Column_definition &def,
|
||||
@ -203,7 +201,6 @@ class Type_handler_linestring: public Type_handler_geometry
|
||||
{
|
||||
public:
|
||||
geometry_types geometry_type() const override { return GEOM_LINESTRING; }
|
||||
const Name name() const override;
|
||||
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
|
||||
};
|
||||
|
||||
@ -212,7 +209,6 @@ class Type_handler_polygon: public Type_handler_geometry
|
||||
{
|
||||
public:
|
||||
geometry_types geometry_type() const override { return GEOM_POLYGON; }
|
||||
const Name name() const override;
|
||||
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
|
||||
};
|
||||
|
||||
@ -221,7 +217,6 @@ class Type_handler_multipoint: public Type_handler_geometry
|
||||
{
|
||||
public:
|
||||
geometry_types geometry_type() const override { return GEOM_MULTIPOINT; }
|
||||
const Name name() const override;
|
||||
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
|
||||
};
|
||||
|
||||
@ -230,7 +225,6 @@ class Type_handler_multilinestring: public Type_handler_geometry
|
||||
{
|
||||
public:
|
||||
geometry_types geometry_type() const override { return GEOM_MULTILINESTRING; }
|
||||
const Name name() const override;
|
||||
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
|
||||
};
|
||||
|
||||
@ -239,7 +233,6 @@ class Type_handler_multipolygon: public Type_handler_geometry
|
||||
{
|
||||
public:
|
||||
geometry_types geometry_type() const override { return GEOM_MULTIPOLYGON; }
|
||||
const Name name() const override;
|
||||
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
|
||||
};
|
||||
|
||||
@ -248,20 +241,17 @@ class Type_handler_geometrycollection: public Type_handler_geometry
|
||||
{
|
||||
public:
|
||||
geometry_types geometry_type() const override { return GEOM_GEOMETRYCOLLECTION; }
|
||||
const Name name() const override;
|
||||
Item *make_constructor_item(THD *thd, List<Item> *args) const override;
|
||||
};
|
||||
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_geometry type_handler_geometry;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_point type_handler_point;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_linestring type_handler_linestring;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_polygon type_handler_polygon;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_multipoint type_handler_multipoint;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_multilinestring type_handler_multilinestring;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_multipolygon type_handler_multipolygon;
|
||||
extern MYSQL_PLUGIN_IMPORT Type_handler_geometrycollection type_handler_geometrycollection;
|
||||
|
||||
extern Named_type_handler<Type_handler_geometry> type_handler_geometry;
|
||||
extern Named_type_handler<Type_handler_point> type_handler_point;
|
||||
extern Named_type_handler<Type_handler_linestring> type_handler_linestring;
|
||||
extern Named_type_handler<Type_handler_polygon> type_handler_polygon;
|
||||
extern Named_type_handler<Type_handler_multipoint> type_handler_multipoint;
|
||||
extern Named_type_handler<Type_handler_multilinestring> type_handler_multilinestring;
|
||||
extern Named_type_handler<Type_handler_multipolygon> type_handler_multipolygon;
|
||||
extern Named_type_handler<Type_handler_geometrycollection> type_handler_geometrycollection;
|
||||
|
||||
class Type_collection_geometry: public Type_collection
|
||||
{
|
||||
@ -314,9 +304,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT Type_collection_geometry type_collection_geometry;
|
||||
|
||||
extern Type_collection_geometry type_collection_geometry;
|
||||
|
||||
#include "field.h"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user