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]=
{ 3, 4, 4, 5, 5, 5, 6 };
/***************************************************************************/
const Name Type_handler_row::m_name_row(STRING_WITH_LEN("row"));
const Name Type_handler_null::m_name_null(STRING_WITH_LEN("null"));
const Name
Type_handler_string::m_name_char(STRING_WITH_LEN("char")),
Type_handler_var_string::m_name_var_string(STRING_WITH_LEN("varchar")),
Type_handler_varchar::m_name_varchar(STRING_WITH_LEN("varchar")),
Type_handler_hex_hybrid::m_name_hex_hybrid(STRING_WITH_LEN("hex_hybrid")),
Type_handler_tiny_blob::m_name_tinyblob(STRING_WITH_LEN("tinyblob")),
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_enum::m_name_enum(STRING_WITH_LEN("enum")),
Type_handler_set::m_name_set(STRING_WITH_LEN("set"));
const Name
Type_handler_bool::m_name_bool(STRING_WITH_LEN("boolean")),
Type_handler_tiny::m_name_tiny(STRING_WITH_LEN("tinyint")),
Type_handler_short::m_name_short(STRING_WITH_LEN("smallint")),
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")),
Type_handler_year::m_name_year(STRING_WITH_LEN("year")),
Type_handler_bit::m_name_bit(STRING_WITH_LEN("bit"));
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_olddecimal::m_name_decimal(STRING_WITH_LEN("decimal")),
Type_handler_newdecimal::m_name_decimal(STRING_WITH_LEN("decimal"));
const Name
Type_handler_time_common::m_name_time(STRING_WITH_LEN("time")),
Type_handler_date_common::m_name_date(STRING_WITH_LEN("date")),
Type_handler_datetime_common::m_name_datetime(STRING_WITH_LEN("datetime")),
Type_handler_timestamp_common::m_name_timestamp(STRING_WITH_LEN("timestamp"));
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
{
......
This diff is collapsed.
......@@ -23,23 +23,53 @@
#include "sql_type_geom.h"
#include "item_geofunc.h"
const Name
Type_handler_geometry::
m_name_geometry(STRING_WITH_LEN("geometry")),
Type_handler_point::
m_name_point(STRING_WITH_LEN("point")),
Type_handler_linestring::
m_name_linestring(STRING_WITH_LEN("linestring")),
Type_handler_polygon::
m_name_polygon(STRING_WITH_LEN("polygon")),
Type_handler_multipoint::
m_name_multipoint(STRING_WITH_LEN("multipoint")),
Type_handler_multilinestring::
m_name_multilinestring(STRING_WITH_LEN("multilinestring")),
Type_handler_multipolygon::
m_name_multipolygon(STRING_WITH_LEN("multipolygon")),
Type_handler_geometrycollection::
m_name_geometrycollection(STRING_WITH_LEN("geometrycollection"));
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;
......
......@@ -27,7 +27,6 @@
#ifdef HAVE_SPATIAL
class Type_handler_geometry: public Type_handler_string_result
{
static const Name m_name_geometry;
public:
enum geometry_types
{
......@@ -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);
public:
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; }
bool is_param_long_data_type() const override { return true; }
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
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
static uint octet_length() { return 25; }
public:
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;
bool Key_part_spec_init_primary(Key_part_spec *part,
const Column_definition &def,
......@@ -197,60 +195,54 @@ class Type_handler_point: public Type_handler_geometry
class Type_handler_linestring: public Type_handler_geometry
{
static const Name m_name_linestring;
public:
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;
};
class Type_handler_polygon: public Type_handler_geometry
{
static const Name m_name_polygon;
public:
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;
};
class Type_handler_multipoint: public Type_handler_geometry
{
static const Name m_name_multipoint;
public:
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;
};
class Type_handler_multilinestring: public Type_handler_geometry
{
static const Name m_name_multilinestring;
public:
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;
};
class Type_handler_multipolygon: public Type_handler_geometry
{
static const Name m_name_multipolygon;
public:
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;
};
class Type_handler_geometrycollection: public Type_handler_geometry
{
static const Name m_name_geometrycollection;
public:
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;
};
......
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