summaryrefslogtreecommitdiff
path: root/sql/item_geofunc.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-07-05 20:52:59 +0400
committerAlexander Barkov <bar@mariadb.com>2019-07-05 20:52:59 +0400
commita6946c55d39ffd70c47ae21df2484243a80a3f99 (patch)
tree2c9ba7a44b4c6e3efc7706fedbbd3380086c5db9 /sql/item_geofunc.cc
parent2e57c8cc706b3c03d8047225d8128c54df424415 (diff)
downloadmariadb-git-a6946c55d39ffd70c47ae21df2484243a80a3f99.tar.gz
MDEV-19972 Move GIS code from Item_bool_func::get_full_func_mm_tree() to Item_func_spatial_rel::get_mm_leaf()
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r--sql/item_geofunc.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 048841ff30f..54423e8cdd8 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -1062,9 +1062,17 @@ Item_func_spatial_rel::get_mm_leaf(RANGE_OPT_PARAM *param,
if (param->using_real_indexes &&
!field->optimize_range(param->real_keynr[key_part->key],
key_part->part))
- DBUG_RETURN(0);
+ DBUG_RETURN(0);
+
+ Field_geom *field_geom= dynamic_cast<Field_geom*>(field);
+ DBUG_ASSERT(field_geom);
+ const Type_handler_geometry *sav_geom_type= field_geom->type_handler_geom();
+ // We have to be able to store all sorts of spatial features here
+ field_geom->set_type_handler(&type_handler_geometry);
+ bool rc= value->save_in_field_no_warnings(field, 1);
+ field_geom->set_type_handler(sav_geom_type);
- if (value->save_in_field_no_warnings(field, 1))
+ if (rc)
DBUG_RETURN(&sel_arg_impossible); // Bad GEOMETRY value
DBUG_ASSERT(!field->real_maybe_null()); // SPATIAL keys do not support NULL