diff options
author | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-02-21 14:45:19 +0400 |
---|---|---|
committer | unknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru> | 2007-02-21 14:45:19 +0400 |
commit | 6c5a3c240a8f137f39fe8915fc5d4dd57d7688d9 (patch) | |
tree | 6fd662c0ed9147bc564356b4f75a35d77d91c4b1 /sql/item_geofunc.h | |
parent | e988fbdd9b0fa88796adeaed81f30cf1ff15710c (diff) | |
download | mariadb-git-6c5a3c240a8f137f39fe8915fc5d4dd57d7688d9.tar.gz |
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
Having maybe_null flag unset for geometry/spatial functions leads to
wrong Item_func_isnull::val_int()'s results.
Fix: set maybe_null flag and add is_null() methods.
mysql-test/r/gis.result:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- test result.
mysql-test/t/gis.test:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- test case.
sql/item_geofunc.cc:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- set maybe_null flag for Item_geometry_func and Item_func_as_wkt.
- moved length check to the beginnig of the
Item_func_spatial_collection::val_str() to affect geometry
collection objects at once.
- changed Item_func_isempty::val_int() and Item_func_issimple::val_int()
to properly handle null_value.
sql/item_geofunc.h:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- set maybe_null flag for geometry/spatial functions.
- added is_null() to Item_geometry_func and Item_func_spatial_rel
classes.
sql/spatial.cc:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- changed return type of Geometry::create_from_wkb() to be
consistent with Geometry::create_from_wkt(), now it returns
Geometry object or NULL in case of error.
sql/spatial.h:
Fix for bug #26038: X() value of empty NOT NULL POINT is neither NULL nor NOT NULL
- changed return type of Geometry::create_from_wkb() to be
consistent with Geometry::create_from_wkt(), now it returns
Geometry object or NULL in case of error.
Diffstat (limited to 'sql/item_geofunc.h')
-rw-r--r-- | sql/item_geofunc.h | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/sql/item_geofunc.h b/sql/item_geofunc.h index a466b606dc1..2719cbb0bab 100644 --- a/sql/item_geofunc.h +++ b/sql/item_geofunc.h @@ -33,6 +33,7 @@ public: Item_geometry_func(List<Item> &list) :Item_str_func(list) {} void fix_length_and_dec(); enum_field_types field_type() const { return MYSQL_TYPE_GEOMETRY; } + bool is_null() { (void) val_int(); return null_value; } }; class Item_func_geometry_from_text: public Item_geometry_func @@ -80,6 +81,7 @@ public: void fix_length_and_dec() { max_length=20; // "GeometryCollection" is the most long + maybe_null= 1; }; }; @@ -221,6 +223,8 @@ public: } } void print(String *str) { Item_func::print(str); } + void fix_length_and_dec() { maybe_null= 1; } + bool is_null() { (void) val_int(); return null_value; } }; class Item_func_isempty: public Item_bool_func @@ -230,6 +234,7 @@ public: longlong val_int(); optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "isempty"; } + void fix_length_and_dec() { maybe_null= 1; } }; class Item_func_issimple: public Item_bool_func @@ -239,6 +244,7 @@ public: longlong val_int(); optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "issimple"; } + void fix_length_and_dec() { maybe_null= 1; } }; class Item_func_isclosed: public Item_bool_func @@ -248,6 +254,7 @@ public: longlong val_int(); optimize_type select_optimize() const { return OPTIMIZE_NONE; } const char *func_name() const { return "isclosed"; } + void fix_length_and_dec() { maybe_null= 1; } }; class Item_func_dimension: public Item_int_func @@ -257,7 +264,7 @@ public: Item_func_dimension(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "dimension"; } - void fix_length_and_dec() { max_length=10; } + void fix_length_and_dec() { max_length= 10; maybe_null= 1; } }; class Item_func_x: public Item_real_func @@ -267,6 +274,11 @@ public: Item_func_x(Item *a): Item_real_func(a) {} double val(); const char *func_name() const { return "x"; } + void fix_length_and_dec() + { + Item_real_func::fix_length_and_dec(); + maybe_null= 1; + } }; @@ -277,6 +289,11 @@ public: Item_func_y(Item *a): Item_real_func(a) {} double val(); const char *func_name() const { return "y"; } + void fix_length_and_dec() + { + Item_real_func::fix_length_and_dec(); + maybe_null= 1; + } }; @@ -287,7 +304,7 @@ public: Item_func_numgeometries(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "numgeometries"; } - void fix_length_and_dec() { max_length=10; } + void fix_length_and_dec() { max_length= 10; maybe_null= 1; } }; @@ -298,7 +315,7 @@ public: Item_func_numinteriorring(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "numinteriorrings"; } - void fix_length_and_dec() { max_length=10; } + void fix_length_and_dec() { max_length= 10; maybe_null= 1; } }; @@ -309,7 +326,7 @@ public: Item_func_numpoints(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "numpoints"; } - void fix_length_and_dec() { max_length=10; } + void fix_length_and_dec() { max_length= 10; maybe_null= 1; } }; @@ -320,6 +337,11 @@ public: Item_func_area(Item *a): Item_real_func(a) {} double val(); const char *func_name() const { return "area"; } + void fix_length_and_dec() + { + Item_real_func::fix_length_and_dec(); + maybe_null= 1; + } }; @@ -330,6 +352,11 @@ public: Item_func_glength(Item *a): Item_real_func(a) {} double val(); const char *func_name() const { return "glength"; } + void fix_length_and_dec() + { + Item_real_func::fix_length_and_dec(); + maybe_null= 1; + } }; @@ -340,7 +367,7 @@ public: Item_func_srid(Item *a): Item_int_func(a) {} longlong val_int(); const char *func_name() const { return "srid"; } - void fix_length_and_dec() { max_length= 10; } + void fix_length_and_dec() { max_length= 10; maybe_null= 1; } }; #define GEOM_NEW(obj_constructor) new obj_constructor |