diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-07-09 12:47:42 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-07-09 16:18:54 +0400 |
commit | 4dc85973b432ac6a17964c2897439e902676e55b (patch) | |
tree | 37638fc2b6fdb19da7d5bb4880bead89d132a9b9 /sql/item_geofunc.cc | |
parent | 0940e25d69cea59d6026f894b1fd9a5ebb55378c (diff) | |
download | mariadb-git-4dc85973b432ac6a17964c2897439e902676e55b.tar.gz |
MDEV-19994 Add class Function_collection
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r-- | sql/item_geofunc.cc | 1334 |
1 files changed, 1334 insertions, 0 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 54423e8cdd8..934835abd4f 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -2629,4 +2629,1338 @@ longlong Item_func_gis_debug::val_int() } #endif + +/**********************************************************************/ + + +class Create_func_area : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_area(thd, arg1); + } + + static Create_func_area s_singleton; + +protected: + Create_func_area() {} + virtual ~Create_func_area() {} +}; + + +class Create_func_as_wkb : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_as_wkb(thd, arg1); + } + + static Create_func_as_wkb s_singleton; + +protected: + Create_func_as_wkb() {} + virtual ~Create_func_as_wkb() {} +}; + + +class Create_func_as_wkt : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_as_wkt(thd, arg1); + } + + static Create_func_as_wkt s_singleton; + +protected: + Create_func_as_wkt() {} + virtual ~Create_func_as_wkt() {} +}; + + + +class Create_func_centroid : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_centroid(thd, arg1); + } + + static Create_func_centroid s_singleton; + +protected: + Create_func_centroid() {} + virtual ~Create_func_centroid() {} +}; + + +class Create_func_convexhull : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_convexhull(thd, arg1); + } + + static Create_func_convexhull s_singleton; + +protected: + Create_func_convexhull() {} + virtual ~Create_func_convexhull() {} +}; + + +class Create_func_pointonsurface : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_pointonsurface(thd, arg1); + } + + static Create_func_pointonsurface s_singleton; + +protected: + Create_func_pointonsurface() {} + virtual ~Create_func_pointonsurface() {} +}; + + +class Create_func_mbr_contains : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2, + Item_func::SP_CONTAINS_FUNC); + } + + static Create_func_mbr_contains s_singleton; + +protected: + Create_func_mbr_contains() {} + virtual ~Create_func_mbr_contains() {} +}; + + +class Create_func_contains : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2, + Item_func::SP_CONTAINS_FUNC); + } + static Create_func_contains s_singleton; + +protected: + Create_func_contains() {} + virtual ~Create_func_contains() {} +}; + + +class Create_func_crosses : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2, + Item_func::SP_CROSSES_FUNC); + } + static Create_func_crosses s_singleton; + +protected: + Create_func_crosses() {} + virtual ~Create_func_crosses() {} +}; + + +class Create_func_dimension : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_dimension(thd, arg1); + } + + static Create_func_dimension s_singleton; + +protected: + Create_func_dimension() {} + virtual ~Create_func_dimension() {} +}; + + +class Create_func_mbr_disjoint : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2, + Item_func::SP_DISJOINT_FUNC); + } + + static Create_func_mbr_disjoint s_singleton; + +protected: + Create_func_mbr_disjoint() {} + virtual ~Create_func_mbr_disjoint() {} +}; + + +class Create_func_disjoint : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2, + Item_func::SP_DISJOINT_FUNC); + } + static Create_func_disjoint s_singleton; + +protected: + Create_func_disjoint() {} + virtual ~Create_func_disjoint() {} +}; + + +class Create_func_distance : public Create_func_arg2 +{ +public: + Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_distance(thd, arg1, arg2); + } + + static Create_func_distance s_singleton; + +protected: + Create_func_distance() {} + virtual ~Create_func_distance() {} +}; + + + +class Create_func_endpoint : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_spatial_decomp(thd, arg1, + Item_func::SP_ENDPOINT); + } + + static Create_func_endpoint s_singleton; + +protected: + Create_func_endpoint() {} + virtual ~Create_func_endpoint() {} +}; + + +class Create_func_envelope : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_envelope(thd, arg1); + } + + static Create_func_envelope s_singleton; + +protected: + Create_func_envelope() {} + virtual ~Create_func_envelope() {} +}; + +class Create_func_boundary : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_boundary(thd, arg1); + } + + static Create_func_boundary s_singleton; + +protected: + Create_func_boundary() {} + virtual ~Create_func_boundary() {} +}; + + +class Create_func_mbr_equals : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2, + Item_func::SP_EQUALS_FUNC); + } + + static Create_func_mbr_equals s_singleton; + +protected: + Create_func_mbr_equals() {} + virtual ~Create_func_mbr_equals() {} +}; + + +class Create_func_equals : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2, + Item_func::SP_EQUALS_FUNC); + } + + static Create_func_equals s_singleton; + +protected: + Create_func_equals() {} + virtual ~Create_func_equals() {} +}; + + +class Create_func_exteriorring : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_spatial_decomp(thd, arg1, + Item_func::SP_EXTERIORRING); + } + + static Create_func_exteriorring s_singleton; + +protected: + Create_func_exteriorring() {} + virtual ~Create_func_exteriorring() {} +}; + + + +class Create_func_geometry_from_text : public Create_native_func +{ +public: + Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + + static Create_func_geometry_from_text s_singleton; + +protected: + Create_func_geometry_from_text() {} + virtual ~Create_func_geometry_from_text() {} +}; + + +Item* +Create_func_geometry_from_text::create_native(THD *thd, LEX_CSTRING *name, + List<Item> *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + switch (arg_count) { + case 1: + { + Item *param_1= item_list->pop(); + func= new (thd->mem_root) Item_func_geometry_from_text(thd, param_1); + thd->lex->uncacheable(UNCACHEABLE_RAND); + break; + } + case 2: + { + Item *param_1= item_list->pop(); + Item *param_2= item_list->pop(); + func= new (thd->mem_root) Item_func_geometry_from_text(thd, param_1, param_2); + break; + } + default: + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str); + break; + } + } + + return func; +} + + +class Create_func_geometry_from_wkb : public Create_native_func +{ +public: + Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + + static Create_func_geometry_from_wkb s_singleton; + +protected: + Create_func_geometry_from_wkb() {} + virtual ~Create_func_geometry_from_wkb() {} +}; + + +Item* +Create_func_geometry_from_wkb::create_native(THD *thd, LEX_CSTRING *name, + List<Item> *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + switch (arg_count) { + case 1: + { + Item *param_1= item_list->pop(); + func= new (thd->mem_root) Item_func_geometry_from_wkb(thd, param_1); + thd->lex->uncacheable(UNCACHEABLE_RAND); + break; + } + case 2: + { + Item *param_1= item_list->pop(); + Item *param_2= item_list->pop(); + func= new (thd->mem_root) Item_func_geometry_from_wkb(thd, param_1, param_2); + break; + } + default: + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str); + break; + } + } + + return func; +} + + +class Create_func_geometry_from_json : public Create_native_func +{ +public: + Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + + static Create_func_geometry_from_json s_singleton; + +protected: + Create_func_geometry_from_json() {} + virtual ~Create_func_geometry_from_json() {} +}; + + +Item* +Create_func_geometry_from_json::create_native(THD *thd, LEX_CSTRING *name, + List<Item> *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + switch (arg_count) { + case 1: + { + Item *json= item_list->pop(); + func= new (thd->mem_root) Item_func_geometry_from_json(thd, json); + thd->lex->uncacheable(UNCACHEABLE_RAND); + break; + } + case 2: + { + Item *json= item_list->pop(); + Item *options= item_list->pop(); + func= new (thd->mem_root) Item_func_geometry_from_json(thd, json, options); + break; + } + case 3: + { + Item *json= item_list->pop(); + Item *options= item_list->pop(); + Item *srid= item_list->pop(); + func= new (thd->mem_root) Item_func_geometry_from_json(thd, json, options, + srid); + break; + } + default: + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str); + break; + } + } + + return func; +} + + +class Create_func_as_geojson : public Create_native_func +{ +public: + Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + + static Create_func_as_geojson s_singleton; + +protected: + Create_func_as_geojson() {} + virtual ~Create_func_as_geojson() {} +}; + + +Item* +Create_func_as_geojson::create_native(THD *thd, LEX_CSTRING *name, + List<Item> *item_list) +{ + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + switch (arg_count) { + case 1: + { + Item *geom= item_list->pop(); + func= new (thd->mem_root) Item_func_as_geojson(thd, geom); + thd->lex->uncacheable(UNCACHEABLE_RAND); + break; + } + case 2: + { + Item *geom= item_list->pop(); + Item *max_dec= item_list->pop(); + func= new (thd->mem_root) Item_func_as_geojson(thd, geom, max_dec); + break; + } + case 3: + { + Item *geom= item_list->pop(); + Item *max_dec= item_list->pop(); + Item *options= item_list->pop(); + func= new (thd->mem_root) Item_func_as_geojson(thd, geom, max_dec, options); + break; + } + default: + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str); + break; + } + } + + return func; +} + + +class Create_func_geometry_type : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_geometry_type(thd, arg1); + } + + static Create_func_geometry_type s_singleton; + +protected: + Create_func_geometry_type() {} + virtual ~Create_func_geometry_type() {} +}; + + +class Create_func_geometryn : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_decomp_n(thd, arg1, arg2, + Item_func::SP_GEOMETRYN); + } + + static Create_func_geometryn s_singleton; + +protected: + Create_func_geometryn() {} + virtual ~Create_func_geometryn() {} +}; + + +#if !defined(DBUG_OFF) +class Create_func_gis_debug : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_gis_debug(thd, arg1); + } + + static Create_func_gis_debug s_singleton; + +protected: + Create_func_gis_debug() {} + virtual ~Create_func_gis_debug() {} +}; +#endif + + +class Create_func_glength : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_glength(thd, arg1); + } + + static Create_func_glength s_singleton; + +protected: + Create_func_glength() {} + virtual ~Create_func_glength() {} +}; + + +class Create_func_interiorringn : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_decomp_n(thd, arg1, arg2, + Item_func::SP_INTERIORRINGN); + } + + static Create_func_interiorringn s_singleton; + +protected: + Create_func_interiorringn() {} + virtual ~Create_func_interiorringn() {} +}; + + +class Create_func_relate : public Create_func_arg3 +{ +public: + Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) override + { + return new (thd->mem_root) Item_func_spatial_relate(thd, arg1, arg2, arg3); + } + + static Create_func_relate s_singleton; + +protected: + Create_func_relate() {} + virtual ~Create_func_relate() {} +}; + + +class Create_func_mbr_intersects : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2, + Item_func::SP_INTERSECTS_FUNC); + } + + static Create_func_mbr_intersects s_singleton; + +protected: + Create_func_mbr_intersects() {} + virtual ~Create_func_mbr_intersects() {} +}; + + +class Create_func_intersects : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2, + Item_func::SP_INTERSECTS_FUNC); + } + + static Create_func_intersects s_singleton; + +protected: + Create_func_intersects() {} + virtual ~Create_func_intersects() {} +}; + + +class Create_func_intersection : public Create_func_arg2 +{ +public: + Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2, + Gcalc_function::op_intersection); + } + + static Create_func_intersection s_singleton; + +protected: + Create_func_intersection() {} + virtual ~Create_func_intersection() {} +}; + + +class Create_func_difference : public Create_func_arg2 +{ +public: + Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2, + Gcalc_function::op_difference); + } + + static Create_func_difference s_singleton; + +protected: + Create_func_difference() {} + virtual ~Create_func_difference() {} +}; + + +class Create_func_union : public Create_func_arg2 +{ +public: + Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2, + Gcalc_function::op_union); + } + + static Create_func_union s_singleton; + +protected: + Create_func_union() {} + virtual ~Create_func_union() {} +}; + + +class Create_func_symdifference : public Create_func_arg2 +{ +public: + Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_operation(thd, arg1, arg2, + Gcalc_function::op_symdifference); + } + + static Create_func_symdifference s_singleton; + +protected: + Create_func_symdifference() {} + virtual ~Create_func_symdifference() {} +}; + + +class Create_func_buffer : public Create_func_arg2 +{ +public: + Item* create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_buffer(thd, arg1, arg2); + } + + static Create_func_buffer s_singleton; + +protected: + Create_func_buffer() {} + virtual ~Create_func_buffer() {} +}; + + +class Create_func_isclosed : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_isclosed(thd, arg1); + } + + static Create_func_isclosed s_singleton; + +protected: + Create_func_isclosed() {} + virtual ~Create_func_isclosed() {} +}; + + +class Create_func_isring : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_isring(thd, arg1); + } + + static Create_func_isring s_singleton; + +protected: + Create_func_isring() {} + virtual ~Create_func_isring() {} +}; + + +class Create_func_isempty : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_isempty(thd, arg1); + } + + static Create_func_isempty s_singleton; + +protected: + Create_func_isempty() {} + virtual ~Create_func_isempty() {} +}; + + +class Create_func_issimple : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_issimple(thd, arg1); + } + + static Create_func_issimple s_singleton; + +protected: + Create_func_issimple() {} + virtual ~Create_func_issimple() {} +}; + + + +class Create_func_numgeometries : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_numgeometries(thd, arg1); + } + + static Create_func_numgeometries s_singleton; + +protected: + Create_func_numgeometries() {} + virtual ~Create_func_numgeometries() {} +}; + + +class Create_func_numinteriorring : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_numinteriorring(thd, arg1); + } + + static Create_func_numinteriorring s_singleton; + +protected: + Create_func_numinteriorring() {} + virtual ~Create_func_numinteriorring() {} +}; + + +class Create_func_numpoints : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_numpoints(thd, arg1); + } + + static Create_func_numpoints s_singleton; + +protected: + Create_func_numpoints() {} + virtual ~Create_func_numpoints() {} +}; + + +class Create_func_mbr_overlaps : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2, + Item_func::SP_OVERLAPS_FUNC); + } + + static Create_func_mbr_overlaps s_singleton; + +protected: + Create_func_mbr_overlaps() {} + virtual ~Create_func_mbr_overlaps() {} +}; + + +class Create_func_overlaps : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2, + Item_func::SP_OVERLAPS_FUNC); + } + + static Create_func_overlaps s_singleton; + +protected: + Create_func_overlaps() {} + virtual ~Create_func_overlaps() {} +}; + + + + + +class Create_func_pointn : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_decomp_n(thd, arg1, arg2, + Item_func::SP_POINTN); + } + static Create_func_pointn s_singleton; + +protected: + Create_func_pointn() {} + virtual ~Create_func_pointn() {} +}; + + + + +class Create_func_srid : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_srid(thd, arg1); + } + + static Create_func_srid s_singleton; + +protected: + Create_func_srid() {} + virtual ~Create_func_srid() {} +}; + + +class Create_func_startpoint : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_spatial_decomp(thd, arg1, + Item_func::SP_STARTPOINT); + } + + static Create_func_startpoint s_singleton; + +protected: + Create_func_startpoint() {} + virtual ~Create_func_startpoint() {} +}; + + + +class Create_func_touches : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2, + Item_func::SP_TOUCHES_FUNC); + } + + static Create_func_touches s_singleton; + +protected: + Create_func_touches() {} + virtual ~Create_func_touches() {} +}; + + +class Create_func_mbr_within : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_mbr_rel(thd, arg1, arg2, + Item_func::SP_WITHIN_FUNC); + } + + static Create_func_mbr_within s_singleton; + +protected: + Create_func_mbr_within() {} + virtual ~Create_func_mbr_within() {} +}; + + +class Create_func_within : public Create_func_arg2 +{ +public: + Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) override + { + return new (thd->mem_root) Item_func_spatial_precise_rel(thd, arg1, arg2, + Item_func::SP_WITHIN_FUNC); + } + + static Create_func_within s_singleton; + +protected: + Create_func_within() {} + virtual ~Create_func_within() {} +}; + + +class Create_func_x : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_x(thd, arg1); + } + + static Create_func_x s_singleton; + +protected: + Create_func_x() {} + virtual ~Create_func_x() {} +}; + + +class Create_func_y : public Create_func_arg1 +{ +public: + Item *create_1_arg(THD *thd, Item *arg1) override + { + return new (thd->mem_root) Item_func_y(thd, arg1); + } + + static Create_func_y s_singleton; + +protected: + Create_func_y() {} + virtual ~Create_func_y() {} +}; + + +/*****************************************************************/ + + + + + + + +/*************************************************************************/ + +#if !defined(DBUG_OFF) +Create_func_gis_debug Create_func_gis_debug::s_singleton; +#endif + +Create_func_area Create_func_area::s_singleton; +Create_func_as_geojson Create_func_as_geojson::s_singleton; +Create_func_as_wkb Create_func_as_wkb::s_singleton; +Create_func_as_wkt Create_func_as_wkt::s_singleton; +Create_func_boundary Create_func_boundary::s_singleton; +Create_func_buffer Create_func_buffer::s_singleton; +Create_func_centroid Create_func_centroid::s_singleton; +Create_func_contains Create_func_contains::s_singleton; +Create_func_convexhull Create_func_convexhull::s_singleton; +Create_func_crosses Create_func_crosses::s_singleton; +Create_func_difference Create_func_difference::s_singleton; +Create_func_dimension Create_func_dimension::s_singleton; +Create_func_disjoint Create_func_disjoint::s_singleton; +Create_func_distance Create_func_distance::s_singleton; +Create_func_endpoint Create_func_endpoint::s_singleton; +Create_func_envelope Create_func_envelope::s_singleton; +Create_func_equals Create_func_equals::s_singleton; +Create_func_exteriorring Create_func_exteriorring::s_singleton; +Create_func_geometry_from_json Create_func_geometry_from_json::s_singleton; +Create_func_geometry_from_text Create_func_geometry_from_text::s_singleton; +Create_func_geometry_from_wkb Create_func_geometry_from_wkb::s_singleton; +Create_func_geometryn Create_func_geometryn::s_singleton; +Create_func_geometry_type Create_func_geometry_type::s_singleton; +Create_func_glength Create_func_glength::s_singleton; +Create_func_interiorringn Create_func_interiorringn::s_singleton; +Create_func_intersection Create_func_intersection::s_singleton; +Create_func_intersects Create_func_intersects::s_singleton; +Create_func_isclosed Create_func_isclosed::s_singleton; +Create_func_isempty Create_func_isempty::s_singleton; +Create_func_isring Create_func_isring::s_singleton; +Create_func_issimple Create_func_issimple::s_singleton; +Create_func_mbr_contains Create_func_mbr_contains::s_singleton; +Create_func_mbr_disjoint Create_func_mbr_disjoint::s_singleton; +Create_func_mbr_equals Create_func_mbr_equals::s_singleton; +Create_func_mbr_intersects Create_func_mbr_intersects::s_singleton; +Create_func_mbr_overlaps Create_func_mbr_overlaps::s_singleton; +Create_func_mbr_within Create_func_mbr_within::s_singleton; +Create_func_numgeometries Create_func_numgeometries::s_singleton; +Create_func_numinteriorring Create_func_numinteriorring::s_singleton; +Create_func_numpoints Create_func_numpoints::s_singleton; +Create_func_overlaps Create_func_overlaps::s_singleton; +Create_func_pointn Create_func_pointn::s_singleton; +Create_func_pointonsurface Create_func_pointonsurface::s_singleton; +Create_func_relate Create_func_relate::s_singleton; +Create_func_srid Create_func_srid::s_singleton; +Create_func_startpoint Create_func_startpoint::s_singleton; +Create_func_symdifference Create_func_symdifference::s_singleton; +Create_func_touches Create_func_touches::s_singleton; +Create_func_union Create_func_union::s_singleton; +Create_func_within Create_func_within::s_singleton; +Create_func_x Create_func_x::s_singleton; +Create_func_y Create_func_y::s_singleton; + +/*************************************************************************/ + + +class FHash: public HASH +{ +public: + FHash() + { + bzero((HASH *) this, sizeof(HASH)); + } +}; + + +#define GEOM_BUILDER(F) & F::s_singleton + + +static Native_func_registry func_array_geom[] = +{ +#ifndef DBUG_OFF + { { STRING_WITH_LEN("ST_GIS_DEBUG") }, GEOM_BUILDER(Create_func_gis_debug)}, +#endif + { { STRING_WITH_LEN("AREA") }, GEOM_BUILDER(Create_func_area)}, + { { STRING_WITH_LEN("ASBINARY") }, GEOM_BUILDER(Create_func_as_wkb)}, + { { STRING_WITH_LEN("ASTEXT") }, GEOM_BUILDER(Create_func_as_wkt)}, + { { STRING_WITH_LEN("ASWKB") }, GEOM_BUILDER(Create_func_as_wkb)}, + { { STRING_WITH_LEN("ASWKT") }, GEOM_BUILDER(Create_func_as_wkt)}, + { { STRING_WITH_LEN("BOUNDARY") }, GEOM_BUILDER(Create_func_boundary)}, + { { STRING_WITH_LEN("BUFFER") }, GEOM_BUILDER(Create_func_buffer)}, + { { STRING_WITH_LEN("CENTROID") }, GEOM_BUILDER(Create_func_centroid)}, + { { STRING_WITH_LEN("CONTAINS") }, GEOM_BUILDER(Create_func_contains)}, + { { STRING_WITH_LEN("CONVEXHULL") }, GEOM_BUILDER(Create_func_convexhull)}, + { { STRING_WITH_LEN("CROSSES") }, GEOM_BUILDER(Create_func_crosses)}, + { { STRING_WITH_LEN("DIMENSION") }, GEOM_BUILDER(Create_func_dimension)}, + { { STRING_WITH_LEN("DISJOINT") }, GEOM_BUILDER(Create_func_mbr_disjoint)}, + { { STRING_WITH_LEN("ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)}, + { { STRING_WITH_LEN("ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)}, + { { STRING_WITH_LEN("EQUALS") }, GEOM_BUILDER(Create_func_equals)}, + { { STRING_WITH_LEN("EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)}, + { { STRING_WITH_LEN("GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("GEOMETRYCOLLECTIONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("GEOMETRYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("GEOMETRYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("GEOMETRYN") }, GEOM_BUILDER(Create_func_geometryn)}, + { { STRING_WITH_LEN("GEOMETRYTYPE") }, GEOM_BUILDER(Create_func_geometry_type)}, + { { STRING_WITH_LEN("GEOMFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("GEOMFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("GLENGTH") }, GEOM_BUILDER(Create_func_glength)}, + { { STRING_WITH_LEN("INTERIORRINGN") }, GEOM_BUILDER(Create_func_interiorringn)}, + { { STRING_WITH_LEN("INTERSECTS") }, GEOM_BUILDER(Create_func_mbr_intersects)}, + { { STRING_WITH_LEN("ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed)}, + { { STRING_WITH_LEN("ISEMPTY") }, GEOM_BUILDER(Create_func_isempty)}, + { { STRING_WITH_LEN("ISRING") }, GEOM_BUILDER(Create_func_isring)}, + { { STRING_WITH_LEN("ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)}, + { { STRING_WITH_LEN("LINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("LINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("LINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("LINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("MBRCONTAINS") }, GEOM_BUILDER(Create_func_mbr_contains)}, + { { STRING_WITH_LEN("MBRDISJOINT") }, GEOM_BUILDER(Create_func_mbr_disjoint)}, + { { STRING_WITH_LEN("MBREQUAL") }, GEOM_BUILDER(Create_func_mbr_equals)}, + { { STRING_WITH_LEN("MBREQUALS") }, GEOM_BUILDER(Create_func_mbr_equals)}, + { { STRING_WITH_LEN("MBRINTERSECTS") }, GEOM_BUILDER(Create_func_mbr_intersects)}, + { { STRING_WITH_LEN("MBROVERLAPS") }, GEOM_BUILDER(Create_func_mbr_overlaps)}, + { { STRING_WITH_LEN("MBRTOUCHES") }, GEOM_BUILDER(Create_func_touches)}, + { { STRING_WITH_LEN("MBRWITHIN") }, GEOM_BUILDER(Create_func_mbr_within)}, + { { STRING_WITH_LEN("MLINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("MLINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("MPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("MPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("MPOLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("MPOLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("MULTILINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("MULTILINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("MULTIPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("MULTIPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("MULTIPOLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("MULTIPOLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("NUMGEOMETRIES") }, GEOM_BUILDER(Create_func_numgeometries)}, + { { STRING_WITH_LEN("NUMINTERIORRINGS") }, GEOM_BUILDER(Create_func_numinteriorring)}, + { { STRING_WITH_LEN("NUMPOINTS") }, GEOM_BUILDER(Create_func_numpoints)}, + { { STRING_WITH_LEN("OVERLAPS") }, GEOM_BUILDER(Create_func_mbr_overlaps)}, + { { STRING_WITH_LEN("POINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("POINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("POINTN") }, GEOM_BUILDER(Create_func_pointn)}, + { { STRING_WITH_LEN("POINTONSURFACE") }, GEOM_BUILDER(Create_func_pointonsurface)}, + { { STRING_WITH_LEN("POLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("POLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("POLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("SRID") }, GEOM_BUILDER(Create_func_srid)}, + { { STRING_WITH_LEN("ST_AREA") }, GEOM_BUILDER(Create_func_area)}, + { { STRING_WITH_LEN("STARTPOINT") }, GEOM_BUILDER(Create_func_startpoint)}, + { { STRING_WITH_LEN("ST_ASBINARY") }, GEOM_BUILDER(Create_func_as_wkb)}, + { { STRING_WITH_LEN("ST_ASGEOJSON") }, GEOM_BUILDER(Create_func_as_geojson)}, + { { STRING_WITH_LEN("ST_ASTEXT") }, GEOM_BUILDER(Create_func_as_wkt)}, + { { STRING_WITH_LEN("ST_ASWKB") }, GEOM_BUILDER(Create_func_as_wkb)}, + { { STRING_WITH_LEN("ST_ASWKT") }, GEOM_BUILDER(Create_func_as_wkt)}, + { { STRING_WITH_LEN("ST_BOUNDARY") }, GEOM_BUILDER(Create_func_boundary)}, + { { STRING_WITH_LEN("ST_BUFFER") }, GEOM_BUILDER(Create_func_buffer)}, + { { STRING_WITH_LEN("ST_CENTROID") }, GEOM_BUILDER(Create_func_centroid)}, + { { STRING_WITH_LEN("ST_CONTAINS") }, GEOM_BUILDER(Create_func_contains)}, + { { STRING_WITH_LEN("ST_CONVEXHULL") }, GEOM_BUILDER(Create_func_convexhull)}, + { { STRING_WITH_LEN("ST_CROSSES") }, GEOM_BUILDER(Create_func_crosses)}, + { { STRING_WITH_LEN("ST_DIFFERENCE") }, GEOM_BUILDER(Create_func_difference)}, + { { STRING_WITH_LEN("ST_DIMENSION") }, GEOM_BUILDER(Create_func_dimension)}, + { { STRING_WITH_LEN("ST_DISJOINT") }, GEOM_BUILDER(Create_func_disjoint)}, + { { STRING_WITH_LEN("ST_DISTANCE") }, GEOM_BUILDER(Create_func_distance)}, + { { STRING_WITH_LEN("ST_ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)}, + { { STRING_WITH_LEN("ST_ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)}, + { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)}, + { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)}, + { { STRING_WITH_LEN("ST_EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)}, + { { STRING_WITH_LEN("ST_GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_GEOMETRYCOLLECTIONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_GEOMETRYCOLLECTIONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_GEOMETRYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_GEOMETRYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_GEOMETRYN") }, GEOM_BUILDER(Create_func_geometryn)}, + { { STRING_WITH_LEN("ST_GEOMETRYTYPE") }, GEOM_BUILDER(Create_func_geometry_type)}, + { { STRING_WITH_LEN("ST_GEOMFROMGEOJSON") }, GEOM_BUILDER(Create_func_geometry_from_json)}, + { { STRING_WITH_LEN("ST_GEOMFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_GEOMFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_INTERIORRINGN") }, GEOM_BUILDER(Create_func_interiorringn)}, + { { STRING_WITH_LEN("ST_INTERSECTION") }, GEOM_BUILDER(Create_func_intersection)}, + { { STRING_WITH_LEN("ST_INTERSECTS") }, GEOM_BUILDER(Create_func_intersects)}, + { { STRING_WITH_LEN("ST_ISCLOSED") }, GEOM_BUILDER(Create_func_isclosed)}, + { { STRING_WITH_LEN("ST_ISEMPTY") }, GEOM_BUILDER(Create_func_isempty)}, + { { STRING_WITH_LEN("ST_ISRING") }, GEOM_BUILDER(Create_func_isring)}, + { { STRING_WITH_LEN("ST_ISSIMPLE") }, GEOM_BUILDER(Create_func_issimple)}, + { { STRING_WITH_LEN("ST_LENGTH") }, GEOM_BUILDER(Create_func_glength)}, + { { STRING_WITH_LEN("ST_LINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_LINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_LINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_LINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_MLINEFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_MLINEFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_MPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_MPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_MPOLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_MPOLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_MULTILINESTRINGFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_MULTILINESTRINGFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_MULTIPOINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_MULTIPOINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_MULTIPOLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_MULTIPOLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_NUMGEOMETRIES") }, GEOM_BUILDER(Create_func_numgeometries)}, + { { STRING_WITH_LEN("ST_NUMINTERIORRINGS") }, GEOM_BUILDER(Create_func_numinteriorring)}, + { { STRING_WITH_LEN("ST_NUMPOINTS") }, GEOM_BUILDER(Create_func_numpoints)}, + { { STRING_WITH_LEN("ST_OVERLAPS") }, GEOM_BUILDER(Create_func_overlaps)}, + { { STRING_WITH_LEN("ST_POINTFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_POINTFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_POINTN") }, GEOM_BUILDER(Create_func_pointn)}, + { { STRING_WITH_LEN("ST_POINTONSURFACE") }, GEOM_BUILDER(Create_func_pointonsurface)}, + { { STRING_WITH_LEN("ST_POLYFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_POLYFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_POLYGONFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, + { { STRING_WITH_LEN("ST_POLYGONFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, + { { STRING_WITH_LEN("ST_RELATE") }, GEOM_BUILDER(Create_func_relate)}, + { { STRING_WITH_LEN("ST_SRID") }, GEOM_BUILDER(Create_func_srid)}, + { { STRING_WITH_LEN("ST_STARTPOINT") }, GEOM_BUILDER(Create_func_startpoint)}, + { { STRING_WITH_LEN("ST_SYMDIFFERENCE") }, GEOM_BUILDER(Create_func_symdifference)}, + { { STRING_WITH_LEN("ST_TOUCHES") }, GEOM_BUILDER(Create_func_touches)}, + { { STRING_WITH_LEN("ST_UNION") }, GEOM_BUILDER(Create_func_union)}, + { { STRING_WITH_LEN("ST_WITHIN") }, GEOM_BUILDER(Create_func_within)}, + { { STRING_WITH_LEN("ST_X") }, GEOM_BUILDER(Create_func_x)}, + { { STRING_WITH_LEN("ST_Y") }, GEOM_BUILDER(Create_func_y)}, + { { STRING_WITH_LEN("TOUCHES") }, GEOM_BUILDER(Create_func_touches)}, + { { STRING_WITH_LEN("WITHIN") }, GEOM_BUILDER(Create_func_within)}, + { { STRING_WITH_LEN("X") }, GEOM_BUILDER(Create_func_x)}, + { { STRING_WITH_LEN("Y") }, GEOM_BUILDER(Create_func_y)}, +}; + + +extern "C" uchar* +get_native_fct_hash_key_geom(const uchar *buff, size_t *length, + my_bool /* unused */) +{ + Native_func_registry *func= (Native_func_registry*) buff; + *length= func->name.length; + return (uchar*) func->name.str; +} + + +Function_collection_geometry function_collection_geometry; + +static FHash hash_funcn; + + +Create_func * +Function_collection_geometry::find_native_function_builder(THD *thd, + const LEX_CSTRING &f) + const +{ + Native_func_registry *func; + func= (Native_func_registry*) my_hash_search(&hash_funcn, + (uchar*) f.str, f.length); + return func ? func->builder : NULL; +} + + +bool Function_collection_geometry::init() +{ + DBUG_ENTER("Type_collection_geometry::init_functions"); + if (my_hash_init(&hash_funcn, + system_charset_info, + array_elements(func_array_geom), + 0, + 0, + (my_hash_get_key) get_native_fct_hash_key_geom, + NULL, /* Nothing to free */ + MYF(0))) + DBUG_RETURN(true); + + for (uint i= 0; i < array_elements(func_array_geom); i++) + { + Native_func_registry *func= &func_array_geom[i]; + DBUG_ASSERT(func->builder != NULL); + if (my_hash_insert(&hash_funcn, (uchar*) func)) + DBUG_RETURN(1); + } + + DBUG_RETURN(false); +} + + +void Function_collection_geometry::cleanup() +{ + my_hash_free(&hash_funcn); +} + + #endif /*HAVE_SPATIAL*/ |