diff options
-rw-r--r-- | mysql-test/suite/innodb_gis/r/rtree.result | 6 | ||||
-rw-r--r-- | sql/item_geofunc.h | 13 |
2 files changed, 16 insertions, 3 deletions
diff --git a/mysql-test/suite/innodb_gis/r/rtree.result b/mysql-test/suite/innodb_gis/r/rtree.result index 285a499b16c..d6604314909 100644 --- a/mysql-test/suite/innodb_gis/r/rtree.result +++ b/mysql-test/suite/innodb_gis/r/rtree.result @@ -56,6 +56,7 @@ INSERT INTO t1 VALUES("left3", ST_GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 SET @p = ST_GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'); SELECT name, ST_AsText(square) from t1 where MBRContains(@p, square); name ST_AsText(square) +small POLYGON((0 0,0 1,1 1,1 0,0 0)) SELECT name, ST_AsText(square) from t1 where MBRDisjoint(@p, square); name ST_AsText(square) up3 POLYGON((0 3,0 5,2 5,2 3,0 3)) @@ -90,6 +91,7 @@ down2 POLYGON((0 -2,0 0,2 0,2 -2,0 -2)) left2 POLYGON((-2 0,-2 2,0 2,0 0,-2 0)) SELECT name, ST_AsText(square) from t1 where MBRWithin(@p, square); name ST_AsText(square) +big POLYGON((0 0,0 3,3 3,3 0,0 0)) SET @vert1 = ST_GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))'); SET @horiz1 = ST_GeomFromText('POLYGON ((-2 0, 2 0, -2 0))'); SET @horiz2 = ST_GeomFromText('POLYGON ((-1 0, 3 0, -1 0))'); @@ -217,7 +219,7 @@ SELECT COUNT(*) FROM t1 WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way); COUNT(*) -0 +9 OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize note Table does not support optimize, doing recreate + analyze instead @@ -226,7 +228,7 @@ SELECT COUNT(*) FROM t1 WHERE ST_CONTAINS(ST_GeomFromText('POLYGON((2 2,4 2, 4 4, 2 4, 2 2))'),way); COUNT(*) -0 +9 DROP TABLE t1; CREATE TABLE t1( i INT, g GEOMETRY NOT NULL, SPATIAL INDEX (g)) ENGINE=InnoDB; INSERT INTO t1 VALUES(1, LINESTRING(POINT(1,1), POINT(4, 4))); diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index abe189395ec..199bc1f47de 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -349,7 +349,18 @@ public: maybe_null= true; } enum Functype functype() const { return spatial_rel; } - enum Functype rev_functype() const { return spatial_rel; } + enum Functype rev_functype() const + { + switch (spatial_rel) + { + case SP_CONTAINS_FUNC: + return SP_WITHIN_FUNC; + case SP_WITHIN_FUNC: + return SP_CONTAINS_FUNC; + default: + return spatial_rel; + } + } bool is_null() { (void) val_int(); return null_value; } void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level, table_map usable_tables, |