diff options
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r-- | sql/item_geofunc.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 8b856d809d6..4a6ceb4bf7d 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -54,8 +54,11 @@ String *Item_func_geometry_from_text::val_str(String *str) return 0; str->length(0); str->q_append(srid); - if ((null_value= !Geometry::create_from_wkt(&buffer, &trs, str, 0))) - return 0; + if (!Geometry::create_from_wkt(&buffer, &trs, str, 0)) + /* We shouldn't return NULL here as NULL is a legal spatial object */ + /* Geometry::bad_spatial_data will produce error message beeing stored*/ + /* in GEOMETRY field */ + return &Geometry::bad_geometry_data; return str; } @@ -318,8 +321,8 @@ err: String *Item_func_point::val_str(String *str) { DBUG_ASSERT(fixed == 1); - double x= args[0]->val(); - double y= args[1]->val(); + double x= args[0]->val_real(); + double y= args[1]->val_real(); if ((null_value= (args[0]->null_value || args[1]->null_value || @@ -626,7 +629,7 @@ longlong Item_func_numpoints::val_int() } -double Item_func_x::val() +double Item_func_x::val_real() { DBUG_ASSERT(fixed == 1); double res= 0.0; // In case of errors @@ -643,7 +646,7 @@ double Item_func_x::val() } -double Item_func_y::val() +double Item_func_y::val_real() { DBUG_ASSERT(fixed == 1); double res= 0; // In case of errors @@ -660,7 +663,7 @@ double Item_func_y::val() } -double Item_func_area::val() +double Item_func_area::val_real() { DBUG_ASSERT(fixed == 1); double res= 0; // In case of errors @@ -677,7 +680,7 @@ double Item_func_area::val() return res; } -double Item_func_glength::val() +double Item_func_glength::val_real() { DBUG_ASSERT(fixed == 1); double res= 0; // In case of errors |