diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index 7037fc1b383..c0baa0e8874 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -1189,7 +1189,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) DEFAULT NULL + `c1` varbinary(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); @@ -1199,7 +1199,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varbinary(21) DEFAULT NULL + `c1` varbinary(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 385d7c34d6f..08139ff5f07 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -1583,7 +1583,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL + `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); @@ -1593,7 +1593,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET cp1251 DEFAULT NULL + `c1` varchar(2) CHARACTER SET cp1251 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index 339e2e0787d..852394a9d3a 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -1865,7 +1865,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) DEFAULT NULL + `c1` varchar(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); @@ -1875,7 +1875,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) DEFAULT NULL + `c1` varchar(2) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 5b4d1320f08..e2b371da31e 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -2772,7 +2772,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); @@ -2782,7 +2782,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET ucs2 DEFAULT NULL + `c1` varchar(2) CHARACTER SET ucs2 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index 6eae47844ca..56027e68f3f 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -3640,7 +3640,7 @@ create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1; show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)')))); @@ -3650,7 +3650,7 @@ create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) show create table t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL + `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 drop table t1; select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)')))); diff --git a/mysql-test/suite/archive/archive_gis.result b/mysql-test/suite/archive/archive_gis.result index 9f3c5b062a3..6ee50fd3b85 100644 --- a/mysql-test/suite/archive/archive_gis.result +++ b/mysql-test/suite/archive/archive_gis.result @@ -395,7 +395,7 @@ first second w c o e d t i r 120 120 1 1 0 1 0 0 1 0 120 121 0 0 1 0 0 0 1 0 121 120 0 0 1 0 0 0 1 0 -121 121 1 1 0 1 0 1 1 0 +121 121 1 1 0 1 0 0 1 0 explain extended SELECT g1.fid as first, g2.fid as second, Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, @@ -494,7 +494,7 @@ mbroverlaps down,left,right,up SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; mbrtouches -big,center,down,down2,left,left2,right,right2,small,up,up2 +down2,left2,right2,up2 SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; mbrwithin big,center @@ -515,7 +515,7 @@ overlaps down,left,right,up SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; touches -big,center,down,down2,left,left2,right,right2,small,up,up2 +down2,left2,right2,up2 SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; within big,center diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result index de5ff61357e..fc13ba1ab2c 100644 --- a/mysql-test/suite/innodb/r/innodb_gis.result +++ b/mysql-test/suite/innodb/r/innodb_gis.result @@ -395,7 +395,7 @@ first second w c o e d t i r 120 120 1 1 0 1 0 0 1 0 120 121 0 0 1 0 0 0 1 0 121 120 0 0 1 0 0 0 1 0 -121 121 1 1 0 1 0 1 1 0 +121 121 1 1 0 1 0 0 1 0 explain extended SELECT g1.fid as first, g2.fid as second, Within(g1.g, g2.g) as w, Contains(g1.g, g2.g) as c, Overlaps(g1.g, g2.g) as o, Equals(g1.g, g2.g) as e, Disjoint(g1.g, g2.g) as d, Touches(g1.g, g2.g) as t, @@ -494,7 +494,7 @@ mbroverlaps down,left,right,up SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; mbrtouches -big,center,down,down2,left,left2,right,right2,small,up,up2 +down2,left2,right2,up2 SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; mbrwithin big,center @@ -515,7 +515,7 @@ overlaps down,left,right,up SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; touches -big,center,down,down2,left,left2,right,right2,small,up,up2 +down2,left2,right2,up2 SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name; within big,center diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index 52713995c4f..c4cf683fa9a 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -415,24 +415,28 @@ public: void fix_length_and_dec() { maybe_null= 1; } }; -class Item_func_issimple: public Item_bool_func +class Item_func_issimple: public Item_int_func { Gcalc_heap collector; Gcalc_function func; Gcalc_scan_iterator scan_it; String tmp; public: - Item_func_issimple(Item *a): Item_bool_func(a) {} + Item_func_issimple(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "st_issimple"; } + void fix_length_and_dec() { decimals=0; max_length=2; } + uint decimal_precision() const { return 1; } }; -class Item_func_isclosed: public Item_bool_func +class Item_func_isclosed: public Item_int_func { public: - Item_func_isclosed(Item *a): Item_bool_func(a) {} + Item_func_isclosed(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "st_isclosed"; } + void fix_length_and_dec() { decimals=0; max_length=2; } + uint decimal_precision() const { return 1; } }; class Item_func_isring: public Item_func_issimple