Debian Codegraph @

mysql-test/suite/innodb_gis/t/rt_precise.test

raw
1 #*****************************************************************
2 # This was a Myisam testcase, converted to InnoDB
3 # Since Innodb does not support the spatial key, hence converted
4 # Orginal name of the testcase : gis_rt_precise.test
5 #*****************************************************************
6 SET default_storage_engine=InnoDB;
7
8 #
9 # test of rtree (using with spatial data)
10 #
11 --disable_warnings
12 DROP TABLE IF EXISTS t1;
13 --enable_warnings
14
15 CREATE TABLE t1 (
16 fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
17 g GEOMETRY NOT NULL
18 ) ENGINE=InnoDB;
19
20 SHOW CREATE TABLE t1;
21
22 --disable_query_log
23 let $1=150;
24 let $2=150;
25 while ($1)
26 {
27 eval INSERT INTO t1 (g) VALUES (ST_GeomFromText('LineString($1 $1, $2 $2)'));
28 dec $1;
29 inc $2;
30 }
31 --enable_query_log
32
33 SELECT count(*) FROM t1;
34
35 ANALYZE TABLE t1;
36
37 --replace_column 10 #
38 EXPLAIN SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 140))'));
39 SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g, ST_GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))')) ORDER BY fid;
40
41 DROP TABLE t1;
42
43 CREATE TABLE t1 (
44 fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
45 g GEOMETRY NOT NULL SRID 0
46 ) ENGINE=InnoDB;
47
48 --disable_query_log
49 let $1=10;
50 while ($1)
51 {
52 let $2=10;
53 while ($2)
54 {
55 eval INSERT INTO t1 (g) VALUES (LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)));
56 dec $2;
57 }
58 dec $1;
59 }
60 --enable_query_log
61
62 #--error 1464
63 ALTER TABLE t1 ADD SPATIAL KEY(g);
64 SHOW CREATE TABLE t1;
65 SELECT count(*) FROM t1;
66 SELECT fid, ST_AsText(g) FROM t1 WHERE ST_Within(g,
67 ST_GeomFromText('Polygon((40 40,60 40,60 60,40 40))')) ORDER BY fid;
68
69 DROP TABLE t1;
70
71 --echo End of 5.5 tests.