diff options
author | unknown <hf@deer.(none)> | 2005-09-21 14:35:01 +0500 |
---|---|---|
committer | unknown <hf@deer.(none)> | 2005-09-21 14:35:01 +0500 |
commit | 8fdef257ae94bfc0f82a1444aac1bd3e1a254c77 (patch) | |
tree | c65a5d5825d1a983b4726c069c6629a7381e3919 /sql/item_geofunc.cc | |
parent | b51879f1695e9a98bfb898b7688bf7c28932ad8c (diff) | |
download | mariadb-git-8fdef257ae94bfc0f82a1444aac1bd3e1a254c77.tar.gz |
Fix for bug #12839 (Endian support is absurd)
mysql-test/r/gis.result:
test result fixed
mysql-test/t/gis.test:
test case added
sql/field.cc:
::construct calls added
sql/item_geofunc.cc:
::construct calls added
sql/spatial.cc:
Geometry_*::init_from_wkb implemented
sql/spatial.h:
init_from_wkb methods declared
Diffstat (limited to 'sql/item_geofunc.cc')
-rw-r--r-- | sql/item_geofunc.cc | 77 |
1 files changed, 28 insertions, 49 deletions
diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 8b856d809d6..6bd2e65632f 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -78,8 +78,7 @@ String *Item_func_geometry_from_wkb::val_str(String *str) str->q_append(srid); if ((null_value= (args[0]->null_value || - !Geometry::create_from_wkb(&buffer, wkb->ptr(), wkb->length()) || - str->append(*wkb)))) + !Geometry::create_from_wkb(&buffer, wkb->ptr(), wkb->length(), str)))) return 0; return str; } @@ -96,8 +95,7 @@ String *Item_func_as_wkt::val_str(String *str) if ((null_value= (args[0]->null_value || - !(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE))))) + !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length()))))) return 0; str->length(0); @@ -123,8 +121,7 @@ String *Item_func_as_wkb::val_str(String *str) if ((null_value= (args[0]->null_value || - !(Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE))))) + !(Geometry::construct(&buffer, swkb->ptr(), swkb->length()))))) return 0; str->copy(swkb->ptr() + SRID_SIZE, swkb->length() - SRID_SIZE, @@ -142,8 +139,7 @@ String *Item_func_geometry_type::val_str(String *str) if ((null_value= (args[0]->null_value || - !(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE))))) + !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length()))))) return 0; /* String will not move */ str->copy(geom->get_class_info()->m_name.str, @@ -164,8 +160,7 @@ String *Item_func_envelope::val_str(String *str) if ((null_value= args[0]->null_value || - !(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)))) + !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))) return 0; srid= uint4korr(swkb->ptr()); @@ -188,8 +183,7 @@ String *Item_func_centroid::val_str(String *str) uint32 srid; if ((null_value= args[0]->null_value || - !(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)))) + !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())))) return 0; str->set_charset(&my_charset_bin); @@ -218,8 +212,7 @@ String *Item_func_spatial_decomp::val_str(String *str) if ((null_value= (args[0]->null_value || - !(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE))))) + !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length()))))) return 0; srid= uint4korr(swkb->ptr()); @@ -267,8 +260,7 @@ String *Item_func_spatial_decomp_n::val_str(String *str) if ((null_value= (args[0]->null_value || args[1]->null_value || - !(geom= Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE))))) + !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length()))))) return 0; str->set_charset(&my_charset_bin); @@ -475,10 +467,8 @@ longlong Item_func_spatial_rel::val_int() if ((null_value= (args[0]->null_value || args[1]->null_value || - !(g1= Geometry::create_from_wkb(&buffer1, res1->ptr() + SRID_SIZE, - res1->length() - SRID_SIZE)) || - !(g2= Geometry::create_from_wkb(&buffer2, res2->ptr() + SRID_SIZE, - res2->length() - SRID_SIZE)) || + !(g1= Geometry::construct(&buffer1, res1->ptr(), res1->length())) || + !(g2= Geometry::construct(&buffer2, res2->ptr(), res2->length())) || g1->get_mbr(&mbr1, &dummy) || g2->get_mbr(&mbr2, &dummy)))) return 0; @@ -543,8 +533,7 @@ longlong Item_func_isclosed::val_int() null_value= (!swkb || args[0]->null_value || !(geom= - Geometry::create_from_wkb(&buffer, swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)) || + Geometry::construct(&buffer, swkb->ptr(), swkb->length())) || geom->is_closed(&isclosed)); return (longlong) isclosed; @@ -566,9 +555,7 @@ longlong Item_func_dimension::val_int() null_value= (!swkb || args[0]->null_value || - !(geom= Geometry::create_from_wkb(&buffer, - swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)) || + !(geom= Geometry::construct(&buffer, swkb->ptr(), swkb->length())) || geom->dimension(&dim, &dummy)); return (longlong) dim; } @@ -583,9 +570,8 @@ longlong Item_func_numinteriorring::val_int() Geometry *geom; null_value= (!swkb || - !(geom= Geometry::create_from_wkb(&buffer, - swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)) || + !(geom= Geometry::construct(&buffer, + swkb->ptr(), swkb->length())) || geom->num_interior_ring(&num)); return (longlong) num; } @@ -600,9 +586,8 @@ longlong Item_func_numgeometries::val_int() Geometry *geom; null_value= (!swkb || - !(geom= Geometry::create_from_wkb(&buffer, - swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)) || + !(geom= Geometry::construct(&buffer, + swkb->ptr(), swkb->length())) || geom->num_geometries(&num)); return (longlong) num; } @@ -618,9 +603,8 @@ longlong Item_func_numpoints::val_int() null_value= (!swkb || args[0]->null_value || - !(geom= Geometry::create_from_wkb(&buffer, - swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)) || + !(geom= Geometry::construct(&buffer, + swkb->ptr(), swkb->length())) || geom->num_points(&num)); return (longlong) num; } @@ -635,9 +619,8 @@ double Item_func_x::val() Geometry *geom; null_value= (!swkb || - !(geom= Geometry::create_from_wkb(&buffer, - swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)) || + !(geom= Geometry::construct(&buffer, + swkb->ptr(), swkb->length())) || geom->get_x(&res)); return res; } @@ -652,9 +635,8 @@ double Item_func_y::val() Geometry *geom; null_value= (!swkb || - !(geom= Geometry::create_from_wkb(&buffer, - swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)) || + !(geom= Geometry::construct(&buffer, + swkb->ptr(), swkb->length())) || geom->get_y(&res)); return res; } @@ -670,9 +652,8 @@ double Item_func_area::val() const char *dummy; null_value= (!swkb || - !(geom= Geometry::create_from_wkb(&buffer, - swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)) || + !(geom= Geometry::construct(&buffer, + swkb->ptr(), swkb->length())) || geom->area(&res, &dummy)); return res; } @@ -686,9 +667,8 @@ double Item_func_glength::val() Geometry *geom; null_value= (!swkb || - !(geom= Geometry::create_from_wkb(&buffer, - swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)) || + !(geom= Geometry::construct(&buffer, + swkb->ptr(), swkb->length())) || geom->length(&res)); return res; } @@ -700,9 +680,8 @@ longlong Item_func_srid::val_int() Geometry_buffer buffer; null_value= (!swkb || - !Geometry::create_from_wkb(&buffer, - swkb->ptr() + SRID_SIZE, - swkb->length() - SRID_SIZE)); + !Geometry::construct(&buffer, + swkb->ptr(), swkb->length())); if (null_value) return 0; |