summaryrefslogtreecommitdiff
path: root/sql/item_geofunc.cc
diff options
context:
space:
mode:
authorunknown <holyfoot@deer.(none)>2006-07-04 12:56:53 +0500
committerunknown <holyfoot@deer.(none)>2006-07-04 12:56:53 +0500
commit8e1162f830c3b7a19e8632ffc7e1a94a84e171c5 (patch)
tree9f696d4b513142b433b7757c911ed0f39bc54678 /sql/item_geofunc.cc
parent8703b22e167c706d5a8c77a1e24948b4db3fafb3 (diff)
downloadmariadb-git-8e1162f830c3b7a19e8632ffc7e1a94a84e171c5.tar.gz
bug #14807 (GeomFromText() should return MYSQL_TYPE_GEOMETRY)
we didn't have code creating GEOMETRY-type fields from Items (expression results) So i added this code mysql-test/r/gis.result: test result fixed mysql-test/t/gis.test: testcase added sql/item_geofunc.cc: Item_geometry_func::tmp_table_field implemented sql/item_geofunc.h: tmp_table_field() and get_geometry_type() declared
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r--sql/item_geofunc.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc
index 2b92e72e728..c5200e26cb7 100644
--- a/sql/item_geofunc.cc
+++ b/sql/item_geofunc.cc
@@ -25,6 +25,12 @@
#ifdef HAVE_SPATIAL
#include <m_ctype.h>
+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());
+}
+
void Item_geometry_func::fix_length_and_dec()
{
collation.set(&my_charset_bin);
@@ -32,6 +38,10 @@ void Item_geometry_func::fix_length_and_dec()
max_length=MAX_BLOB_WIDTH;
}
+int Item_geometry_func::get_geometry_type() const
+{
+ return (int)Field::GEOM_GEOMETRY;
+}
String *Item_func_geometry_from_text::val_str(String *str)
{
@@ -152,6 +162,12 @@ String *Item_func_geometry_type::val_str(String *str)
}
+int Item_func_envelope::get_geometry_type() const
+{
+ return (int) Field::GEOM_POLYGON;
+}
+
+
String *Item_func_envelope::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@@ -176,6 +192,12 @@ String *Item_func_envelope::val_str(String *str)
}
+int Item_func_centroid::get_geometry_type() const
+{
+ return (int) Field::GEOM_POINT;
+}
+
+
String *Item_func_centroid::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
@@ -310,6 +332,12 @@ err:
*/
+int Item_func_point::get_geometry_type() const
+{
+ return (int) Field::GEOM_POINT;
+}
+
+
String *Item_func_point::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);