Commit fd0cc03f authored by unknown's avatar unknown

fixed printability of gis functions

code covarage for srid, GeomFromText with 2 parameters
code covarage foe print() method of gis functions


mysql-test/r/gis.result:
  code covarage for srid, GeomFromText with 2 parameters
  code covarage foe print() method of gis functions
mysql-test/t/gis.test:
  code covarage for srid, GeomFromText with 2 parameters
  code covarage foe print() method of gis functions
  + commented test for issimple() (bugreport sent)
sql/item_geofunc.h:
  fixed printability of gis functions
parent 1845b2e7
......@@ -224,6 +224,11 @@ fid AsText(Envelope(g))
119 POLYGON((0 0,3 0,3 3,0 3,0 0))
120 POLYGON((0 0,10 0,10 10,0 10,0 0))
121 POLYGON((3 6,44 6,44 9,3 9,3 6))
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from geo;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE geo ALL NULL NULL NULL NULL 21
Warnings:
Note 1003 select high_priority dimension(test.geo.g) AS `Dimension(g)`,geometrytype(test.geo.g) AS `GeometryType(g)`,isempty(test.geo.g) AS `IsEmpty(g)`,astext(envelope(test.geo.g)) AS `AsText(Envelope(g))` from test.geo
SELECT fid, X(g) FROM pt;
fid X(g)
101 10
......@@ -236,6 +241,11 @@ fid Y(g)
102 10
103 20
104 20
explain extended select X(g),Y(g) FROM pt;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE pt ALL NULL NULL NULL NULL 4
Warnings:
Note 1003 select high_priority x(test.pt.g) AS `X(g)`,y(test.pt.g) AS `Y(g)` from test.pt
SELECT fid, AsText(StartPoint(g)) FROM ls;
fid AsText(StartPoint(g))
105 POINT(0 0)
......@@ -266,6 +276,11 @@ fid IsClosed(g)
105 0
106 1
107 0
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM ls;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE ls ALL NULL NULL NULL NULL 3
Warnings:
Note 1003 select high_priority astext(startpoint(test.ls.g)) AS `AsText(StartPoint(g))`,astext(endpoint(test.ls.g)) AS `AsText(EndPoint(g))`,glength(test.ls.g) AS `GLength(g)`,numpoints(test.ls.g) AS `NumPoints(g)`,astext(pointn(test.ls.g,2)) AS `AsText(PointN(g, 2))`,isclosed(test.ls.g) AS `IsClosed(g)` from test.ls
SELECT fid, AsText(Centroid(g)) FROM p;
fid AsText(Centroid(g))
108 POINT(15 15)
......@@ -291,6 +306,11 @@ fid AsText(InteriorRingN(g, 1))
108 NULL
109 LINESTRING(10 10,20 10,20 20,10 20,10 10)
110 NULL
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM p;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE p ALL NULL NULL NULL NULL 3
Warnings:
Note 1003 select high_priority astext(centroid(test.p.g)) AS `AsText(Centroid(g))`,area(test.p.g) AS `Area(g)`,astext(exteriorring(test.p.g)) AS `AsText(ExteriorRing(g))`,numinteriorrings(test.p.g) AS `NumInteriorRings(g)`,astext(interiorringn(test.p.g,1)) AS `AsText(InteriorRingN(g, 1))` from test.p
SELECT fid, IsClosed(g) FROM mls;
fid IsClosed(g)
114 0
......@@ -325,6 +345,11 @@ SELECT fid, NumGeometries(g) from gc;
fid NumGeometries(g)
120 2
121 2
explain extended SELECT fid, NumGeometries(g) from mpt;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE mpt ALL NULL NULL NULL NULL 3
Warnings:
Note 1003 select high_priority test.mpt.fid AS `fid`,numgeometries(test.mpt.g) AS `NumGeometries(g)` from test.mpt
SELECT fid, AsText(GeometryN(g, 2)) from mpt;
fid AsText(GeometryN(g, 2))
111 POINT(10 10)
......@@ -344,6 +369,11 @@ SELECT fid, AsText(GeometryN(g, 2)) from gc;
fid AsText(GeometryN(g, 2))
120 LINESTRING(0 0,10 10)
121 LINESTRING(3 6,7 9)
explain extended SELECT fid, AsText(GeometryN(g, 2)) from mpt;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE mpt ALL NULL NULL NULL NULL 3
Warnings:
Note 1003 select high_priority test.mpt.fid AS `fid`,astext(geometryn(test.mpt.g,2)) AS `AsText(GeometryN(g, 2))` from test.mpt
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,
......@@ -354,6 +384,16 @@ first second w c o e d t i r
120 121 0 0 0 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
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,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gc g1, gc g2 ORDER BY first, second;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE g1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
1 SIMPLE g2 ALL NULL NULL NULL NULL 2
Warnings:
Note 1003 select high_priority test.g1.fid AS `first`,test.g2.fid AS `second`,within(test.g1.g,test.g2.g) AS `w`,contains(test.g1.g,test.g2.g) AS `c`,overlaps(test.g1.g,test.g2.g) AS `o`,equals(test.g1.g,test.g2.g) AS `e`,disjoint(test.g1.g,test.g2.g) AS `d`,touches(test.g1.g,test.g2.g) AS `t`,intersects(test.g1.g,test.g2.g) AS `i`,crosses(test.g1.g,test.g2.g) AS `r` from test.gc g1 join test.gc g2 order by test.g1.fid,test.g2.fid
DROP TABLE pt, ls, p, mpt, mls, mp, gc, geo;
CREATE TABLE g1 (
pt point,
......@@ -391,3 +431,26 @@ DROP TABLE g1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))
POINT(1 4)
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select high_priority astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))`
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select high_priority astext(geometryfromwkb(aswkb(geometryfromtext(_latin1'POINT(1 4)')))) AS `AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))))`
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
SRID(GeomFromText('LineString(1 1,2 2)',101))
101
explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select high_priority srid(geometryfromtext(_latin1'LineString(1 1,2 2)',101)) AS `SRID(GeomFromText('LineString(1 1,2 2)',101))`
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select high_priority issimple(multipoint(point(3,6),point(4,10))) AS `issimple(MultiPoint(Point(3, 6), Point(4, 10)))`,issimple(point(3,6)) AS `issimple(Point(3, 6))`
......@@ -82,9 +82,11 @@ SELECT fid, Dimension(g) FROM geo;
SELECT fid, GeometryType(g) FROM geo;
SELECT fid, IsEmpty(g) FROM geo;
SELECT fid, AsText(Envelope(g)) FROM geo;
explain extended select Dimension(g), GeometryType(g), IsEmpty(g), AsText(Envelope(g)) from geo;
SELECT fid, X(g) FROM pt;
SELECT fid, Y(g) FROM pt;
explain extended select X(g),Y(g) FROM pt;
SELECT fid, AsText(StartPoint(g)) FROM ls;
SELECT fid, AsText(EndPoint(g)) FROM ls;
......@@ -92,12 +94,14 @@ SELECT fid, GLength(g) FROM ls;
SELECT fid, NumPoints(g) FROM ls;
SELECT fid, AsText(PointN(g, 2)) FROM ls;
SELECT fid, IsClosed(g) FROM ls;
explain extended select AsText(StartPoint(g)),AsText(EndPoint(g)),GLength(g),NumPoints(g),AsText(PointN(g, 2)),IsClosed(g) FROM ls;
SELECT fid, AsText(Centroid(g)) FROM p;
SELECT fid, Area(g) FROM p;
SELECT fid, AsText(ExteriorRing(g)) FROM p;
SELECT fid, NumInteriorRings(g) FROM p;
SELECT fid, AsText(InteriorRingN(g, 1)) FROM p;
explain extended select AsText(Centroid(g)),Area(g),AsText(ExteriorRing(g)),NumInteriorRings(g),AsText(InteriorRingN(g, 1)) FROM p;
SELECT fid, IsClosed(g) FROM mls;
......@@ -108,17 +112,24 @@ SELECT fid, NumGeometries(g) from mpt;
SELECT fid, NumGeometries(g) from mls;
SELECT fid, NumGeometries(g) from mp;
SELECT fid, NumGeometries(g) from gc;
explain extended SELECT fid, NumGeometries(g) from mpt;
SELECT fid, AsText(GeometryN(g, 2)) from mpt;
SELECT fid, AsText(GeometryN(g, 2)) from mls;
SELECT fid, AsText(GeometryN(g, 2)) from mp;
SELECT fid, AsText(GeometryN(g, 2)) from gc;
explain extended SELECT fid, AsText(GeometryN(g, 2)) from mpt;
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,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gc g1, gc g2 ORDER BY first, second;
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,
Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gc g1, gc g2 ORDER BY first, second;
DROP TABLE pt, ls, p, mpt, mls, mp, gc, geo;
......@@ -142,3 +153,9 @@ SHOW FIELDS FROM g1;
DROP TABLE g1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
explain extended SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
explain extended SELECT AsText(GeometryFromWKB(AsWKB(PointFromText('POINT(1 4)'))));
SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
explain extended SELECT SRID(GeomFromText('LineString(1 1,2 2)',101));
#select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6)),issimple(PolygonFromText('POLYGON((10 10,20 10,20 20,10 20,10 10))')),issimple(GeometryFromText('POINT(1 4)')), issimple(AsWKB(GeometryFromText('POINT(1 4)')));
explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimple(Point(3, 6));
......@@ -216,6 +216,7 @@ class Item_func_spatial_rel: public Item_bool_func2
return "sp_unknown";
}
}
void print(String *str) { Item_func::print(str); }
};
class Item_func_isempty: public Item_bool_func
......@@ -292,7 +293,7 @@ class Item_func_numinteriorring: public Item_int_func
public:
Item_func_numinteriorring(Item *a): Item_int_func(a) {}
longlong val_int();
const char *func_name() const { return "numinteriorring"; }
const char *func_name() const { return "numinteriorrings"; }
void fix_length_and_dec() { max_length=10; }
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment