summaryrefslogtreecommitdiff
path: root/sql/gcalc_tools.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2011-09-04 19:11:04 +0500
committerAlexey Botchkov <holyfoot@askmonty.org>2011-09-04 19:11:04 +0500
commiteefff87652cde1cb0c986fd167ed057e87230250 (patch)
tree610484de1f8231ab6291ebb0678a12927c2d424f /sql/gcalc_tools.cc
parentc937b7588f007d24c1cf93ee0b2da9e0e244d711 (diff)
downloadmariadb-git-eefff87652cde1cb0c986fd167ed057e87230250.tar.gz
bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis.
We didn't implement an empty geometry. And returning NULL instead of it is not quite correct. So here is the implementation of the empty value as GEOMETRYCOLLECTION(). per-file comments: mysql-test/r/gis-precise.result bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis. test result updated. mysql-test/r/gis.result bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis. test result updated. mysql-test/t/gis-precise.test bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis. test case added. mysql-test/t/gis.test bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis. test case added. sql/field.cc bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis. store GEOMETRYCOLLECTION() properly. sql/gcalc_tools.cc bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis. create the GEOMETRYCOLLECTION() for the empty result. sql/gstream.h bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis. next_symbol() added. sql/spatial.cc bug 801466 ST_INTERSECTION() returns invalid value on empty intersection in maria-5.3-gis. code modified to handle 0 geometries in the GEOMETRYCOLLECTION properly.
Diffstat (limited to 'sql/gcalc_tools.cc')
-rw-r--r--sql/gcalc_tools.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc
index ab173803323..0d5c1c52d61 100644
--- a/sql/gcalc_tools.cc
+++ b/sql/gcalc_tools.cc
@@ -137,6 +137,8 @@ int Gcalc_function::count_internal()
cur_func+= 4;
if (next_func == op_shape)
return i_states[c_op & ~(op_any | op_not)] ^ mask;
+ if (n_ops == 0)
+ return mask;
result= count_internal();
@@ -442,11 +444,9 @@ void Gcalc_result_receiver::reset()
int Gcalc_result_receiver::get_result_typeid()
{
- if (!n_shapes)
- return 0;
-
- if (collection_result)
+ if (!n_shapes || collection_result)
return Geometry::wkb_geometrycollection;
+
switch (common_shapetype)
{
case Gcalc_function::shape_polygon:
@@ -1186,6 +1186,7 @@ int Gcalc_operation_reducer::get_result(Gcalc_result_receiver *storage)
poly_instance *polygons= NULL;
*m_res_hook= NULL;
+
while (m_result)
{
Gcalc_function::shape_type shape= m_result->type;