summaryrefslogtreecommitdiff
path: root/sql/spatial.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-07-10 07:17:25 +0400
committerAlexander Barkov <bar@mariadb.com>2019-07-10 07:17:25 +0400
commite37d7a37151f1aa53e102d24af5d234c2ccfa392 (patch)
treef7a701296bb2a421091100bc297fd1a5bf653e88 /sql/spatial.cc
parentaca5532113714836e7d015c135a7f1a7ee8ca9d4 (diff)
downloadmariadb-git-e37d7a37151f1aa53e102d24af5d234c2ccfa392.tar.gz
MDEV-20006 Move geometry specific code in Field_blob::get_key_image() to Field_geom
Diffstat (limited to 'sql/spatial.cc')
-rw-r--r--sql/spatial.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/sql/spatial.cc b/sql/spatial.cc
index bba9ae45f58..ebec280a5eb 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -185,6 +185,33 @@ Geometry *Geometry::construct(Geometry_buffer *buffer,
}
+uint Geometry::get_key_image_itMBR(LEX_CSTRING &src, uchar *buff, uint length)
+{
+ const char *dummy;
+ MBR mbr;
+ Geometry_buffer buffer;
+ Geometry *gobj;
+ const uint image_length= SIZEOF_STORED_DOUBLE*4;
+
+ if (src.length < SRID_SIZE)
+ {
+ bzero(buff, image_length);
+ return image_length;
+ }
+ gobj= Geometry::construct(&buffer, (char*) src.str, (uint32) src.length);
+ if (!gobj || gobj->get_mbr(&mbr, &dummy))
+ bzero(buff, image_length);
+ else
+ {
+ float8store(buff, mbr.xmin);
+ float8store(buff+8, mbr.xmax);
+ float8store(buff+16, mbr.ymin);
+ float8store(buff+24, mbr.ymax);
+ }
+ return image_length;
+}
+
+
Geometry *Geometry::create_from_wkt(Geometry_buffer *buffer,
Gis_read_stream *trs, String *wkt,
bool init_stream)