diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-07-03 13:05:15 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-07-03 14:51:00 +0400 |
commit | b5112023353a12902852e781f579d200e0f224c0 (patch) | |
tree | 580d7224accf1afedbc291f94e7c603f0ef0ee76 /sql/sql_yacc.yy | |
parent | c1519d62d0fe132c8d81008cc6a686f7f7e327c0 (diff) | |
download | mariadb-git-b5112023353a12902852e781f579d200e0f224c0.tar.gz |
MDEV-19923 Add type handlers for geometry sub-types
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r-- | sql/sql_yacc.yy | 52 |
1 files changed, 16 insertions, 36 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 49d6eec648e..466259c0f6d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -792,7 +792,6 @@ Virtual_column_info *add_virtual_expression(THD *thd, Item *expr) enum Condition_information_item::Name cond_info_item_name; enum enum_diag_condition_item_name diag_condition_item_name; enum Diagnostics_information::Which_area diag_area; - enum Field::geometry_type geom_type; enum enum_fk_option m_fk_option; enum Item_udftype udf_type; enum Key::Keytype key_type; @@ -1832,7 +1831,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %type <create_field> field_spec column_def -%type <geom_type> spatial_type +%type <type_handler> spatial_type %type <num> order_dir lock_option @@ -7013,8 +7012,7 @@ field_type_lob: { #ifdef HAVE_SPATIAL Lex->charset=&my_charset_bin; - Lex->last_field->geom_type= $1; - $$.set(&type_handler_geometry, $2); + $$.set($1, $2); #else my_yyabort_error((ER_FEATURE_DISABLED, MYF(0), sym_group_geom.name, sym_group_geom.needed_define)); @@ -7064,14 +7062,14 @@ field_type_misc: ; spatial_type: - GEOMETRY_SYM { $$= Field::GEOM_GEOMETRY; } - | GEOMETRYCOLLECTION { $$= Field::GEOM_GEOMETRYCOLLECTION; } - | POINT_SYM { $$= Field::GEOM_POINT; } - | MULTIPOINT { $$= Field::GEOM_MULTIPOINT; } - | LINESTRING { $$= Field::GEOM_LINESTRING; } - | MULTILINESTRING { $$= Field::GEOM_MULTILINESTRING; } - | POLYGON { $$= Field::GEOM_POLYGON; } - | MULTIPOLYGON { $$= Field::GEOM_MULTIPOLYGON; } + GEOMETRY_SYM { $$= GEOM_TYPE(&type_handler_geometry); } + | GEOMETRYCOLLECTION { $$= GEOM_TYPE(&type_handler_geometrycollection); } + | POINT_SYM { $$= GEOM_TYPE(&type_handler_point); } + | MULTIPOINT { $$= GEOM_TYPE(&type_handler_multipoint); } + | LINESTRING { $$= GEOM_TYPE(&type_handler_linestring); } + | MULTILINESTRING { $$= GEOM_TYPE(&type_handler_multilinestring); } + | POLYGON { $$= GEOM_TYPE(&type_handler_polygon); } + | MULTIPOLYGON { $$= GEOM_TYPE(&type_handler_multipolygon); } ; char: @@ -11049,38 +11047,23 @@ geometry_function: } | GEOMETRYCOLLECTION '(' expr_list ')' { - $$= GEOM_NEW(thd, - Item_func_spatial_collection(thd, *$3, - Geometry::wkb_geometrycollection, - Geometry::wkb_point)); + $$= GEOM_NEW(thd, Item_func_geometrycollection(thd, *$3)); } | LINESTRING '(' expr_list ')' { - $$= GEOM_NEW(thd, - Item_func_spatial_collection(thd, *$3, - Geometry::wkb_linestring, - Geometry::wkb_point)); + $$= GEOM_NEW(thd, Item_func_linestring(thd, *$3)); } | MULTILINESTRING '(' expr_list ')' { - $$= GEOM_NEW(thd, - Item_func_spatial_collection(thd, *$3, - Geometry::wkb_multilinestring, - Geometry::wkb_linestring)); + $$= GEOM_NEW(thd, Item_func_multilinestring(thd, *$3)); } | MULTIPOINT '(' expr_list ')' { - $$= GEOM_NEW(thd, - Item_func_spatial_collection(thd, *$3, - Geometry::wkb_multipoint, - Geometry::wkb_point)); + $$= GEOM_NEW(thd, Item_func_multipoint(thd, *$3)); } | MULTIPOLYGON '(' expr_list ')' { - $$= GEOM_NEW(thd, - Item_func_spatial_collection(thd, *$3, - Geometry::wkb_multipolygon, - Geometry::wkb_polygon)); + $$= GEOM_NEW(thd, Item_func_multipolygon(thd, *$3)); } | POINT_SYM '(' expr ',' expr ')' { @@ -11088,10 +11071,7 @@ geometry_function: } | POLYGON '(' expr_list ')' { - $$= GEOM_NEW(thd, - Item_func_spatial_collection(thd, *$3, - Geometry::wkb_polygon, - Geometry::wkb_linestring)); + $$= GEOM_NEW(thd, Item_func_polygon(thd, *$3)); } | WITHIN '(' expr ',' expr ')' { |