summaryrefslogtreecommitdiff
path: root/sql/spatial.h
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2005-09-21 14:35:01 +0500
committerunknown <hf@deer.(none)>2005-09-21 14:35:01 +0500
commit8fdef257ae94bfc0f82a1444aac1bd3e1a254c77 (patch)
treec65a5d5825d1a983b4726c069c6629a7381e3919 /sql/spatial.h
parentb51879f1695e9a98bfb898b7688bf7c28932ad8c (diff)
downloadmariadb-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/spatial.h')
-rw-r--r--sql/spatial.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/sql/spatial.h b/sql/spatial.h
index b96434831a1..acd16172fcc 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -202,6 +202,10 @@ public:
virtual const Class_info *get_class_info() const=0;
virtual uint32 get_data_size() const=0;
virtual bool init_from_wkt(Gis_read_stream *trs, String *wkb)=0;
+
+ /* returns the length of the wkb that was read */
+ virtual uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo,
+ String *res)=0;
virtual bool get_data_as_wkt(String *txt, const char **end) const=0;
virtual bool get_mbr(MBR *mbr, const char **end) const=0;
virtual bool dimension(uint32 *dim, const char **end) const=0;
@@ -231,11 +235,13 @@ public:
return my_reinterpret_cast(Geometry *)(buffer);
}
- static Geometry *create_from_wkb(Geometry_buffer *buffer,
- const char *data, uint32 data_len);
+ static Geometry *construct(Geometry_buffer *buffer,
+ const char *data, uint32 data_len);
static Geometry *create_from_wkt(Geometry_buffer *buffer,
Gis_read_stream *trs, String *wkt,
bool init_stream=1);
+ static int Geometry::create_from_wkb(Geometry_buffer *buffer,
+ const char *wkb, uint32 len, String *res);
int as_wkt(String *wkt, const char **end)
{
uint32 len= get_class_info()->m_name.length;
@@ -249,7 +255,7 @@ public:
return 0;
}
- inline void init_from_wkb(const char *data, uint32 data_len)
+ inline void set_data_ptr(const char *data, uint32 data_len)
{
m_data= data;
m_data_end= data + data_len;
@@ -293,6 +299,7 @@ class Gis_point: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
+ uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
@@ -339,6 +346,7 @@ class Gis_line_string: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
+ uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int length(double *len) const;
@@ -364,6 +372,7 @@ class Gis_polygon: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
+ uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int area(double *ar, const char **end) const;
@@ -389,6 +398,7 @@ class Gis_multi_point: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
+ uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
@@ -410,6 +420,7 @@ class Gis_multi_line_string: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
+ uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
@@ -433,6 +444,7 @@ class Gis_multi_polygon: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
+ uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;
@@ -456,6 +468,7 @@ class Gis_geometry_collection: public Geometry
public:
uint32 get_data_size() const;
bool init_from_wkt(Gis_read_stream *trs, String *wkb);
+ uint init_from_wkb(const char *wkb, uint len, wkbByteOrder bo, String *res);
bool get_data_as_wkt(String *txt, const char **end) const;
bool get_mbr(MBR *mbr, const char **end) const;
int num_geometries(uint32 *num) const;