mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Merge siva.hindu.god:/home/tsmith/m/bk/maint/bmisc/51
into siva.hindu.god:/home/tsmith/m/bk/maint/51
This commit is contained in:
@@ -60,5 +60,5 @@ enum options_client
|
|||||||
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
|
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
|
||||||
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
|
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
|
||||||
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
|
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
|
||||||
OPT_DEBUG_INFO, OPT_COLUMN_TYPES
|
OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_WRITE_BINLOG
|
||||||
};
|
};
|
||||||
|
@@ -34,7 +34,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
|
|||||||
opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
|
opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
|
||||||
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
|
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
|
||||||
tty_password= 0, opt_frm= 0, info_flag= 0,
|
tty_password= 0, opt_frm= 0, info_flag= 0,
|
||||||
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0;
|
opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
|
||||||
|
opt_write_binlog= 1;
|
||||||
static uint verbose = 0, opt_mysql_port=0;
|
static uint verbose = 0, opt_mysql_port=0;
|
||||||
static my_string opt_mysql_unix_port = 0;
|
static my_string opt_mysql_unix_port = 0;
|
||||||
static char *opt_password = 0, *current_user = 0,
|
static char *opt_password = 0, *current_user = 0,
|
||||||
@@ -123,6 +124,10 @@ static struct my_option my_long_options[] =
|
|||||||
{"medium-check", 'm',
|
{"medium-check", 'm',
|
||||||
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
|
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
|
||||||
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
{"write-binlog", OPT_WRITE_BINLOG,
|
||||||
|
"Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Enabled by default; use --skip-write-binlog when commands should not be sent to replication slaves.",
|
||||||
|
(gptr*) &opt_write_binlog, (gptr*) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
|
||||||
|
1, 0, 0, 0, 0, 0},
|
||||||
{"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
|
{"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
|
||||||
0, 0},
|
0, 0},
|
||||||
{"password", 'p',
|
{"password", 'p',
|
||||||
@@ -598,16 +603,16 @@ static int handle_request_for_tables(char *tables, uint length)
|
|||||||
if (opt_upgrade) end = strmov(end, " FOR UPGRADE");
|
if (opt_upgrade) end = strmov(end, " FOR UPGRADE");
|
||||||
break;
|
break;
|
||||||
case DO_REPAIR:
|
case DO_REPAIR:
|
||||||
op = "REPAIR";
|
op= (opt_write_binlog) ? "REPAIR" : "REPAIR NO_WRITE_TO_BINLOG";
|
||||||
if (opt_quick) end = strmov(end, " QUICK");
|
if (opt_quick) end = strmov(end, " QUICK");
|
||||||
if (opt_extended) end = strmov(end, " EXTENDED");
|
if (opt_extended) end = strmov(end, " EXTENDED");
|
||||||
if (opt_frm) end = strmov(end, " USE_FRM");
|
if (opt_frm) end = strmov(end, " USE_FRM");
|
||||||
break;
|
break;
|
||||||
case DO_ANALYZE:
|
case DO_ANALYZE:
|
||||||
op = "ANALYZE";
|
op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG";
|
||||||
break;
|
break;
|
||||||
case DO_OPTIMIZE:
|
case DO_OPTIMIZE:
|
||||||
op = "OPTIMIZE";
|
op= (opt_write_binlog) ? "OPTIMIZE" : "OPTIMIZE NO_WRITE_TO_BINLOG";
|
||||||
break;
|
break;
|
||||||
case DO_UPGRADE:
|
case DO_UPGRADE:
|
||||||
return fix_object_name("TABLE", tables);
|
return fix_object_name("TABLE", tables);
|
||||||
|
@@ -178,4 +178,73 @@ insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
|||||||
|
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
# End of 5.0 tests
|
--echo End of 4.1 tests
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#24563: MBROverlaps does not seem to function propertly
|
||||||
|
# Bug#54888: MBROverlaps missing in 5.1?
|
||||||
|
#
|
||||||
|
|
||||||
|
# Test all MBR* functions and their non-MBR-prefixed aliases,
|
||||||
|
# using shifted squares to verify the spatial relations.
|
||||||
|
|
||||||
|
create table t1 (name VARCHAR(100), square GEOMETRY);
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||||
|
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||||
|
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||||
|
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||||
|
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
|
||||||
|
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
|
||||||
|
# Overlaps needs a few more tests, with point and line dimensions
|
||||||
|
|
||||||
|
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
|
||||||
|
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
|
||||||
|
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
|
||||||
|
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
|
||||||
|
SET @point1 = GeomFromText('POLYGON ((0 0))');
|
||||||
|
SET @point2 = GeomFromText('POLYGON ((-2 0))');
|
||||||
|
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
|
||||||
|
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
|
||||||
|
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
|
||||||
|
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
|
||||||
|
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
|
||||||
|
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo End of 5.0 tests
|
||||||
|
@@ -393,7 +393,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
|||||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||||
first second w c o e d t i r
|
first second w c o e d t i r
|
||||||
120 120 1 1 0 1 0 0 1 0
|
120 120 1 1 0 1 0 0 1 0
|
||||||
120 121 0 0 0 0 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 120 0 0 1 0 0 0 1 0
|
||||||
121 121 1 1 0 1 0 0 1 0
|
121 121 1 1 0 1 0 0 1 0
|
||||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||||
@@ -460,3 +460,89 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
|||||||
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
||||||
ERROR 23000: Column 'fl' cannot be null
|
ERROR 23000: Column 'fl' cannot be null
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
End of 4.1 tests
|
||||||
|
create table t1 (name VARCHAR(100), square GEOMETRY);
|
||||||
|
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||||
|
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||||
|
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||||
|
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||||
|
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||||
|
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||||
|
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrcontains
|
||||||
|
center,small
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrdisjoint
|
||||||
|
down3,left3,right3,up3
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrequal
|
||||||
|
center
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrintersect
|
||||||
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
contains
|
||||||
|
center,small
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
disjoint
|
||||||
|
down3,left3,right3,up3
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
equals
|
||||||
|
center
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
intersect
|
||||||
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
|
||||||
|
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
|
||||||
|
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
|
||||||
|
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
|
||||||
|
SET @point1 = GeomFromText('POLYGON ((0 0))');
|
||||||
|
SET @point2 = GeomFromText('POLYGON ((-2 0))');
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
|
||||||
|
overlaps
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
|
||||||
|
overlaps
|
||||||
|
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @vert1)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @horiz2)
|
||||||
|
1
|
||||||
|
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @horiz3)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @point1)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @point2)
|
||||||
|
0
|
||||||
|
DROP TABLE t1;
|
||||||
|
End of 5.0 tests
|
||||||
|
@@ -385,7 +385,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
|||||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||||
first second w c o e d t i r
|
first second w c o e d t i r
|
||||||
120 120 1 1 0 1 0 0 1 0
|
120 120 1 1 0 1 0 0 1 0
|
||||||
120 121 0 0 0 0 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 120 0 0 1 0 0 0 1 0
|
||||||
121 121 1 1 0 1 0 0 1 0
|
121 121 1 1 0 1 0 0 1 0
|
||||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||||
@@ -764,6 +764,91 @@ create table t1 (g geometry not null);
|
|||||||
insert into t1 values(default);
|
insert into t1 values(default);
|
||||||
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (name VARCHAR(100), square GEOMETRY);
|
||||||
|
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||||
|
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||||
|
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||||
|
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||||
|
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||||
|
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||||
|
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrcontains
|
||||||
|
center,small
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrdisjoint
|
||||||
|
down3,left3,right3,up3
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrequal
|
||||||
|
center
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrintersect
|
||||||
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
contains
|
||||||
|
center,small
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
disjoint
|
||||||
|
down3,left3,right3,up3
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
equals
|
||||||
|
center
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
intersect
|
||||||
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
|
||||||
|
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
|
||||||
|
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
|
||||||
|
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
|
||||||
|
SET @point1 = GeomFromText('POLYGON ((0 0))');
|
||||||
|
SET @point2 = GeomFromText('POLYGON ((-2 0))');
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
|
||||||
|
overlaps
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
|
||||||
|
overlaps
|
||||||
|
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @vert1)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @horiz2)
|
||||||
|
1
|
||||||
|
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @horiz3)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @point1)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @point2)
|
||||||
|
0
|
||||||
|
DROP TABLE t1;
|
||||||
|
End of 5.0 tests
|
||||||
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
|
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
|
||||||
create view v1 as select * from t1;
|
create view v1 as select * from t1;
|
||||||
desc v1;
|
desc v1;
|
||||||
@@ -775,3 +860,4 @@ f4 geometry YES NULL
|
|||||||
f5 datetime YES NULL
|
f5 datetime YES NULL
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
End of 5.1 tests
|
||||||
|
@@ -393,7 +393,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
|||||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||||
first second w c o e d t i r
|
first second w c o e d t i r
|
||||||
120 120 1 1 0 1 0 0 1 0
|
120 120 1 1 0 1 0 0 1 0
|
||||||
120 121 0 0 0 0 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 120 0 0 1 0 0 0 1 0
|
||||||
121 121 1 1 0 1 0 0 1 0
|
121 121 1 1 0 1 0 0 1 0
|
||||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||||
@@ -460,5 +460,91 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
|||||||
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
||||||
ERROR 23000: Column 'fl' cannot be null
|
ERROR 23000: Column 'fl' cannot be null
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
End of 4.1 tests
|
||||||
|
create table t1 (name VARCHAR(100), square GEOMETRY);
|
||||||
|
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||||
|
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||||
|
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||||
|
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||||
|
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||||
|
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||||
|
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrcontains
|
||||||
|
center,small
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrdisjoint
|
||||||
|
down3,left3,right3,up3
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrequal
|
||||||
|
center
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrintersect
|
||||||
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
contains
|
||||||
|
center,small
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
disjoint
|
||||||
|
down3,left3,right3,up3
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
equals
|
||||||
|
center
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
intersect
|
||||||
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
|
||||||
|
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
|
||||||
|
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
|
||||||
|
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
|
||||||
|
SET @point1 = GeomFromText('POLYGON ((0 0))');
|
||||||
|
SET @point2 = GeomFromText('POLYGON ((-2 0))');
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
|
||||||
|
overlaps
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
|
||||||
|
overlaps
|
||||||
|
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @vert1)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @horiz2)
|
||||||
|
1
|
||||||
|
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @horiz3)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @point1)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @point2)
|
||||||
|
0
|
||||||
|
DROP TABLE t1;
|
||||||
|
End of 5.0 tests
|
||||||
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
|
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
|
||||||
ERROR HY000: The used table type doesn't support SPATIAL indexes
|
ERROR HY000: The used table type doesn't support SPATIAL indexes
|
||||||
|
@@ -393,7 +393,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
|||||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||||
first second w c o e d t i r
|
first second w c o e d t i r
|
||||||
120 120 1 1 0 1 0 0 1 0
|
120 120 1 1 0 1 0 0 1 0
|
||||||
120 121 0 0 0 0 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 120 0 0 1 0 0 0 1 0
|
||||||
121 121 1 1 0 1 0 0 1 0
|
121 121 1 1 0 1 0 0 1 0
|
||||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||||
@@ -460,6 +460,92 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
|||||||
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
||||||
ERROR 23000: Column 'fl' cannot be null
|
ERROR 23000: Column 'fl' cannot be null
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
End of 4.1 tests
|
||||||
|
create table t1 (name VARCHAR(100), square GEOMETRY);
|
||||||
|
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||||
|
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||||
|
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||||
|
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||||
|
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||||
|
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||||
|
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrcontains
|
||||||
|
center,small
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrdisjoint
|
||||||
|
down3,left3,right3,up3
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrequal
|
||||||
|
center
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrintersect
|
||||||
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
contains
|
||||||
|
center,small
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
disjoint
|
||||||
|
down3,left3,right3,up3
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
equals
|
||||||
|
center
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
intersect
|
||||||
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
|
||||||
|
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
|
||||||
|
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
|
||||||
|
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
|
||||||
|
SET @point1 = GeomFromText('POLYGON ((0 0))');
|
||||||
|
SET @point2 = GeomFromText('POLYGON ((-2 0))');
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
|
||||||
|
overlaps
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
|
||||||
|
overlaps
|
||||||
|
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @vert1)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @horiz2)
|
||||||
|
1
|
||||||
|
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @horiz3)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @point1)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @point2)
|
||||||
|
0
|
||||||
|
DROP TABLE t1;
|
||||||
|
End of 5.0 tests
|
||||||
set engine_condition_pushdown = on;
|
set engine_condition_pushdown = on;
|
||||||
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
|
||||||
CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
|
CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
|
||||||
@@ -855,7 +941,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
|
|||||||
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
|
||||||
first second w c o e d t i r
|
first second w c o e d t i r
|
||||||
120 120 1 1 0 1 0 0 1 0
|
120 120 1 1 0 1 0 0 1 0
|
||||||
120 121 0 0 0 0 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 120 0 0 1 0 0 0 1 0
|
||||||
121 121 1 1 0 1 0 0 1 0
|
121 121 1 1 0 1 0 0 1 0
|
||||||
explain extended SELECT g1.fid as first, g2.fid as second,
|
explain extended SELECT g1.fid as first, g2.fid as second,
|
||||||
@@ -922,3 +1008,89 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
|
|||||||
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
insert into t1 (fl) values (pointfromtext('point(1,1)'));
|
||||||
ERROR 23000: Column 'fl' cannot be null
|
ERROR 23000: Column 'fl' cannot be null
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
End of 4.1 tests
|
||||||
|
create table t1 (name VARCHAR(100), square GEOMETRY);
|
||||||
|
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||||
|
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||||
|
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||||
|
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||||
|
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||||
|
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||||
|
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrcontains
|
||||||
|
center,small
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrdisjoint
|
||||||
|
down3,left3,right3,up3
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrequal
|
||||||
|
center
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
mbrintersect
|
||||||
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
contains
|
||||||
|
center,small
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
disjoint
|
||||||
|
down3,left3,right3,up3
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
equals
|
||||||
|
center
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
intersect
|
||||||
|
big,center,down,down2,left,left2,right,right2,small,up,up2
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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
|
||||||
|
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
|
||||||
|
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
|
||||||
|
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
|
||||||
|
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
|
||||||
|
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
|
||||||
|
SET @point1 = GeomFromText('POLYGON ((0 0))');
|
||||||
|
SET @point2 = GeomFromText('POLYGON ((-2 0))');
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
|
||||||
|
overlaps
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
|
||||||
|
overlaps
|
||||||
|
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @vert1)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @horiz2)
|
||||||
|
1
|
||||||
|
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @horiz3)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @point1)
|
||||||
|
0
|
||||||
|
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
|
||||||
|
Overlaps(@horiz1, @point2)
|
||||||
|
0
|
||||||
|
DROP TABLE t1;
|
||||||
|
End of 5.0 tests
|
||||||
|
@@ -471,6 +471,76 @@ create table t1 (g geometry not null);
|
|||||||
insert into t1 values(default);
|
insert into t1 values(default);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#24563: MBROverlaps does not seem to function propertly
|
||||||
|
# Bug#54888: MBROverlaps missing in 5.1?
|
||||||
|
#
|
||||||
|
|
||||||
|
# Test all MBR* functions and their non-MBR-prefixed aliases,
|
||||||
|
# using shifted squares to verify the spatial relations.
|
||||||
|
|
||||||
|
create table t1 (name VARCHAR(100), square GEOMETRY);
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
|
||||||
|
INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
|
||||||
|
INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
|
||||||
|
INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
|
||||||
|
INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
|
||||||
|
INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
|
||||||
|
INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
|
||||||
|
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
|
||||||
|
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;
|
||||||
|
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;
|
||||||
|
|
||||||
|
# Overlaps needs a few more tests, with point and line dimensions
|
||||||
|
|
||||||
|
SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
|
||||||
|
SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
|
||||||
|
SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
|
||||||
|
SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
|
||||||
|
SET @point1 = GeomFromText('POLYGON ((0 0))');
|
||||||
|
SET @point2 = GeomFromText('POLYGON ((-2 0))');
|
||||||
|
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
|
||||||
|
SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
|
||||||
|
SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
|
||||||
|
SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
|
||||||
|
SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
|
||||||
|
SELECT Overlaps(@horiz1, @point1) FROM DUAL;
|
||||||
|
SELECT Overlaps(@horiz1, @point2) FROM DUAL;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Bug #11335 View redefines column types
|
# Bug #11335 View redefines column types
|
||||||
#
|
#
|
||||||
@@ -480,3 +550,4 @@ desc v1;
|
|||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo End of 5.1 tests
|
||||||
|
@@ -4792,6 +4792,12 @@ static Native_func_registry func_array[] =
|
|||||||
{ C_STRING_WITH_LEN("MAKE_SET"), BUILDER(Create_func_make_set)},
|
{ C_STRING_WITH_LEN("MAKE_SET"), BUILDER(Create_func_make_set)},
|
||||||
{ C_STRING_WITH_LEN("MASTER_POS_WAIT"), BUILDER(Create_func_master_pos_wait)},
|
{ C_STRING_WITH_LEN("MASTER_POS_WAIT"), BUILDER(Create_func_master_pos_wait)},
|
||||||
{ C_STRING_WITH_LEN("MBRCONTAINS"), GEOM_BUILDER(Create_func_contains)},
|
{ C_STRING_WITH_LEN("MBRCONTAINS"), GEOM_BUILDER(Create_func_contains)},
|
||||||
|
{ C_STRING_WITH_LEN("MBRDISJOINT"), GEOM_BUILDER(Create_func_disjoint)},
|
||||||
|
{ C_STRING_WITH_LEN("MBREQUAL"), GEOM_BUILDER(Create_func_equals)},
|
||||||
|
{ C_STRING_WITH_LEN("MBRINTERSECTS"), GEOM_BUILDER(Create_func_intersects)},
|
||||||
|
{ C_STRING_WITH_LEN("MBROVERLAPS"), GEOM_BUILDER(Create_func_overlaps)},
|
||||||
|
{ C_STRING_WITH_LEN("MBRTOUCHES"), GEOM_BUILDER(Create_func_touches)},
|
||||||
|
{ C_STRING_WITH_LEN("MBRWITHIN"), GEOM_BUILDER(Create_func_within)},
|
||||||
{ C_STRING_WITH_LEN("MD5"), BUILDER(Create_func_md5)},
|
{ C_STRING_WITH_LEN("MD5"), BUILDER(Create_func_md5)},
|
||||||
{ C_STRING_WITH_LEN("MLINEFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)},
|
{ C_STRING_WITH_LEN("MLINEFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)},
|
||||||
{ C_STRING_WITH_LEN("MLINEFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)},
|
{ C_STRING_WITH_LEN("MLINEFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)},
|
||||||
|
@@ -144,15 +144,46 @@ struct MBR
|
|||||||
return (xmin<x) && (xmax>x) && (ymin<y) && (ymax>y);
|
return (xmin<x) && (xmax>x) && (ymin<y) && (ymax>y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
The dimension maps to an integer as:
|
||||||
|
- Polygon -> 2
|
||||||
|
- Horizontal or vertical line -> 1
|
||||||
|
- Point -> 0
|
||||||
|
- Invalid MBR -> -1
|
||||||
|
*/
|
||||||
|
int dimension() const
|
||||||
|
{
|
||||||
|
int d= 0;
|
||||||
|
|
||||||
|
if (xmin > xmax)
|
||||||
|
return -1;
|
||||||
|
else if (xmin < xmax)
|
||||||
|
d++;
|
||||||
|
|
||||||
|
if (ymin > ymax)
|
||||||
|
return -1;
|
||||||
|
else if (ymin < ymax)
|
||||||
|
d++;
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
int overlaps(const MBR *mbr)
|
int overlaps(const MBR *mbr)
|
||||||
{
|
{
|
||||||
int lb= mbr->inner_point(xmin, ymin);
|
/*
|
||||||
int rb= mbr->inner_point(xmax, ymin);
|
overlaps() requires that some point inside *this is also inside
|
||||||
int rt= mbr->inner_point(xmax, ymax);
|
*mbr, and that both geometries and their intersection are of the
|
||||||
int lt= mbr->inner_point(xmin, ymax);
|
same dimension.
|
||||||
|
*/
|
||||||
|
int d = dimension();
|
||||||
|
|
||||||
int a = lb+rb+rt+lt;
|
if (d != mbr->dimension() || d <= 0 || contains(mbr) || within(mbr))
|
||||||
return (a>0) && (a<4) && (!within(mbr));
|
return 0;
|
||||||
|
|
||||||
|
MBR intersection(max(xmin, mbr->xmin), max(ymin, mbr->ymin),
|
||||||
|
min(xmax, mbr->xmax), min(ymax, mbr->ymax));
|
||||||
|
|
||||||
|
return (d == intersection.dimension());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user