Commit a6946c55 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-19972 Move GIS code from Item_bool_func::get_full_func_mm_tree() to...

MDEV-19972 Move GIS code from Item_bool_func::get_full_func_mm_tree() to Item_func_spatial_rel::get_mm_leaf()
parent 2e57c8cc
......@@ -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
......
......@@ -8121,16 +8121,6 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
table_map ref_tables= 0;
table_map param_comp= ~(param->prev_tables | param->read_tables |
param->current_table);
#ifdef HAVE_SPATIAL
const Type_handler_geometry *sav_geom_type= NULL;
Field_geom *field_geom= dynamic_cast<Field_geom*>(field_item->field);
if (field_geom)
{
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);
}
#endif /*HAVE_SPATIAL*/
for (uint i= 0; i < arg_count; i++)
{
......@@ -8158,13 +8148,6 @@ SEL_TREE *Item_bool_func::get_full_func_mm_tree(RANGE_OPT_PARAM *param,
}
}
#ifdef HAVE_SPATIAL
if (field_geom)
{
DBUG_ASSERT(sav_geom_type);
field_geom->set_type_handler(sav_geom_type);
}
#endif /*HAVE_SPATIAL*/
DBUG_RETURN(ftree);
}
......
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