~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to mysql-test/t/gis-rt-precise.test

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2013-12-22 10:27:05 UTC
  • Revision ID: package-import@ubuntu.com-20131222102705-mndw7s12mz0szrcn
Tags: upstream-5.5.32
Import upstream version 5.5.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-- source include/have_geometry.inc
 
2
 
 
3
#
 
4
# test of rtree (using with spatial data)
 
5
#
 
6
--disable_warnings
 
7
DROP TABLE IF EXISTS t1;
 
8
--enable_warnings
 
9
 
 
10
CREATE TABLE t1 (
 
11
  fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
 
12
  g GEOMETRY NOT NULL,
 
13
  SPATIAL KEY(g)
 
14
) ENGINE=MyISAM;
 
15
 
 
16
SHOW CREATE TABLE t1;
 
17
 
 
18
--disable_query_log
 
19
let $1=150;
 
20
let $2=150;
 
21
while ($1)
 
22
{
 
23
  eval INSERT INTO t1 (g) VALUES (GeomFromText('LineString($1 $1, $2 $2)'));
 
24
  dec $1;
 
25
  inc $2;
 
26
}
 
27
--enable_query_log
 
28
 
 
29
SELECT count(*) FROM t1;
 
30
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 140))'));
 
31
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, GeomFromText('Polygon((140 140,160 140,160 160,140 160,140 140))'));
 
32
 
 
33
DROP TABLE t1;
 
34
 
 
35
CREATE TABLE t1 (
 
36
  fid INT NOT NULL AUTO_INCREMENT PRIMARY KEY, 
 
37
  g GEOMETRY NOT NULL
 
38
) ENGINE=MyISAM;
 
39
 
 
40
--disable_query_log
 
41
let $1=10;
 
42
while ($1)
 
43
{
 
44
  let $2=10;
 
45
  while ($2)
 
46
  {
 
47
    eval INSERT INTO t1 (g) VALUES (LineString(Point($1 * 10 - 9, $2 * 10 - 9), Point($1 * 10, $2 * 10)));
 
48
    dec $2;
 
49
  }
 
50
  dec $1;
 
51
}
 
52
--enable_query_log
 
53
 
 
54
ALTER TABLE t1 ADD SPATIAL KEY(g);
 
55
SHOW CREATE TABLE t1;
 
56
SELECT count(*) FROM t1;
 
57
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, 
 
58
  GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
 
59
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g, 
 
60
  GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
 
61
 
 
62
DROP TABLE t1;
 
63
 
 
64
--echo End of 5.5 tests.