Commit 762c7ca4 authored by Ramil Kalimullin's avatar Ramil Kalimullin

Fix for bug#56679: gis.test: valgrind error

Item_func_spatial_collection::fix_length_and_dec()
changed to use argument's print() method to print
the ER_ILLEGAL_VALUE_FOR_TYPE error.


mysql-test/r/gis.result:
  Fix for bug#56679: gis.test: valgrind error
    - test result adjusted.
sql/item_geofunc.h:
  Fix for bug#56679: gis.test: valgrind error
    - use argument's print() method instead of improper val_str()
  call in the Item_func_spatial_collection::fix_length_and_dec(), as
  it's applicable only for constant items.
parent 0782e25a
...@@ -707,7 +707,7 @@ numgeometries(b) IS NULL, numinteriorrings(b) IS NULL, numpoints(b) IS NULL, ...@@ -707,7 +707,7 @@ 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, area(b) IS NULL, glength(b) IS NULL, srid(b) IS NULL, x(b) IS NULL,
y(b) IS NULL y(b) IS NULL
from t1; from t1;
ERROR 22007: Illegal non geometric '' value found during parsing ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing
select select
within(b, b) IS NULL, contains(b, b) IS NULL, overlaps(b, b) IS NULL, 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, equals(b, b) IS NULL, disjoint(b, b) IS NULL, touches(b, b) IS NULL,
...@@ -722,7 +722,7 @@ point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS ...@@ -722,7 +722,7 @@ point(b, b) IS NULL, linestring(b) IS NULL, polygon(b) IS NULL, multipoint(b) IS
multilinestring(b) IS NULL, multipolygon(b) IS NULL, multilinestring(b) IS NULL, multipolygon(b) IS NULL,
geometrycollection(b) IS NULL geometrycollection(b) IS NULL
from t1; from t1;
ERROR 22007: Illegal non geometric '' value found during parsing ERROR 22007: Illegal non geometric '`test`.`t1`.`b`' value found during parsing
drop table t1; drop table t1;
CREATE TABLE t1(a POINT) ENGINE=MyISAM; CREATE TABLE t1(a POINT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (NULL); INSERT INTO t1 VALUES (NULL);
...@@ -1006,7 +1006,7 @@ drop table t1; ...@@ -1006,7 +1006,7 @@ drop table t1;
SELECT MultiPoint(12345,''); SELECT MultiPoint(12345,'');
ERROR 22007: Illegal non geometric '12345' value found during parsing ERROR 22007: Illegal non geometric '12345' value found during parsing
SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b)); SELECT 1 FROM (SELECT GREATEST(1,GEOMETRYCOLLECTION('00000','00000')) b FROM DUAL) AS d WHERE (LINESTRING(d.b));
ERROR 22007: Illegal non geometric '' value found during parsing ERROR 22007: Illegal non geometric ''00000'' value found during parsing
# #
# BUG#51875: crash when loading data into geometry function polyfromwkb # BUG#51875: crash when loading data into geometry function polyfromwkb
# #
......
...@@ -177,13 +177,15 @@ class Item_func_spatial_collection: public Item_geometry_func ...@@ -177,13 +177,15 @@ class Item_func_spatial_collection: public Item_geometry_func
String *val_str(String *); String *val_str(String *);
void fix_length_and_dec() void fix_length_and_dec()
{ {
for( unsigned int i=0; i<arg_count; ++i) for (unsigned int i= 0; i < arg_count; ++i)
{ {
if( args[i]->fixed && args[i]->field_type() != MYSQL_TYPE_GEOMETRY) if (args[i]->fixed && args[i]->field_type() != MYSQL_TYPE_GEOMETRY)
{ {
String str; String str;
args[i]->val_str(&str); args[i]->print(&str, QT_ORDINARY);
my_error(ER_ILLEGAL_VALUE_FOR_TYPE,MYF(0),"non geometric",str.c_ptr()); str.append('\0');
my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "non geometric",
str.ptr());
} }
} }
} }
......
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