Loading mysql-test/r/gis-rtree.result +1 −1 Original line number Diff line number Diff line Loading @@ -801,5 +801,5 @@ CREATE TABLE t1 (st varchar(100)); INSERT INTO t1 VALUES ("Fake string"); CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom)); INSERT INTO t2 SELECT GeomFromText(st) FROM t1; ERROR HY000: Unknown error ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1, t2; mysql-test/r/gis.result +12 −2 Original line number Diff line number Diff line Loading @@ -461,9 +461,9 @@ Note 1003 select issimple(multipoint(point(3,6),point(4,10))) AS `issimple(Multi create table t1 (a geometry not null); insert into t1 values (GeomFromText('Point(1 2)')); insert into t1 values ('Garbage'); ERROR HY000: Unknown error ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert IGNORE into t1 values ('Garbage'); ERROR HY000: Unknown error ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field alter table t1 add spatial index(a); drop table t1; create table t1(a geometry not null, spatial index(a)); Loading Loading @@ -655,3 +655,13 @@ t1 where object_id=85984; object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo)) 85984 MULTIPOLYGON 0 POINT(-114.87787186923 36.33101763469) drop table t1; create table t1 (fl geometry); insert into t1 values (1); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (1.11); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (pointfromtext('point(1,1)')); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1; mysql-test/t/gis-rtree.test +1 −1 Original line number Diff line number Diff line Loading @@ -168,6 +168,6 @@ drop table t1; CREATE TABLE t1 (st varchar(100)); INSERT INTO t1 VALUES ("Fake string"); CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom)); --error 1105 --error 1416 INSERT INTO t2 SELECT GeomFromText(st) FROM t1; drop table t1, t2; mysql-test/t/gis.test +14 −2 Original line number Diff line number Diff line Loading @@ -165,9 +165,9 @@ explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimpl create table t1 (a geometry not null); insert into t1 values (GeomFromText('Point(1 2)')); -- error 1105 -- error 1416 insert into t1 values ('Garbage'); -- error 1105 -- error 1416 insert IGNORE into t1 values ('Garbage'); alter table t1 add spatial index(a); Loading Loading @@ -359,3 +359,15 @@ select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from t1 where object_id=85984; drop table t1; create table t1 (fl geometry); --error 1416 insert into t1 values (1); --error 1416 insert into t1 values (1.11); --error 1416 insert into t1 values ("qwerty"); --error 1416 insert into t1 values (pointfromtext('point(1,1)')); drop table t1; sql/field.cc +29 −1 Original line number Diff line number Diff line Loading @@ -7267,12 +7267,38 @@ void Field_geom::sql_type(String &res) const } int Field_geom::store(double nr) { my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); return -1; } int Field_geom::store(longlong nr) { my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); return -1; } int Field_geom::store_decimal(const my_decimal *) { my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); return -1; } int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) { if (!length) bzero(ptr, Field_blob::pack_length()); else { if (from == Geometry::bad_geometry_data.ptr()) goto err; // Check given WKB uint32 wkb_type; if (length < SRID_SIZE + WKB_HEADER_SIZE + SIZEOF_STORED_DOUBLE*2) Loading @@ -7280,7 +7306,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) wkb_type= uint4korr(from + WKB_HEADER_SIZE); if (wkb_type < (uint32) Geometry::wkb_point || wkb_type > (uint32) Geometry::wkb_end) return -1; goto err; Field_blob::store_length(length); if (table->copy_blobs || length <= MAX_FIELD_WIDTH) { // Must make a copy Loading @@ -7293,6 +7319,8 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) err: bzero(ptr, Field_blob::pack_length()); my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); return -1; } Loading Loading
mysql-test/r/gis-rtree.result +1 −1 Original line number Diff line number Diff line Loading @@ -801,5 +801,5 @@ CREATE TABLE t1 (st varchar(100)); INSERT INTO t1 VALUES ("Fake string"); CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom)); INSERT INTO t2 SELECT GeomFromText(st) FROM t1; ERROR HY000: Unknown error ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1, t2;
mysql-test/r/gis.result +12 −2 Original line number Diff line number Diff line Loading @@ -461,9 +461,9 @@ Note 1003 select issimple(multipoint(point(3,6),point(4,10))) AS `issimple(Multi create table t1 (a geometry not null); insert into t1 values (GeomFromText('Point(1 2)')); insert into t1 values ('Garbage'); ERROR HY000: Unknown error ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert IGNORE into t1 values ('Garbage'); ERROR HY000: Unknown error ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field alter table t1 add spatial index(a); drop table t1; create table t1(a geometry not null, spatial index(a)); Loading Loading @@ -655,3 +655,13 @@ t1 where object_id=85984; object_id geometrytype(geo) ISSIMPLE(GEO) ASTEXT(centroid(geo)) 85984 MULTIPOLYGON 0 POINT(-114.87787186923 36.33101763469) drop table t1; create table t1 (fl geometry); insert into t1 values (1); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (1.11); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values ("qwerty"); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field insert into t1 values (pointfromtext('point(1,1)')); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field drop table t1;
mysql-test/t/gis-rtree.test +1 −1 Original line number Diff line number Diff line Loading @@ -168,6 +168,6 @@ drop table t1; CREATE TABLE t1 (st varchar(100)); INSERT INTO t1 VALUES ("Fake string"); CREATE TABLE t2 (geom GEOMETRY NOT NULL, SPATIAL KEY gk(geom)); --error 1105 --error 1416 INSERT INTO t2 SELECT GeomFromText(st) FROM t1; drop table t1, t2;
mysql-test/t/gis.test +14 −2 Original line number Diff line number Diff line Loading @@ -165,9 +165,9 @@ explain extended select issimple(MultiPoint(Point(3, 6), Point(4, 10))), issimpl create table t1 (a geometry not null); insert into t1 values (GeomFromText('Point(1 2)')); -- error 1105 -- error 1416 insert into t1 values ('Garbage'); -- error 1105 -- error 1416 insert IGNORE into t1 values ('Garbage'); alter table t1 add spatial index(a); Loading Loading @@ -359,3 +359,15 @@ select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from t1 where object_id=85984; drop table t1; create table t1 (fl geometry); --error 1416 insert into t1 values (1); --error 1416 insert into t1 values (1.11); --error 1416 insert into t1 values ("qwerty"); --error 1416 insert into t1 values (pointfromtext('point(1,1)')); drop table t1;
sql/field.cc +29 −1 Original line number Diff line number Diff line Loading @@ -7267,12 +7267,38 @@ void Field_geom::sql_type(String &res) const } int Field_geom::store(double nr) { my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); return -1; } int Field_geom::store(longlong nr) { my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); return -1; } int Field_geom::store_decimal(const my_decimal *) { my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); return -1; } int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) { if (!length) bzero(ptr, Field_blob::pack_length()); else { if (from == Geometry::bad_geometry_data.ptr()) goto err; // Check given WKB uint32 wkb_type; if (length < SRID_SIZE + WKB_HEADER_SIZE + SIZEOF_STORED_DOUBLE*2) Loading @@ -7280,7 +7306,7 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) wkb_type= uint4korr(from + WKB_HEADER_SIZE); if (wkb_type < (uint32) Geometry::wkb_point || wkb_type > (uint32) Geometry::wkb_end) return -1; goto err; Field_blob::store_length(length); if (table->copy_blobs || length <= MAX_FIELD_WIDTH) { // Must make a copy Loading @@ -7293,6 +7319,8 @@ int Field_geom::store(const char *from, uint length, CHARSET_INFO *cs) err: bzero(ptr, Field_blob::pack_length()); my_message(ER_CANT_CREATE_GEOMETRY_OBJECT, ER(ER_CANT_CREATE_GEOMETRY_OBJECT), MYF(0)); return -1; } Loading