summaryrefslogtreecommitdiff
path: root/mysql-test/t/gis.test
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-02-21 14:45:19 +0400
committerunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-02-21 14:45:19 +0400
commit6c5a3c240a8f137f39fe8915fc5d4dd57d7688d9 (patch)
tree6fd662c0ed9147bc564356b4f75a35d77d91c4b1 /mysql-test/t/gis.test
parente988fbdd9b0fa88796adeaed81f30cf1ff15710c (diff)
downloadmariadb-git-6c5a3c240a8f137f39fe8915fc5d4dd57d7688d9.tar.gz
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
Having maybe_null flag unset for geometry/spatial functions leads to wrong Item_func_isnull::val_int()'s results. Fix: set maybe_null flag and add is_null() methods. mysql-test/r/gis.result: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test result. mysql-test/t/gis.test: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - test case. sql/item_geofunc.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for Item_geometry_func and Item_func_as_wkt. - moved length check to the beginnig of the Item_func_spatial_collection::val_str() to affect geometry collection objects at once. - changed Item_func_isempty::val_int() and Item_func_issimple::val_int() to properly handle null_value. sql/item_geofunc.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - set maybe_null flag for geometry/spatial functions. - added is_null() to Item_geometry_func and Item_func_spatial_rel classes. sql/spatial.cc: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error. sql/spatial.h: Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL - changed return type of Geometry::create_from_wkb() to be consistent with Geometry::create_from_wkt(), now it returns Geometry object or NULL in case of error.
Diffstat (limited to 'mysql-test/t/gis.test')
-rw-r--r--mysql-test/t/gis.test36
1 files changed, 35 insertions, 1 deletions
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index 1ae4f0ae62f..6bd0db92152 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -377,4 +377,38 @@ load data infile '../../std_data/bad_gis_data.dat' into table t1;
alter table t1 enable keys;
drop table t1;
-# End of 4.1 tests
+#
+# Bug #26038: is null and bad data
+#
+
+create table t1 (a int, b blob);
+insert into t1 values (1, ''), (2, NULL), (3, '1');
+select * from t1;
+
+select
+ geometryfromtext(b) IS NULL, geometryfromwkb(b) IS NULL, astext(b) IS NULL,
+ aswkb(b) IS NULL, geometrytype(b) IS NULL, centroid(b) IS NULL,
+ envelope(b) IS NULL, startpoint(b) IS NULL, endpoint(b) IS NULL,
+ exteriorring(b) IS NULL, pointn(b, 1) IS NULL, geometryn(b, 1) IS NULL,
+ interiorringn(b, 1) IS NULL, multipoint(b) IS NULL, isempty(b) IS NULL,
+ issimple(b) IS NULL, isclosed(b) IS NULL, dimension(b) IS NULL,
+ numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL,
+ area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL,
+ y(b) IS NULL
+from t1;
+
+select
+ within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL,
+ equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL,
+ intersects(b, b) IS NULL, crosses(b, b) IS NULL
+from t1;
+
+select
+ point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS NULL,
+ multilinestring(b) IS NULL, multipolygon(b) IS NULL,
+ geometrycollection(b) IS NULL
+from t1;
+
+drop table t1;
+
+--echo End of 4.1 tests