summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorevgen@moonbone.local <>2007-06-08 00:58:31 +0400
committerevgen@moonbone.local <>2007-06-08 00:58:31 +0400
commit6d3e2399f9571df2cee84c04028b15c2de3bd777 (patch)
tree15a4cb3c8d7bdb9310ccd9a28869e488a5027c56 /sql
parentd55e54c75ab6d93fb841185bcf98e56e4e7299cd (diff)
parenteb9e174bc23fbc0eedb7db666b356233d0af1e69 (diff)
downloadmariadb-git-6d3e2399f9571df2cee84c04028b15c2de3bd777.tar.gz
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into moonbone.local:/mnt/gentoo64/work/28763-bug-5.0-opt-mysql
Diffstat (limited to 'sql')
-rw-r--r--sql/field.h7
-rw-r--r--sql/item.cc8
-rw-r--r--sql/item.h7
3 files changed, 20 insertions, 2 deletions
diff --git a/sql/field.h b/sql/field.h
index 37ce6b88453..39378addd4c 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -360,7 +360,11 @@ public:
{
return field_length / charset()->mbmaxlen;
}
-
+ virtual geometry_type get_geometry_type()
+ {
+ /* shouldn't get here. */
+ DBUG_ASSERT(0);
+ }
friend bool reopen_table(THD *,struct st_table *,bool);
friend int cre_myisam(my_string name, register TABLE *form, uint options,
ulonglong auto_increment_value);
@@ -1325,6 +1329,7 @@ public:
uint get_key_image(char *buff,uint length,imagetype type);
uint size_of() const { return sizeof(*this); }
int reset(void) { return !maybe_null() || Field_blob::reset(); }
+ geometry_type get_geometry_type() { return geom_type; };
};
#endif /*HAVE_SPATIAL*/
diff --git a/sql/item.cc b/sql/item.cc
index 92ea35072f9..59708afdd19 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -4317,7 +4317,9 @@ Field *Item::tmp_table_field_from_field_type(TABLE *table)
case MYSQL_TYPE_GEOMETRY:
return new Field_geom(max_length, maybe_null, name, table,
(Field::geometry_type)
- ((Item_geometry_func *)this)->get_geometry_type());
+ ((type() == Item::TYPE_HOLDER) ?
+ ((Item_type_holder *)this)->get_geometry_type() :
+ ((Item_geometry_func *)this)->get_geometry_type()));
}
}
@@ -6422,6 +6424,10 @@ Item_type_holder::Item_type_holder(THD *thd, Item *item)
if (Field::result_merge_type(fld_type) == INT_RESULT)
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();
}
diff --git a/sql/item.h b/sql/item.h
index 11dce3a7758..96936f0ff88 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1304,6 +1304,11 @@ 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()
+ {
+ DBUG_ASSERT(field_type() == MYSQL_TYPE_GEOMETRY);
+ return field->get_geometry_type();
+ }
friend class Item_default_value;
friend class Item_insert_value;
friend class st_select_lex_unit;
@@ -2563,6 +2568,7 @@ class Item_type_holder: public Item
protected:
TYPELIB *enum_set_typelib;
enum_field_types fld_type;
+ Field::geometry_type geometry_type;
void get_full_info(Item *item);
@@ -2582,6 +2588,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; };
};