Below is the list of changes that have just been committed into a local
5.0 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-04 12:01:28+05:00, holyfoot@stripped +4 -0
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.cc@stripped, 2007-10-04 12:01:26+05:00, holyfoot@stripped +3 -8
Bug #31155 gis types in union'd select cause crash.
Unified virtual ::get_geometry_type() function used
sql/item.h@stripped, 2007-10-04 11:51:56+05:00, holyfoot@stripped +4 -2
Bug #31155 gis types in union'd select cause crash.
virtual Item::geometry_type() added instead of
various geometry_type() fucntions.
sql/item_geofunc.cc@stripped, 2007-10-04 12:01:26+05:00, holyfoot@stripped +7 -11
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@stripped, 2007-10-04 12:01:26+05:00, holyfoot@stripped +3 -4
Bug #31155 gis types in union'd select cause crash.
get_geometry_type() declarations unified
diff -Nrup a/sql/item.cc b/sql/item.cc
--- a/sql/item.cc 2007-09-13 18:30:28 +05:00
+++ b/sql/item.cc 2007-10-04 12:01:26 +05:00
@@ -4364,11 +4364,8 @@ Field *Item::tmp_table_field_from_field_
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 *
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();
}
diff -Nrup a/sql/item.h b/sql/item.h
--- a/sql/item.h 2007-08-03 21:59:12 +05:00
+++ b/sql/item.h 2007-10-04 11:51:56 +05:00
@@ -870,6 +870,8 @@ public:
*/
virtual bool result_as_longlong() { return FALSE; }
bool is_datetime();
+ virtual Field::geometry_type get_geometry_type() const
+ { return Field::GEOM_GEOMETRY; };
};
@@ -1335,7 +1337,7 @@ public:
int fix_outer_field(THD *thd, Field **field, Item **reference);
virtual Item *update_value_transformer(byte *select_arg);
void print(String *str);
- Field::geometry_type get_geometry_type()
+ Field::geometry_type get_geometry_type() const
{
DBUG_ASSERT(field_type() == MYSQL_TYPE_GEOMETRY);
return field->get_geometry_type();
@@ -2637,7 +2639,7 @@ public:
Field *make_field_by_type(TABLE *table);
static uint32 display_length(Item *item);
static enum_field_types get_real_type(Item *);
- Field::geometry_type get_geometry_type() { return geometry_type; };
+ Field::geometry_type get_geometry_type() const { return geometry_type; };
};
diff -Nrup a/sql/item_geofunc.cc b/sql/item_geofunc.cc
--- a/sql/item_geofunc.cc 2007-03-05 18:22:31 +04:00
+++ b/sql/item_geofunc.cc 2007-10-04 12:01:26 +05:00
@@ -27,7 +27,7 @@
Field *Item_geometry_func::tmp_table_field(TABLE *t_arg)
{
return new Field_geom(max_length, maybe_null, name, t_arg,
- (Field::geometry_type) get_geometry_type());
+ get_geometry_type());
}
void Item_geometry_func::fix_length_and_dec()
@@ -38,10 +38,6 @@ void Item_geometry_func::fix_length_and_
maybe_null= 1;
}
-int Item_geometry_func::get_geometry_type() const
-{
- return (int)Field::GEOM_GEOMETRY;
-}
String *Item_func_geometry_from_text::val_str(String *str)
{
@@ -160,9 +156,9 @@ String *Item_func_geometry_type::val_str
}
-int Item_func_envelope::get_geometry_type() const
+Field::geometry_type Item_func_envelope::get_geometry_type() const
{
- return (int) Field::GEOM_POLYGON;
+ return Field::GEOM_POLYGON;
}
@@ -190,9 +186,9 @@ String *Item_func_envelope::val_str(Stri
}
-int Item_func_centroid::get_geometry_type() const
+Field::geometry_type Item_func_centroid::get_geometry_type() const
{
- return (int) Field::GEOM_POINT;
+ return Field::GEOM_POINT;
}
@@ -330,9 +326,9 @@ err:
*/
-int Item_func_point::get_geometry_type() const
+Field::geometry_type Item_func_point::get_geometry_type() const
{
- return (int) Field::GEOM_POINT;
+ return Field::GEOM_POINT;
}
diff -Nrup a/sql/item_geofunc.h b/sql/item_geofunc.h
--- a/sql/item_geofunc.h 2007-02-28 12:13:44 +04:00
+++ b/sql/item_geofunc.h 2007-10-04 12:01:26 +05:00
@@ -33,7 +33,6 @@ public:
void fix_length_and_dec();
enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; }
Field *tmp_table_field(TABLE *t_arg);
- virtual int get_geometry_type() const;
bool is_null() { (void) val_int(); return null_value; }
};
@@ -92,7 +91,7 @@ public:
Item_func_centroid(Item *a): Item_geometry_func(a) {}
const char *func_name() const { return "centroid"; }
String *val_str(String *);
- int get_geometry_type() const;
+ Field::geometry_type get_geometry_type() const;
};
class Item_func_envelope: public Item_geometry_func
@@ -101,7 +100,7 @@ public:
Item_func_envelope(Item *a): Item_geometry_func(a) {}
const char *func_name() const { return "envelope"; }
String *val_str(String *);
- int get_geometry_type() const;
+ Field::geometry_type get_geometry_type() const;
};
class Item_func_point: public Item_geometry_func
@@ -111,7 +110,7 @@ public:
Item_func_point(Item *a, Item *b, Item *srid): Item_geometry_func(a, b, srid) {}
const char *func_name() const { return "point"; }
String *val_str(String *);
- int get_geometry_type() const;
+ Field::geometry_type get_geometry_type() const;
};
class Item_func_spatial_decomp: public Item_geometry_func
| Thread |
|---|
| • bk commit into 5.0 tree (holyfoot:1.2544) BUG#31155 | holyfoot | 4 Oct |