Several new OpenGIS functions

Fixes in GeomFromText() to accept an new optional
   argument respobsible for SRID. This is for more
   OpenGIS conformance and PostGIS compatibility
   to simplify migrating from PgSQL to MySQL
parent 67745b29
......@@ -30,7 +30,7 @@ bool opt_search=0;
int opt_verbose=0;
ulong opt_count=100000;
#define max_allowed_array 8000 // Don't generate bigger arrays than this
#define max_allowed_array 16000 // Don't generate bigger arrays than this
#define max_symbol 32767 // Use this for 'not found'
#define how_much_for_plus 8 // 2-8
#define type_count 1 // 1-5
......
......@@ -159,7 +159,7 @@ static SYMBOL symbols[] = {
{ "FULL", SYM(FULL),0,0},
{ "FULLTEXT", SYM(FULLTEXT_SYM),0,0},
{ "FUNCTION", SYM(UDF_SYM),0,0},
{ "GEOM", SYM(GEOM_SYM),0,0},
{ "GEOMETRY", SYM(GEOMETRY_SYM),0,0},
{ "GLOBAL", SYM(GLOBAL_SYM),0,0},
{ "GRANT", SYM(GRANT),0,0},
{ "GRANTS", SYM(GRANTS),0,0},
......@@ -453,7 +453,8 @@ static SYMBOL sql_functions[] = {
{ "GEOMETRYCOLLECTION",SYM(GEOMETRYCOLLECTION),0,0},
{ "GEOMETRYN", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_geometryn)},
{ "GEOMETRYTYPE", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_geometry_type)},
{ "GEOMFROMTEXT", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_geometry_from_text)},
{ "GEOMCOLLFROMTEXT", SYM(GEOMCOLLFROMTEXT),0,0},
{ "GEOMFROMTEXT", SYM(GEOMFROMTEXT),0,0},
{ "GLENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_glength)},
{ "GREATEST", SYM(GREATEST_SYM),0,0},
{ "GROUP_UNIQUE_USERS", SYM(GROUP_UNIQUE_USERS),0,0},
......@@ -471,6 +472,7 @@ static SYMBOL sql_functions[] = {
{ "LCASE", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_lcase)},
{ "LEAST", SYM(LEAST_SYM),0,0},
{ "LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_length)},
{ "LINEFROMTEXT", SYM(LINEFROMTEXT),0,0},
{ "LINESTRING", SYM(LINESTRING),0,0},
{ "LOAD_FILE", SYM(FUNC_ARG1),0,CREATE_FUNC(create_load_file)},
{ "LOCATE", SYM(LOCATE),0,0},
......@@ -487,6 +489,9 @@ static SYMBOL sql_functions[] = {
{ "MID", SYM(SUBSTRING),0,0}, /* unireg function */
{ "MIN", SYM(MIN_SYM),0,0},
{ "MOD", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_mod)},
{ "MLINEFROMTEXT", SYM(MLINEFROMTEXT),0,0},
{ "MPOINTFROMTEXT", SYM(MPOINTFROMTEXT),0,0},
{ "MPOLYFROMTEXT", SYM(MPOLYFROMTEXT),0,0},
{ "MULTILINESTRING", SYM(MULTILINESTRING),0,0},
{ "MULTIPOINT", SYM(MULTIPOINT),0,0},
{ "MULTIPOLYGON", SYM(MULTIPOLYGON),0,0},
......@@ -504,7 +509,9 @@ static SYMBOL sql_functions[] = {
{ "PERIOD_DIFF", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_period_diff)},
{ "PI", SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_pi)},
{ "POINT", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_point)},
{ "POINTFROMTEXT", SYM(POINTFROMTEXT),0,0},
{ "POINTN", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_pointn)},
{ "POLYFROMTEXT", SYM(POLYFROMTEXT),0,0},
{ "POLYGON", SYM(POLYGON),0,0},
{ "POSITION", SYM(POSITION_SYM),0,0},
{ "POW", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_pow)},
......
......@@ -349,7 +349,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token ENUM
%token FAST_SYM
%token FLOAT_SYM
%token GEOM_SYM
%token GEOMETRY_SYM
%token INT_SYM
%token LIMIT
%token LONGBLOB
......@@ -407,6 +407,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token FORMAT_SYM
%token FOR_SYM
%token FROM_UNIXTIME
%token GEOMCOLLFROMTEXT
%token GEOMFROMTEXT
%token GEOMETRYCOLLECTION
%token GROUP_UNIQUE_USERS
%token HOUR_MINUTE_SYM
......@@ -419,6 +421,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token INTERVAL_SYM
%token LAST_INSERT_ID
%token LEFT
%token LINEFROMTEXT
%token LINESTRING
%token LOCATE
%token MAKE_SET_SYM
......@@ -427,11 +430,16 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token MODE_SYM
%token MODIFY_SYM
%token MONTH_SYM
%token MLINEFROMTEXT
%token MPOINTFROMTEXT
%token MPOLYFROMTEXT
%token MULTILINESTRING
%token MULTIPOINT
%token MULTIPOLYGON
%token NOW_SYM
%token PASSWORD
%token POINTFROMTEXT
%token POLYFROMTEXT
%token POLYGON
%token POSITION_SYM
%token PROCEDURE
......@@ -966,7 +974,7 @@ type:
$$=FIELD_TYPE_TINY_BLOB; }
| BLOB_SYM { Lex->type|=BINARY_FLAG;
$$=FIELD_TYPE_BLOB; }
| GEOM_SYM { Lex->type|=BINARY_FLAG;
| GEOMETRY_SYM { Lex->type|=BINARY_FLAG;
$$=FIELD_TYPE_GEOMETRY; }
| MEDIUMBLOB { Lex->type|=BINARY_FLAG;
$$=FIELD_TYPE_MEDIUM_BLOB; }
......@@ -1722,6 +1730,10 @@ simple_expr:
}
| FIELD_FUNC '(' expr ',' expr_list ')'
{ $$= new Item_func_field($3, *$5); }
| GEOMFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| GEOMFROMTEXT '(' expr ',' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| GEOMETRYCOLLECTION '(' expr_list ')'
{ $$= new Item_func_spatial_collection(* $3,
Geometry::wkbGeometryCollection,
......@@ -1757,10 +1769,18 @@ simple_expr:
{ $$= new Item_func_locate($5,$3); }
| LOCATE '(' expr ',' expr ',' expr ')'
{ $$= new Item_func_locate($5,$3,$7); }
| GREATEST_SYM '(' expr ',' expr_list ')'
| GEOMCOLLFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| GEOMCOLLFROMTEXT '(' expr ',' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| GREATEST_SYM '(' expr ',' expr_list ')'
{ $5->push_front($3); $$= new Item_func_max(*$5); }
| LEAST_SYM '(' expr ',' expr_list ')'
{ $5->push_front($3); $$= new Item_func_min(*$5); }
| LINEFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| LINEFROMTEXT '(' expr ',' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| MINUTE_SYM '(' expr ')'
{ $$= new Item_func_minute($3); }
| MONTH_SYM '(' expr ')'
......@@ -1768,7 +1788,19 @@ simple_expr:
| MULTILINESTRING '(' expr_list ')'
{ $$= new Item_func_spatial_collection(* $3,
Geometry::wkbMultiLineString, Geometry::wkbLineString); }
| MULTIPOINT '(' expr_list ')'
| MLINEFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| MLINEFROMTEXT '(' expr ',' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| MPOINTFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| MPOINTFROMTEXT '(' expr ',' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| MPOLYFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| MPOLYFROMTEXT '(' expr ',' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| MULTIPOINT '(' expr_list ')'
{ $$= new Item_func_spatial_collection(* $3,
Geometry::wkbMultiPoint, Geometry::wkbPoint); }
| MULTIPOLYGON '(' expr_list ')'
......@@ -1782,7 +1814,15 @@ simple_expr:
{
$$= new Item_func_password($3);
}
| POLYGON '(' expr_list ')'
| POINTFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| POINTFROMTEXT '(' expr ',' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| POLYFROMTEXT '(' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| POLYFROMTEXT '(' expr ',' expr ')'
{ $$= new Item_func_geometry_from_text($3) }
| POLYGON '(' expr_list ')'
{ $$= new Item_func_spatial_collection(* $3,
Geometry::wkbPolygon, Geometry::wkbLineString); }
| POSITION_SYM '(' no_in_expr IN_SYM expr ')'
......
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