diff options
author | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-10-04 12:01:28 +0500 |
---|---|---|
committer | unknown <holyfoot/hf@mysql.com/hfmain.(none)> | 2007-10-04 12:01:28 +0500 |
commit | 813e6bcbbda3d7e4b6ad803e2993f9718ebe7daa (patch) | |
tree | c81c531f558a4c78b2b3c57231794a9e40937837 /sql/item.cc | |
parent | 0ad23eb8a5f377e94d4b4ae83f39555dbe75c3b0 (diff) | |
download | mariadb-git-813e6bcbbda3d7e4b6ad803e2993f9718ebe7daa.tar.gz |
Bug #31155 gis types in union'd select cause crash.
We use get_geometry_type() call to decide the exact type
of a geometry field to be created (POINT, POLYGON etc)
Though this function was only implemented for few items.
In the bug's case we need to call this function for the
Item_sum instance, where it was not implemented, what is
the reason of the crash.
Fixed by implementing virtual Item::get_geometry_type(),
so it can be called for any Item.
sql/item.h:
Bug #31155 gis types in union'd select cause crash.
virtual Item::geometry_type() added instead of
various geometry_type() fucntions.
sql/item.cc:
Bug #31155 gis types in union'd select cause crash.
Unified virtual ::get_geometry_type() function used
sql/item_geofunc.cc:
Bug #31155 gis types in union'd select cause crash.
virtual Item::geometry_type() implemented for geo-Items.
Mostly previous ::get_geometry_type() implementation changed
sql/item_geofunc.h:
Bug #31155 gis types in union'd select cause crash.
get_geometry_type() declarations unified
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/sql/item.cc b/sql/item.cc index e9b2904e3da..997ad0972db 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4364,11 +4364,8 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table) collation.collation); break; // Blob handled outside of case case MYSQL_TYPE_GEOMETRY: - return new Field_geom(max_length, maybe_null, name, table, - (Field::geometry_type) - ((type() == Item::TYPE_HOLDER) ? - ((Item_type_holder *)this)->get_geometry_type() : - ((Item_geometry_func *)this)->get_geometry_type())); + return new Field_geom(max_length, maybe_null, + name, table, get_geometry_type()); } } @@ -6489,9 +6486,7 @@ Item_type_holder::Item_type_holder(THD *thd, Item *item) decimals= 0; prev_decimal_int_part= item->decimal_int_part(); if (item->field_type() == MYSQL_TYPE_GEOMETRY) - geometry_type= (item->type() == Item::FIELD_ITEM) ? - ((Item_field *)item)->get_geometry_type() : - (Field::geometry_type)((Item_geometry_func *)item)->get_geometry_type(); + geometry_type= item->get_geometry_type(); } |