summaryrefslogtreecommitdiff
path: root/sql/item_geofunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r--sql/item_geofunc.cc19
1 files changed, 11 insertions, 8 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 6bd2e65632f..2b92e72e728 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;
}
@@ -310,8 +313,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 ||
@@ -610,7 +613,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
@@ -626,7 +629,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
@@ -642,7 +645,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
@@ -658,7 +661,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