MySQL 8.0.29
Source Code Documentation
item_geofunc.h
Go to the documentation of this file.
1#ifndef ITEM_GEOFUNC_INCLUDED
2#define ITEM_GEOFUNC_INCLUDED
3
4/* Copyright (c) 2000, 2021, Oracle and/or its affiliates.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is also distributed with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have included with MySQL.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License, version 2.0, for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
25
26#include <assert.h>
27#include <sys/types.h>
28
29#include <cstddef>
30#include <vector>
31
32#include "field_types.h" // MYSQL_TYPE_BLOB
33
34#include "my_inttypes.h"
35#include "my_sys.h"
37#include "mysql_com.h"
38#include "mysqld_error.h"
39#include "prealloced_array.h"
40#include "sql/enum_query_type.h"
41#include "sql/field.h"
42#include "sql/gis/buffer_strategies.h" // gis::buffer_strategies
43#include "sql/gis/srid.h"
44#include "sql/parse_location.h" // POS
45/* This file defines all spatial functions */
46#include "sql/inplace_vector.h"
47#include "sql/item.h"
48#include "sql/item_cmpfunc.h" // Item_bool_func2
49#include "sql/item_func.h"
50#include "sql/item_json_func.h" // Item_json_func
51#include "sql/item_strfunc.h" // Item_str_func
52#include "sql/spatial.h" // gis_wkb_raw_free
53#include "sql_string.h"
54
55class Json_array;
56class Json_dom;
57class Json_object;
58class Json_wrapper;
59class PT_item_list;
60class THD;
61struct Parse_context;
62struct TABLE;
63
64enum class enum_json_type;
65
66namespace dd {
67class Spatial_reference_system;
68} // namespace dd
69
70namespace gis {
71class Geometry;
72class Point;
73} // namespace gis
74
75/**
76 We have to hold result buffers in functions that return a GEOMETRY string,
77 because such a function's result geometry's buffer is directly used and
78 set to String result object. We have to release them properly manually
79 since they won't be released when the String result is destroyed.
80*/
83
84 public:
86
90 }
91
93
94 void forget_buffer(void *buf) {
95 if (bg_result_buf == buf) bg_result_buf = nullptr;
97 }
98
99 /* Free intermediate result buffers accumulated during GIS calculation. */
103 itr != bg_results.end(); ++itr)
104 gis_wkb_raw_free(*itr);
106 }
107
108 // Free the final result buffer, should be called after the result used.
111 bg_result_buf = nullptr;
112 }
113
114 void set_result_buffer(void *buf) {
117 }
118
119 private:
120 /*
121 Hold data buffer of this set operation's final result geometry which is
122 freed next time val_str is called since it can be used by upper Item nodes.
123 */
125
126 /*
127 Result buffers for intermediate set operation results, which are freed
128 before val_str returns.
129 */
131};
132
134
135/**
136 A utility class to flatten any hierarchy of geometry collection into one
137 with no nested geometry collections. All components are stored separately
138 and all their data stored in this class, in order to easily manipulate them.
139 */
144 std::vector<Geometry *> m_geos;
147
148 public:
149 typedef std::vector<Geometry *> Geometry_list;
150
152
154
156
157 gis::srid_t get_srid() const { return m_srid; }
158
159 void set_srid(gis::srid_t srid) { m_srid = srid; }
160
161 bool fill(const Geometry *geo, bool break_multi_geom = false) {
162 return store_geometry(geo, break_multi_geom);
163 }
164
165 const Geometry_list &get_geometries() const { return m_geos; }
166
168
169 bool all_isolated() const { return m_num_isolated == m_geos.size(); }
170
171 size_t num_isolated() const { return m_num_isolated; }
172
174
175 private:
176 bool store_geometry(const Geometry *geo, bool break_multi_geom);
177 Geometry *store(const Geometry *geo);
178};
179
181 public:
183
186
189 : Item_str_func(pos, a, b) {}
190
193 : Item_str_func(pos, a, b, c) {}
194 Item_geometry_func(const POS &pos, PT_item_list *list);
195
196 bool resolve_type(THD *) override;
197 Field *tmp_table_field(TABLE *t_arg) override;
198};
199
201 public:
202 enum class Functype {
219 };
220
221 private:
224 /**
225 Get the type of geometry that this Item can return.
226
227 @return The geometry type
228 */
230 /**
231 Check if a geometry type is a valid return type for this Item.
232
233 @param type The type to check
234
235 @retval true The geometry type is allowed
236 @retval false The geometry type is not allowed
237 */
239
240 public:
247 Item *option, Functype functype)
248 : Item_geometry_func(pos, a, srid, option), m_functype(functype) {}
249
250 bool itemize(Parse_context *pc, Item **res) override;
251 const char *func_name() const override;
252 String *val_str(String *) override;
253 bool resolve_type(THD *thd) override {
254 if (param_type_is_default(thd, 0, 1)) return true;
255 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
256 if (param_type_is_default(thd, 2, 3)) return true;
258 }
259};
260
262 public:
263 enum class Functype {
279 };
280
281 private:
285 /**
286 Get the type of geometry that this Item can return.
287
288 @return The geometry type
289 */
291 /**
292 Check if a geometry type is a valid return type for this Item.
293
294 @param type The type to check
295
296 @retval true The geometry type is allowed
297 @retval false The geometry type is not allowed
298 */
300 bool resolve_type(THD *thd) override {
301 if (param_type_is_default(thd, 0, 1)) return true;
302 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
303 if (param_type_is_default(thd, 2, 3)) return true;
305 }
306
307 public:
313 Item_func_geometry_from_wkb(const POS &pos, Item *a, Item *srid, Item *option,
315 : Item_geometry_func(pos, a, srid, option), m_functype(functype) {}
316
317 bool itemize(Parse_context *pc, Item **res) override;
318 const char *func_name() const override;
319 String *val_str(String *) override;
320};
321
323 public:
326 : Item_str_ascii_func(pos, a, b) {}
327 const char *func_name() const override { return "st_astext"; }
328 String *val_str_ascii(String *) override;
329 bool resolve_type(THD *) override;
330};
331
333 public:
336 : Item_geometry_func(pos, a, b) {}
337 const char *func_name() const override { return "st_aswkb"; }
338 String *val_str(String *) override;
339 bool resolve_type(THD *thd) override {
340 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
341 if (param_type_is_default(thd, 1, 2)) return true;
342 if (Item_geometry_func::resolve_type(thd)) return true;
344 return false;
345 }
346};
347
349 public:
351 : Item_str_ascii_func(pos, a) {}
352 String *val_str_ascii(String *) override;
353 const char *func_name() const override { return "st_geometrytype"; }
354 bool resolve_type(THD *thd) override {
355 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
356 // "MultiLinestring" is the longest
358 set_nullable(true);
359 return false;
360 }
361};
362
363/**
364 This handles one function:
365
366 @<geometry@> = ST_GEOMFROMGEOJSON(@<string@>[, @<options@>[, @<srid@>]])
367
368 Options is an integer argument which determines how positions with higher
369 coordinate dimension than MySQL support should be handled. The function will
370 accept both single objects, geometry collections and feature objects and
371 collections. All "properties" members of GeoJSON feature objects is ignored.
372
373 The implementation conforms with GeoJSON revision 1.0 described at
374 http://geojson.org/geojson-spec.html.
375*/
377 public:
378 /**
379 Describing how coordinate dimensions higher than supported in MySQL
380 should be handled.
381 */
387 };
388 Item_func_geomfromgeojson(const POS &pos, Item *json_string)
389 : Item_geometry_func(pos, json_string),
394 : Item_geometry_func(pos, json_string, options),
398 Item *srid)
399 : Item_geometry_func(pos, json_string, options, srid),
401 String *val_str(String *) override;
402 bool fix_fields(THD *, Item **ref) override;
403 const char *func_name() const override { return "st_geomfromgeojson"; }
404 Geometry::wkbType get_wkbtype(const char *typestring);
405 bool get_positions(const Json_array *coordinates, Gis_point *point);
406 bool get_linestring(const Json_array *data_array,
407 Gis_line_string *linestring);
408 bool get_polygon(const Json_array *data_array, Gis_polygon *polygon);
409 bool parse_object(const Json_object *object, bool *rollback, String *buffer,
410 bool is_parent_featurecollection, Geometry **geometry);
412 bool *rollback, String *buffer,
413 bool is_parent_featurecollection,
414 Geometry **geometry);
415 static bool check_argument_valid_integer(Item *argument);
416 bool parse_crs_object(const Json_object *crs_object);
417 bool is_member_valid(const Json_dom *member, const char *member_name,
418 enum_json_type expected_type, bool allow_null,
419 bool *was_null);
420 const Json_dom *my_find_member_ncase(const Json_object *object,
421 const char *member_name);
422
423 static const char *TYPE_MEMBER;
424 static const char *CRS_MEMBER;
425 static const char *GEOMETRY_MEMBER;
426 static const char *PROPERTIES_MEMBER;
427 static const char *FEATURES_MEMBER;
428 static const char *GEOMETRIES_MEMBER;
429 static const char *COORDINATES_MEMBER;
430 static const char *CRS_NAME_MEMBER;
431 static const char *NAMED_CRS;
432 static const char *SHORT_EPSG_PREFIX;
433 static const char *LONG_EPSG_PREFIX;
434 static const char *CRS84_URN;
435 static const char *POINT_TYPE;
436 static const char *MULTIPOINT_TYPE;
437 static const char *LINESTRING_TYPE;
438 static const char *MULTILINESTRING_TYPE;
439 static const char *POLYGON_TYPE;
440 static const char *MULTIPOLYGON_TYPE;
441 static const char *GEOMETRYCOLLECTION_TYPE;
442 static const char *FEATURE_TYPE;
443 static const char *FEATURECOLLECTION_TYPE;
444
445 private:
446 /**
447 How higher coordinate dimensions than currently supported should be handled.
448 */
450 /// Is set to true if user provided a SRID as an argument.
452 /// The SRID user provided as an argument.
454 /**
455 The SRID value of the document CRS, if one is found. Otherwise, this value
456 defaults to -1.
457 */
459 /// The minimum allowed longitude value (non-inclusive).
460 double m_min_longitude = -180.0;
461 /// The maximum allowed longitude (inclusive).
462 double m_max_longitude = 180.0;
463 /// The minimum allowed latitude value (inclusive).
464 double m_min_latitude = -90.0;
465 /// The maximum allowed latitude (inclusive).
466 double m_max_latitude = 90.0;
467 /// True if we're currently parsing the top-level object.
468 bool m_toplevel = true;
469};
470
471/// Max width of long CRS URN supported + max width of SRID + '\0'.
472static const int MAX_CRS_WIDTH = (22 + MAX_INT_WIDTH + 1);
473
474/**
475 This class handles the following function:
476
477 @<json@> = ST_ASGEOJSON(@<geometry@>[, @<maxdecimaldigits@>[, @<options@>]])
478
479 It converts a GEOMETRY into a valid GeoJSON string. If maxdecimaldigits is
480 specified, the coordinates written are rounded to the number of decimals
481 specified (e.g with decimaldigits = 3: 10.12399 => 10.124).
482
483 Options is a bitmask with the following flags:
484 0 No options (default values).
485 1 Add a bounding box to the output.
486 2 Add a short CRS URN to the output. The default format is a
487 short format ("EPSG:<srid>").
488 4 Add a long format CRS URN ("urn:ogc:def:crs:EPSG::<srid>"). This
489 implies 2. This means that, e.g., bitmask 5 and 7 mean the
490 same: add a bounding box and a long format CRS URN.
491*/
493 private:
494 /// Maximum number of decimal digits in printed coordinates.
496 /// If true, the output GeoJSON has a bounding box for each GEOMETRY.
498 /**
499 If true, the output GeoJSON has a CRS object in the short
500 form (e.g "EPSG:4326").
501 */
503 /**
504 If true, the output GeoJSON has a CRS object in the long
505 form (e.g "urn:ogc:def:crs:EPSG::4326").
506 */
508 /// The SRID found in the input GEOMETRY.
510
511 public:
512 Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry)
513 : Item_json_func(thd, pos, geometry),
514 m_add_bounding_box(false),
515 m_add_short_crs_urn(false),
516 m_add_long_crs_urn(false) {}
517 Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry,
518 Item *maxdecimaldigits)
519 : Item_json_func(thd, pos, geometry, maxdecimaldigits),
520 m_add_bounding_box(false),
521 m_add_short_crs_urn(false),
522 m_add_long_crs_urn(false) {}
523 Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry,
524 Item *maxdecimaldigits, Item *options)
525 : Item_json_func(thd, pos, geometry, maxdecimaldigits, options),
526 m_add_bounding_box(false),
527 m_add_short_crs_urn(false),
528 m_add_long_crs_urn(false) {}
529 bool fix_fields(THD *thd, Item **ref) override;
530 bool val_json(Json_wrapper *wr) override;
531 const char *func_name() const override { return "st_asgeojson"; }
534};
535
536/**
537 This class handles two forms of the same function:
538
539 @<string@> = ST_GEOHASH(@<point@>, @<maxlength@>);
540 @<string@> = ST_GEOHASH(@<longitude@>, @<latitude@>, @<maxlength@>)
541
542 It returns an encoded geohash string, no longer than @<maxlength@> characters
543 long. Note that it might be shorter than @<maxlength@>.
544*/
546 private:
547 /// The latitude argument supplied by the user (directly or by a POINT).
548 double latitude;
549 /// The longitude argument supplied by the user (directly or by a POINT).
550 double longitude;
551 /// The maximum output length of the geohash, supplied by the user.
553
554 /**
555 The maximum input latitude. For now, this is set to 90.0. It can be
556 changed to support a different range than the normal [90, -90].
557 */
558 const double max_latitude;
559
560 /**
561 The minimum input latitude. For now, this is set to -90.0. It can be
562 changed to support a different range than the normal [90, -90].
563 */
564 const double min_latitude;
565
566 /**
567 The maximum input longitude. For now, this is set to 180.0. It can be
568 changed to support a different range than the normal [180, -180].
569 */
570 const double max_longitude;
571
572 /**
573 The minimum input longitude. For now, this is set to -180.0. It can be
574 changed to support a different range than the normal [180, -180].
575 */
576 const double min_longitude;
577
578 /**
579 The absolute upper limit of geohash output length. User will get an error
580 if they supply a max geohash length argument greater than this.
581 */
583
584 public:
586 : Item_str_ascii_func(pos, point, length),
587 max_latitude(90.0),
588 min_latitude(-90.0),
589 max_longitude(180.0),
590 min_longitude(-180.0),
593 Item *length)
595 max_latitude(90.0),
596 min_latitude(-90.0),
597 max_longitude(180.0),
598 min_longitude(-180.0),
600 String *val_str_ascii(String *) override;
601 bool resolve_type(THD *) override;
602 bool fix_fields(THD *thd, Item **ref) override;
603 const char *func_name() const override { return "st_geohash"; }
604 char char_to_base32(char char_input);
605 void encode_bit(double *upper_value, double *lower_value, double target_value,
606 char *char_value, int bit_number);
609};
610
611/**
612 This is a superclass for Item_func_longfromgeohash and
613 Item_func_latfromgeohash, since they share almost all code.
614*/
616 private:
617 /**
618 The lower limit for latitude output value. Normally, this will be
619 set to -90.0.
620 */
621 const double lower_latitude;
622
623 /**
624 The upper limit for latitude output value. Normally, this will be
625 set to 90.0.
626 */
627 const double upper_latitude;
628
629 /**
630 The lower limit for longitude output value. Normally, this will
631 be set to -180.0.
632 */
633 const double lower_longitude;
634
635 /**
636 The upper limit for longitude output value. Normally, this will
637 be set to 180.0.
638 */
639 const double upper_longitude;
640
641 /**
642 If this is set to true the algorithm will start decoding on the first bit,
643 which decodes a longitude value. If it is false, it will start on the
644 second bit which decodes a latitude value.
645 */
647
648 public:
650 double upper_latitude, double lower_longitude,
651 double upper_longitude,
652 bool start_on_even_bit_arg)
653 : Item_real_func(pos, a),
658 start_on_even_bit(start_on_even_bit_arg) {}
659 double val_real() override;
660 bool resolve_type(THD *thd) override;
661 bool fix_fields(THD *thd, Item **ref) override;
662 static bool decode_geohash(String *geohash, double upper_latitude,
663 double lower_latitude, double upper_longitude,
664 double lower_longitude, double *result_latitude,
665 double *result_longitude);
666 static double round_latlongitude(double latlongitude, double error_range,
667 double lower_limit, double upper_limit);
668 static bool check_geohash_argument_valid_type(Item *item);
669};
670
671/**
672 This handles the @<double@> = ST_LATFROMGEOHASH(@<string@>) function.
673 It returns the latitude-part of a geohash, in the range of [-90, 90].
674*/
676 public:
678 : Item_func_latlongfromgeohash(pos, a, -90.0, 90.0, -180.0, 180.0,
679 false) {}
680
681 const char *func_name() const override { return "ST_LATFROMGEOHASH"; }
682};
683
684/**
685 This handles the @<double@> = ST_LONGFROMGEOHASH(@<string@>) function.
686 It returns the longitude-part of a geohash, in the range of [-180, 180].
687*/
689 public:
691 : Item_func_latlongfromgeohash(pos, a, -90.0, 90.0, -180.0, 180.0, true) {
692 }
693
694 const char *func_name() const override { return "ST_LONGFROMGEOHASH"; }
695};
696
699
700 template <typename Coordsys>
701 bool bg_centroid(const Geometry *geom, String *ptwkb);
702
703 public:
705 const char *func_name() const override { return "st_centroid"; }
706 String *val_str(String *) override;
708 bool resolve_type(THD *thd) override {
709 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
711 }
712};
713
716
717 template <typename Coordsys>
718 bool bg_convex_hull(const Geometry *geom, String *wkb);
719
720 public:
722 const char *func_name() const override { return "st_convexhull"; }
723 String *val_str(String *) override;
725 bool resolve_type(THD *thd) override {
726 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
728 }
729};
730
732 public:
734 const char *func_name() const override { return "st_envelope"; }
735 String *val_str(String *) override;
737 bool resolve_type(THD *thd) override {
738 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
740 }
741};
742
744 public:
746 : Item_geometry_func(pos, a, b) {}
747 const char *func_name() const override { return "st_makeenvelope"; }
748 String *val_str(String *) override;
750 bool resolve_type(THD *thd) override {
751 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
753 }
754};
755
758
759 public:
761 const char *func_name() const override { return "st_validate"; }
762 bool resolve_type(THD *thd) override {
763 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
765 }
766 String *val_str(String *) override;
767};
768
769/// Item that implements function ST_Simplify, which simplifies a geometry using
770/// the Douglas-Peucker algorithm.
772 public:
774 : Item_geometry_func(pos, a, b) {}
775 bool resolve_type(THD *thd) override {
776 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
777 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
779 }
780 String *val_str(String *) override;
781
782 const char *func_name() const override { return "st_simplify"; }
783};
784
786 public:
788 : Item_geometry_func(pos, a, b) {}
789 const char *func_name() const override { return "point"; }
790 String *val_str(String *) override;
792 bool resolve_type(THD *thd) override {
793 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_DOUBLE)) return true;
795 }
796};
797
798/**
799 This handles the @<point@> = ST_POINTFROMGEOHASH(@<string@>, @<srid@>)
800 function.
801
802 It returns a point containing the decoded geohash value, where X is the
803 longitude in the range of [-180, 180] and Y is the latitude in the range
804 of [-90, 90].
805*/
807 private:
808 /// The maximum output latitude value when decoding the geohash value.
809 const double upper_latitude;
810
811 /// The minimum output latitude value when decoding the geohash value.
812 const double lower_latitude;
813
814 /// The maximum output longitude value when decoding the geohash value.
815 const double upper_longitude;
816
817 /// The minimum output longitude value when decoding the geohash value.
818 const double lower_longitude;
819
820 public:
822 : Item_geometry_func(pos, a, b),
823 upper_latitude(90.0),
824 lower_latitude(-90.0),
825 upper_longitude(180.0),
826 lower_longitude(-180.0) {}
827 const char *func_name() const override { return "st_pointfromgeohash"; }
828 String *val_str(String *) override;
829 bool fix_fields(THD *thd, Item **ref) override;
830 bool resolve_type(THD *thd) override;
832 return Field::GEOM_POINT;
833 }
834};
835
838 bool resolve_type(THD *thd) override {
839 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
841 }
842
843 public:
845 : Item_geometry_func(pos, a) {
846 decomp_func = ft;
847 }
848 const char *func_name() const override {
849 switch (decomp_func) {
850 case SP_STARTPOINT:
851 return "st_startpoint";
852 case SP_ENDPOINT:
853 return "st_endpoint";
854 case SP_EXTERIORRING:
855 return "st_exteriorring";
856 default:
857 assert(0); // Should never happened
858 return "spatial_decomp_unknown";
859 }
860 }
861 String *val_str(String *) override;
862};
863
866 bool resolve_type(THD *thd) override {
867 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
868 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
870 }
871
872 public:
875 : Item_geometry_func(pos, a, b) {
876 decomp_func_n = ft;
877 }
878 const char *func_name() const override {
879 switch (decomp_func_n) {
880 case SP_POINTN:
881 return "st_pointn";
882 case SP_GEOMETRYN:
883 return "st_geometryn";
884 case SP_INTERIORRINGN:
885 return "st_interiorringn";
886 default:
887 assert(0); // Should never happened
888 return "spatial_decomp_n_unknown";
889 }
890 }
891 String *val_str(String *) override;
892};
893
898
899 public:
901 enum Geometry::wkbType ct,
902 enum Geometry::wkbType it)
903 : Item_geometry_func(pos, list) {
904 coll_type = ct;
905 item_type = it;
906 }
907 String *val_str(String *) override;
908 bool resolve_type(THD *thd) override {
909 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
910 if (Item_geometry_func::resolve_type(thd)) return true;
911 for (unsigned int i = 0; i < arg_count; ++i) {
912 if (args[i]->fixed && args[i]->data_type() != MYSQL_TYPE_GEOMETRY) {
913 String str;
915 str.append('\0');
916 my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "non geometric", str.ptr());
917 return true;
918 }
919 }
920 return false;
921 }
922
923 const char *func_name() const override;
924};
925
926/*
927 Spatial relations
928*/
929
932
933 public:
935 : Item_bool_func2(a, b) {
936 spatial_rel = sp_rel;
937 }
939 enum Functype sp_rel)
940 : Item_bool_func2(pos, a, b) {
941 spatial_rel = sp_rel;
942 }
943 longlong val_int() override;
944 enum Functype functype() const override { return spatial_rel; }
945 enum Functype rev_functype() const override {
946 switch (spatial_rel) {
947 case SP_CONTAINS_FUNC:
948 return SP_WITHIN_FUNC;
949 case SP_WITHIN_FUNC:
950 return SP_CONTAINS_FUNC;
951 default:
952 return spatial_rel;
953 }
954 }
955
956 const char *func_name() const override;
957 void print(const THD *thd, String *str,
958 enum_query_type query_type) const override {
959 Item_func::print(thd, str, query_type);
960 }
961 bool resolve_type(THD *) override {
962 set_nullable(true);
963 return false;
964 }
965 bool is_null() override {
966 val_int();
967 return null_value;
968 }
969};
970
972 public:
974 : Item_bool_func2(pos, a, b) {}
975 bool resolve_type(THD *thd) override {
976 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
977 // Spatial relation functions may return NULL if either parameter is NULL or
978 // an empty geometry. Since we can't check for empty geometries at resolve
979 // time, this item is always nullable.
980 set_nullable(true);
981 return false;
982 }
983 void print(const THD *thd, String *str,
984 enum_query_type query_type) const override {
985 Item_func::print(thd, str, query_type);
986 }
987 longlong val_int() override;
988 bool is_null() override {
989 // The superclass implementation only checks is_null on the item's
990 // arguments. However, relational functions may return NULL even if the
991 // arguments are not NULL, e.g., if one or more argument is an empty
992 // geometry. Therefore, we must evaluate the item to find out if it is NULL
993 // or not.
994 val_int();
995 return null_value;
996 }
997
998 /**
999 Evaluate the spatial relation function.
1000
1001 @param[in] srs Spatial reference system common to both g1 and g2.
1002 @param[in] g1 First geometry.
1003 @param[in] g2 Second geometry.
1004 @param[out] result Result of the relational operation.
1005 @param[out] null True if the function should return NULL, false otherwise.
1006
1007 @retval true An error has occurred and has been reported with my_error.
1008 @retval false Success.
1009 */
1010 virtual bool eval(const dd::Spatial_reference_system *srs,
1011 const gis::Geometry *g1, const gis::Geometry *g2,
1012 bool *result, bool *null) = 0;
1013};
1014
1016 public:
1019 enum Functype functype() const override { return SP_CONTAINS_FUNC; }
1020 enum Functype rev_functype() const override { return SP_WITHIN_FUNC; }
1021 const char *func_name() const override { return "st_contains"; }
1022 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1023 const gis::Geometry *g2, bool *result, bool *null) override;
1024};
1025
1027 public:
1030 enum Functype functype() const override { return SP_CROSSES_FUNC; }
1031 enum Functype rev_functype() const override { return SP_CROSSES_FUNC; }
1032 const char *func_name() const override { return "st_crosses"; }
1033 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1034 const gis::Geometry *g2, bool *result, bool *null) override;
1035};
1036
1038 public:
1041 enum Functype functype() const override { return SP_DISJOINT_FUNC; }
1042 enum Functype rev_functype() const override { return SP_DISJOINT_FUNC; }
1043 const char *func_name() const override { return "st_disjoint"; }
1044 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1045 const gis::Geometry *g2, bool *result, bool *null) override;
1046};
1047
1049 public:
1052 enum Functype functype() const override { return SP_EQUALS_FUNC; }
1053 enum Functype rev_functype() const override { return SP_EQUALS_FUNC; }
1054 const char *func_name() const override { return "st_equals"; }
1055 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1056 const gis::Geometry *g2, bool *result, bool *null) override;
1057};
1058
1060 public:
1063 enum Functype functype() const override { return SP_INTERSECTS_FUNC; }
1064 enum Functype rev_functype() const override { return SP_INTERSECTS_FUNC; }
1065 const char *func_name() const override { return "st_intersects"; }
1066 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1067 const gis::Geometry *g2, bool *result, bool *null) override;
1068};
1069
1071 public:
1074 enum Functype functype() const override { return SP_CONTAINS_FUNC; }
1075 enum Functype rev_functype() const override { return SP_WITHIN_FUNC; }
1076 const char *func_name() const override { return "mbrcontains"; }
1077 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1078 const gis::Geometry *g2, bool *result, bool *null) override;
1079};
1080
1082 public:
1085 enum Functype functype() const override { return SP_COVEREDBY_FUNC; }
1086 enum Functype rev_functype() const override { return SP_COVERS_FUNC; }
1087 const char *func_name() const override { return "mbrcoveredby"; }
1088 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1089 const gis::Geometry *g2, bool *result, bool *null) override;
1090};
1091
1093 public:
1096 enum Functype functype() const override { return SP_COVERS_FUNC; }
1097 enum Functype rev_functype() const override { return SP_COVEREDBY_FUNC; }
1098 const char *func_name() const override { return "mbrcovers"; }
1099 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1100 const gis::Geometry *g2, bool *result, bool *null) override;
1101};
1102
1104 public:
1107 enum Functype functype() const override { return SP_DISJOINT_FUNC; }
1108 enum Functype rev_functype() const override { return SP_DISJOINT_FUNC; }
1109 const char *func_name() const override { return "mbrdisjoint"; }
1110 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1111 const gis::Geometry *g2, bool *result, bool *null) override;
1112};
1113
1115 public:
1118 enum Functype functype() const override { return SP_EQUALS_FUNC; }
1119 enum Functype rev_functype() const override { return SP_EQUALS_FUNC; }
1120 const char *func_name() const override { return "mbrequals"; }
1121 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1122 const gis::Geometry *g2, bool *result, bool *null) override;
1123};
1124
1126 public:
1129 enum Functype functype() const override { return SP_INTERSECTS_FUNC; }
1130 enum Functype rev_functype() const override { return SP_INTERSECTS_FUNC; }
1131 const char *func_name() const override { return "mbrintersects"; }
1132 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1133 const gis::Geometry *g2, bool *result, bool *null) override;
1134};
1135
1137 public:
1140 enum Functype functype() const override { return SP_OVERLAPS_FUNC; }
1141 enum Functype rev_functype() const override { return SP_OVERLAPS_FUNC; }
1142 const char *func_name() const override { return "mbroverlaps"; }
1143 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1144 const gis::Geometry *g2, bool *result, bool *null) override;
1145};
1146
1148 public:
1151 enum Functype functype() const override { return SP_TOUCHES_FUNC; }
1152 enum Functype rev_functype() const override { return SP_TOUCHES_FUNC; }
1153 const char *func_name() const override { return "mbrtouches"; }
1154 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1155 const gis::Geometry *g2, bool *result, bool *null) override;
1156};
1157
1159 public:
1162 enum Functype functype() const override { return SP_WITHIN_FUNC; }
1163 enum Functype rev_functype() const override { return SP_CONTAINS_FUNC; }
1164 const char *func_name() const override { return "mbrwithin"; }
1165 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1166 const gis::Geometry *g2, bool *result, bool *null) override;
1167};
1168
1170 public:
1173 enum Functype functype() const override { return SP_OVERLAPS_FUNC; }
1174 enum Functype rev_functype() const override { return SP_OVERLAPS_FUNC; }
1175 const char *func_name() const override { return "st_overlaps"; }
1176 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1177 const gis::Geometry *g2, bool *result, bool *null) override;
1178};
1179
1181 public:
1184 enum Functype functype() const override { return SP_TOUCHES_FUNC; }
1185 enum Functype rev_functype() const override { return SP_TOUCHES_FUNC; }
1186 const char *func_name() const override { return "st_touches"; }
1187 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1188 const gis::Geometry *g2, bool *result, bool *null) override;
1189};
1190
1192 public:
1195 enum Functype functype() const override { return SP_WITHIN_FUNC; }
1196 enum Functype rev_functype() const override { return SP_CONTAINS_FUNC; }
1197 const char *func_name() const override { return "st_within"; }
1198 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1199 const gis::Geometry *g2, bool *result, bool *null) override;
1200};
1201
1202/**
1203 Spatial operations
1204*/
1206 protected:
1208 : Item_geometry_func(pos, a, b) {}
1209
1210 private:
1211 bool resolve_type(THD *thd) override {
1212 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1214 }
1215};
1216
1218 public:
1221 String *val_str(String *) override;
1222 const char *func_name() const override { return "st_difference"; }
1223};
1224
1226 public:
1229 String *val_str(String *) override;
1230 const char *func_name() const override { return "st_intersection"; }
1231};
1232
1234 public:
1237 String *val_str(String *) override;
1238 const char *func_name() const override { return "st_symdifference"; }
1239};
1240
1242 public:
1245 String *val_str(String *) override;
1246 const char *func_name() const override { return "st_union"; }
1247};
1248
1250 public:
1251 /*
1252 There are five types of buffer strategies, this is an enumeration of them.
1253 */
1259 // The two below are not parameterized.
1263
1264 /*
1265 For each type of strategy listed above, there are several options/values
1266 for it, this is an enumeration of all such options/values for all types of
1267 strategies.
1268 */
1278
1279 // Distance and side strategies are fixed, so no need to implement
1280 // parameterization for them.
1282
1283 /*
1284 A piece of strategy setting. User can specify 0 to 3 different strategy
1285 settings in any order to ST_Buffer(), which must be of different
1286 strategy types. Default strategies are used if not explicitly specified.
1287 */
1290 // This field is only effective for end_round, join_round, join_mit,
1291 // and point_circle.
1292 double value;
1293 };
1294
1295 private:
1299 /*
1300 end_xxx stored in settings[end_strategy];
1301 join_xxx stored in settings[join_strategy];
1302 point_xxx stored in settings[point_strategy].
1303 */
1305 String tmp_value; // Stores current buffer result.
1307 void set_strategies();
1308 bool resolve_type(THD *thd) override {
1309 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1310 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
1311 if (param_type_is_default(thd, 2, -1)) return true;
1313 }
1314
1315 public:
1316 Item_func_buffer(const POS &pos, PT_item_list *ilist);
1317 const char *func_name() const override { return "st_buffer"; }
1318};
1319
1321 private:
1322 friend class Item_func_buffer;
1324 char tmp_buffer[16]; // The buffer for tmp_value.
1325 public:
1327 const char *func_name() const override { return "st_buffer_strategy"; }
1328 String *val_str(String *) override;
1329 bool resolve_type(THD *thd) override;
1330};
1331
1333 public:
1335 longlong val_int() override;
1336 optimize_type select_optimize(const THD *) override { return OPTIMIZE_NONE; }
1337 const char *func_name() const override { return "st_isempty"; }
1338 bool resolve_type(THD *thd) override {
1339 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1340 set_nullable(true);
1341 return false;
1342 }
1343};
1344
1346 public:
1348 longlong val_int() override;
1349 const char *func_name() const override { return "st_issimple"; }
1350 bool resolve_type(THD *thd) override {
1351 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1352 return Item_bool_func::resolve_type(thd);
1353 }
1354};
1355
1357 public:
1359 longlong val_int() override;
1360 optimize_type select_optimize(const THD *) override { return OPTIMIZE_NONE; }
1361 const char *func_name() const override { return "st_isclosed"; }
1362 bool resolve_type(THD *thd) override {
1363 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1364 set_nullable(true);
1365 return false;
1366 }
1367};
1368
1370 public:
1372 longlong val_int() override;
1373 optimize_type select_optimize(const THD *) override { return OPTIMIZE_NONE; }
1374 const char *func_name() const override { return "st_isvalid"; }
1375 bool resolve_type(THD *thd) override {
1376 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1377 return Item_bool_func::resolve_type(thd);
1378 }
1379};
1380
1383
1384 public:
1386 longlong val_int() override;
1387 const char *func_name() const override { return "st_dimension"; }
1388 bool resolve_type(THD *thd) override {
1389 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1390 max_length = 10;
1391 set_nullable(true);
1392 return false;
1393 }
1394};
1395
1396/// The abstract superclass for all geometry coordinate mutator functions (ST_X,
1397/// ST_Y, ST_Latitude and ST_Longitude with two parameters).
1398///
1399/// @see Item_func_coordinate_observer
1401 public:
1403 bool geographic_only)
1404 : Item_geometry_func(pos, a, b), m_geographic_only(geographic_only) {}
1405 String *val_str(String *) override;
1406
1407 protected:
1408 const char *func_name() const override = 0;
1409 /// Returns the coordinate number accessed by this item.
1410 ///
1411 /// @param[in] srs The spatial reference system of the point.
1412 ///
1413 /// @return The coordinate number to access.
1415 const dd::Spatial_reference_system *srs) const = 0;
1416 bool resolve_type(THD *thd) override {
1417 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1418 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
1420 }
1421
1422 private:
1423 /// Whether this item will accept only geographic geometries/SRSs.
1425};
1426
1427/// The abstract superclass for all geometry coordinate oberserver functions
1428/// (ST_X, ST_Y, ST_Latitude, ST_Longitude with one parameter).
1429///
1430/// @see Item_func_coordinate_mutator
1432 public:
1433 Item_func_coordinate_observer(const POS &pos, Item *a, bool geographic_only)
1434 : Item_real_func(pos, a), m_geographic_only(geographic_only) {}
1435 double val_real() override;
1436
1437 protected:
1438 const char *func_name() const override = 0;
1439 /// Returns the coordinate number accessed by this item.
1440 ///
1441 /// @param[in] srs The spatial reference system of the point.
1442 ///
1443 /// @return The coordinate number to access.
1445 const dd::Spatial_reference_system *srs) const = 0;
1446 bool resolve_type(THD *thd) override {
1447 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1448 return Item_real_func::resolve_type(thd);
1449 }
1450
1451 private:
1452 /// Whether this item will accept only geographic geometries/SRSs.
1454};
1455
1456/// This class implements the two-parameter ST_Latitude function which sets the
1457/// latitude of a geographic point.
1460 public:
1462 : Item_func_coordinate_mutator(pos, a, b, true) {}
1463
1464 protected:
1465 const char *func_name() const override { return "st_latitude"; }
1467 return 1;
1468 }
1469};
1470
1471/// This class implements the one-parameter ST_Latitude function which returns
1472/// the latitude coordinate of a geographic point.
1475 public:
1477 : Item_func_coordinate_observer(pos, a, true) {}
1478
1479 protected:
1480 const char *func_name() const override { return "st_latitude"; }
1482 return 1;
1483 }
1484};
1485
1486/// This class implements the two-parameter ST_Longitude function which sets the
1487/// longitude coordinate of a point.
1490 public:
1492 : Item_func_coordinate_mutator(pos, a, b, true) {}
1493
1494 protected:
1495 const char *func_name() const override { return "st_longitude"; }
1497 return 0;
1498 }
1499};
1500
1501/// This class implements the one-parameter ST_Longitude function which returns
1502/// the longitude coordinate of a geographic point.
1505 public:
1507 : Item_func_coordinate_observer(pos, a, true) {}
1508
1509 protected:
1510 const char *func_name() const override { return "st_longitude"; }
1512 return 0;
1513 }
1514};
1515
1516/// This class implements the two-parameter ST_X function which sets the X
1517/// coordinate of a point.
1519 public:
1521 : Item_func_coordinate_mutator(pos, a, b, false) {}
1522
1523 protected:
1524 const char *func_name() const override { return "st_x"; }
1525 int coordinate_number(const dd::Spatial_reference_system *srs) const override;
1526};
1527
1528/// This class implements the one-parameter ST_X function which returns the X
1529/// coordinate of a point.
1531 public:
1533 : Item_func_coordinate_observer(pos, a, false) {}
1534
1535 protected:
1536 const char *func_name() const override { return "st_x"; }
1537 int coordinate_number(const dd::Spatial_reference_system *srs) const override;
1538};
1539
1540/// This class implements the two-parameter ST_Y function which sets the Y
1541/// coordinate of a point.
1543 public:
1545 : Item_func_coordinate_mutator(pos, a, b, false) {}
1546
1547 protected:
1548 const char *func_name() const override { return "st_y"; }
1549 int coordinate_number(const dd::Spatial_reference_system *srs) const override;
1550};
1551
1552/// This class implements the one-parameter ST_Y function which returns the Y
1553/// coordinate of a point.
1555 public:
1557 : Item_func_coordinate_observer(pos, a, false) {}
1558
1559 protected:
1560 const char *func_name() const override { return "st_y"; }
1561 int coordinate_number(const dd::Spatial_reference_system *srs) const override;
1562};
1563
1565 bool resolve_type(THD *thd) override {
1566 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1568 }
1569
1570 public:
1572 const char *func_name() const override { return "st_swapxy"; }
1573 String *val_str(String *) override;
1574};
1575
1578
1579 public:
1581 longlong val_int() override;
1582 const char *func_name() const override { return "st_numgeometries"; }
1583 bool resolve_type(THD *thd) override {
1584 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1585 max_length = 10;
1586 set_nullable(true);
1587 return false;
1588 }
1589};
1590
1593
1594 public:
1596 longlong val_int() override;
1597 const char *func_name() const override { return "st_numinteriorrings"; }
1598 bool resolve_type(THD *thd) override {
1599 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1600 max_length = 10;
1601 set_nullable(true);
1602 return false;
1603 }
1604};
1605
1608
1609 public:
1611 longlong val_int() override;
1612 const char *func_name() const override { return "st_numpoints"; }
1613 bool resolve_type(THD *thd) override {
1614 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1615 max_length = 10;
1616 set_nullable(true);
1617 return false;
1618 }
1619};
1620
1622 public:
1624 double val_real() override;
1625 const char *func_name() const override { return "st_area"; }
1626 bool resolve_type(THD *thd) override {
1627 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1628 // ST_Area returns NULL if the geometry is empty.
1629 set_nullable(true);
1630 return false;
1631 }
1632};
1633
1635 public:
1636 /// Parses strategy stored in String object, and sets values in strats.
1637 bool parse_strategy(String *arg, gis::BufferStrategies &strats);
1638
1640 : Item_geometry_func(pos, ilist) {}
1641
1642 String *val_str(String *) override;
1643 const char *func_name() const override { return "st_buffer"; }
1644 bool resolve_type(THD *thd) override {
1645 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1646 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
1647 if (param_type_is_default(thd, 2, -1))
1648 return true; // Does nothing with the strategy args
1650 }
1651};
1652
1655
1656 public:
1658 : Item_real_func(pos, ilist) {}
1659 double val_real() override;
1660 const char *func_name() const override { return "st_length"; }
1661 bool resolve_type(THD *thd) override {
1662 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1663 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1664 if (Item_real_func::resolve_type(thd)) return true;
1665 set_nullable(true);
1666 return false;
1667 }
1668};
1669
1670/// This class implements the two-parameter ST_SRID function which sets
1671/// the SRID of a geometry.
1673 public:
1675 : Item_geometry_func(pos, a, b) {}
1676 String *val_str(String *) override;
1677 const char *func_name() const override { return "st_srid"; }
1678 bool resolve_type(THD *thd) override {
1679 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1680 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
1682 }
1683};
1684
1685/// This class implements the one-parameter ST_SRID function which
1686/// returns the SRID of a geometry.
1688 public:
1690 longlong val_int() override;
1691 const char *func_name() const override { return "st_srid"; }
1692 bool resolve_type(THD *thd) override {
1693 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1695 max_length = 10;
1696 return error;
1697 }
1698};
1699
1701 double geometry_collection_distance(const Geometry *g1, const Geometry *g2);
1702
1703 template <typename Coordsys, typename BG_geometry>
1704 double distance_dispatch_second_geometry(const BG_geometry &bg1,
1705 const Geometry *g2);
1706
1707 public:
1708 template <typename Coordsys>
1709 double bg_distance(const Geometry *g1, const Geometry *g2);
1710
1712 : Item_real_func(pos, ilist) {
1713 /*
1714 Either operand can be an empty geometry collection, and it's meaningless
1715 for a distance between them.
1716 */
1717 set_nullable(true);
1718 }
1719
1720 bool resolve_type(THD *thd) override {
1721 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1722 set_nullable(true);
1723 return false;
1724 }
1725
1726 double val_real() override;
1727 const char *func_name() const override { return "st_distance"; }
1728};
1729
1731 public:
1733 : Item_real_func(pos, ilist) {}
1734 double val_real() override;
1735 const char *func_name() const override { return "st_frechetdistance"; }
1736 bool resolve_type(THD *thd) override {
1738 if (Item_real_func::resolve_type(thd)) return true;
1739 set_nullable(true);
1740 return false;
1741 }
1742};
1743
1745 public:
1747 : Item_real_func(pos, ilist) {}
1748 double val_real() override;
1749 const char *func_name() const override { return "st_hausdorffdistance"; }
1750 bool resolve_type(THD *thd) override {
1752 if (Item_real_func::resolve_type(thd)) return true;
1753 set_nullable(true);
1754 return false;
1755 }
1756};
1757
1759 public:
1761 : Item_real_func(pos, ilist) {}
1762 double val_real() override;
1763 const char *func_name() const override { return "st_distance_sphere"; }
1764 bool resolve_type(THD *thd) override {
1765 if (param_type_is_default(thd, 0, 2, MYSQL_TYPE_GEOMETRY)) return true;
1766 if (param_type_is_default(thd, 2, 3, MYSQL_TYPE_DOUBLE)) return true;
1767 return Item_real_func::resolve_type(thd);
1768 }
1769};
1770
1771// The abstract superclass for interpolating point(s) along a line.
1773 public:
1775 : Item_geometry_func(pos, a, b) {}
1776 String *val_str(String *str) override;
1777
1778 protected:
1779 virtual bool isFractionalDistance() const = 0;
1780 virtual bool returnMultiplePoints() const = 0;
1781 bool resolve_type(THD *thd) override {
1782 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1783 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
1785 }
1786};
1787
1789 public:
1791 : Item_func_lineinterpolate(pos, a, b) {}
1792
1793 protected:
1794 const char *func_name() const override { return "st_lineinterpolatepoint"; }
1795 bool isFractionalDistance() const override { return true; }
1796 bool returnMultiplePoints() const override { return false; }
1797};
1798
1800 public:
1802 : Item_func_lineinterpolate(pos, a, b) {}
1803
1804 protected:
1805 const char *func_name() const override { return "st_lineinterpolatepoints"; }
1806 bool isFractionalDistance() const override { return true; }
1807 bool returnMultiplePoints() const override { return true; }
1808};
1809
1811 public:
1813 : Item_func_lineinterpolate(pos, a, b) {}
1814
1815 protected:
1816 const char *func_name() const override { return "st_pointatdistance"; }
1817 bool isFractionalDistance() const override { return false; }
1818 bool returnMultiplePoints() const override { return false; }
1819};
1820
1821/// This class implements ST_Transform function that transforms a geometry from
1822/// one SRS to another.
1824 public:
1826 : Item_geometry_func(pos, a, b) {}
1827 String *val_str(String *str) override;
1828
1829 private:
1830 const char *func_name() const override { return "st_transform"; }
1831};
1832
1833// This is an abstract class that is inherited by geometry cast items.
1835 public:
1837 : Item_geometry_func(pos, a) {}
1838 String *val_str(String *str) override;
1839 void print(const THD *thd, String *str,
1840 enum_query_type query_type) const override = 0;
1841 const char *func_name() const override = 0;
1842 enum Functype functype() const override { return TYPECAST_FUNC; }
1844 bool resolve_type(THD *thd) override {
1847 }
1848
1849 /// Casts certain geometry types to certain target geometry types.
1850 ///
1851 /// @param[in] srs The srs of the geometry being cast.
1852 /// @param[in] source_geometry The geometry being cast.
1853 /// @param[out] target_geometry The result geometry of the cast.
1854 ///
1855 /// @retval false Success.
1856 /// @retval true An error has occurred. The error has been reported with
1857 /// my_error().
1858
1859 virtual bool cast(const dd::Spatial_reference_system *srs,
1860 std::unique_ptr<gis::Geometry> *source_geometry,
1861 std::unique_ptr<gis::Geometry> *target_geometry) const = 0;
1862};
1863
1864// This class implements CAST from certain geometries to POINT type.
1866 public:
1869 void print(const THD *thd, String *str,
1870 enum_query_type query_type) const override;
1871 const char *func_name() const override { return "cast_as_point"; }
1872 Field::geometry_type get_geometry_type() const override;
1874 std::unique_ptr<gis::Geometry> *source_geometry,
1875 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1876};
1877
1878// This class implements CAST from certain geometries to LINESTRING type.
1880 public:
1883 void print(const THD *thd, String *str,
1884 enum_query_type query_type) const override;
1885 const char *func_name() const override { return "cast_as_linestring"; }
1886 Field::geometry_type get_geometry_type() const override;
1888 std::unique_ptr<gis::Geometry> *source_geometry,
1889 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1890};
1891
1892// This class implements CAST from certain geometries to POLYGON type.
1894 public:
1897 void print(const THD *thd, String *str,
1898 enum_query_type query_type) const override;
1899 const char *func_name() const override { return "cast_as_polygon"; }
1900 Field::geometry_type get_geometry_type() const override;
1901 bool cast(const dd::Spatial_reference_system *srs,
1902 std::unique_ptr<gis::Geometry> *source_geometry,
1903 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1904};
1905
1906// This class implements CAST from certain geometries to MULTIPOINT type.
1908 public:
1911 void print(const THD *thd, String *str,
1912 enum_query_type query_type) const override;
1913 const char *func_name() const override { return "cast_as_multipoint"; }
1914 Field::geometry_type get_geometry_type() const override;
1916 std::unique_ptr<gis::Geometry> *source_geometry,
1917 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1918};
1919
1920// This class implements CAST from certain geometries to MULTILINESTRING type.
1922 public:
1925 void print(const THD *thd, String *str,
1926 enum_query_type query_type) const override;
1927 const char *func_name() const override { return "cast_as_multilinestring"; }
1928 Field::geometry_type get_geometry_type() const override;
1930 std::unique_ptr<gis::Geometry> *source_geometry,
1931 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1932};
1933
1934// This class implements CAST from certain geometries to MULTIPOLYGON type.
1936 public:
1939 void print(const THD *thd, String *str,
1940 enum_query_type query_type) const override;
1941 const char *func_name() const override { return "cast_as_multipolygon"; }
1942 Field::geometry_type get_geometry_type() const override;
1943 bool cast(const dd::Spatial_reference_system *srs,
1944 std::unique_ptr<gis::Geometry> *source_geometry,
1945 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1946};
1947
1948// This class implements CAST from certain geometries to GEOMETRYCOLLECTION
1949// type.
1951 public:
1954 void print(const THD *thd, String *str,
1955 enum_query_type query_type) const override;
1956 const char *func_name() const override {
1957 return "cast_as_geometrycollection";
1958 }
1959 Field::geometry_type get_geometry_type() const override;
1961 std::unique_ptr<gis::Geometry> *source_geometry,
1962 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1963};
1964
1965#endif /*ITEM_GEOFUNC_INCLUDED*/
This file implements a struct that is used to hold information that decide how to compute the buffer ...
A utility class to flatten any hierarchy of geometry collection into one with no nested geometry coll...
Definition: item_geofunc.h:140
Geometry_list & get_geometries()
Definition: item_geofunc.h:167
void set_comp_no_overlapped(bool b)
Definition: item_geofunc.h:155
size_t m_num_isolated
Definition: item_geofunc.h:143
std::vector< Geometry * > Geometry_list
Definition: item_geofunc.h:149
gis::srid_t get_srid() const
Definition: item_geofunc.h:157
const Geometry_list & get_geometries() const
Definition: item_geofunc.h:165
gis::srid_t m_srid
Definition: item_geofunc.h:142
Geometry * store(const Geometry *geo)
Store a geometry of GEOMETRY format into this collection.
Definition: item_geofunc.cc:4627
Inplace_vector< String > m_geosdata
Definition: item_geofunc.h:146
bool fill(const Geometry *geo, bool break_multi_geom=false)
Definition: item_geofunc.h:161
bool store_geometry(const Geometry *geo, bool break_multi_geom)
Store a Geometry object into this collection.
Definition: item_geofunc.cc:4569
size_t num_isolated() const
Definition: item_geofunc.h:171
bool comp_no_overlapped
Definition: item_geofunc.h:141
BG_geometry_collection()
Definition: item_geofunc.cc:4530
bool is_comp_no_overlapped() const
Definition: item_geofunc.h:153
std::vector< Geometry * > m_geos
Definition: item_geofunc.h:144
Inplace_vector< Geometry_buffer > m_geobufs
Definition: item_geofunc.h:145
Gis_geometry_collection * as_geometry_collection(String *geodata) const
Convert this into a Gis_geometry_collection object.
Definition: item_geofunc.cc:4542
bool all_isolated() const
Definition: item_geofunc.h:169
void set_srid(gis::srid_t srid)
Definition: item_geofunc.h:159
We have to hold result buffers in functions that return a GEOMETRY string, because such a function's ...
Definition: item_geofunc.h:81
~BG_result_buf_mgr()
Definition: item_geofunc.h:87
void add_buffer(void *buf)
Definition: item_geofunc.h:92
void * bg_result_buf
Definition: item_geofunc.h:124
void set_result_buffer(void *buf)
Definition: item_geofunc.h:114
BG_result_buf_mgr()
Definition: item_geofunc.h:85
void free_intermediate_result_buffers()
Definition: item_geofunc.h:100
void forget_buffer(void *buf)
Definition: item_geofunc.h:94
Prealloced_buffers bg_results
Definition: item_geofunc.h:130
void free_result_buffer()
Definition: item_geofunc.h:109
Prealloced_array< void *, 64 > Prealloced_buffers
Definition: item_geofunc.h:82
Definition: field.h:573
static constexpr size_t MAX_LONG_BLOB_WIDTH
Definition: field.h:735
geometry_type
Definition: field.h:716
@ GEOM_POINT
Definition: field.h:718
Definition: spatial.h:214
wkbType
Definition: spatial.h:291
Definition: spatial.h:2399
Definition: spatial.h:2089
Definition: spatial.h:1142
Definition: spatial.h:2177
Utility container class to store elements stably and scalably.
Definition: inplace_vector.h:59
Base class for functions that usually take two arguments, which are possibly strings,...
Definition: item_cmpfunc.h:619
Definition: item_cmpfunc.h:285
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_cmpfunc.h:319
This class handles the following function:
Definition: item_geofunc.h:492
bool val_json(Json_wrapper *wr) override
Create a GeoJSON object, according to GeoJSON specification revision 1.0.
Definition: item_geofunc.cc:2360
Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry, Item *maxdecimaldigits)
Definition: item_geofunc.h:517
bool m_add_short_crs_urn
If true, the output GeoJSON has a CRS object in the short form (e.g "EPSG:4326").
Definition: item_geofunc.h:502
bool parse_maxdecimaldigits_argument()
Parse the value in maxdecimaldigits argument.
Definition: item_geofunc.cc:2450
Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry, Item *maxdecimaldigits, Item *options)
Definition: item_geofunc.h:523
int m_max_decimal_digits
Maximum number of decimal digits in printed coordinates.
Definition: item_geofunc.h:495
bool m_add_bounding_box
If true, the output GeoJSON has a bounding box for each GEOMETRY.
Definition: item_geofunc.h:497
const char * func_name() const override
Definition: item_geofunc.h:531
Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry)
Definition: item_geofunc.h:512
bool parse_options_argument()
Parse the value in options argument.
Definition: item_geofunc.cc:2413
uint32 m_geometry_srid
The SRID found in the input GEOMETRY.
Definition: item_geofunc.h:509
bool fix_fields(THD *thd, Item **ref) override
Perform type checking on all arguments.
Definition: item_geofunc.cc:2483
bool m_add_long_crs_urn
If true, the output GeoJSON has a CRS object in the long form (e.g "urn:ogc:def:crs:EPSG::4326").
Definition: item_geofunc.h:507
Definition: item_geofunc.h:332
Item_func_as_wkb(const POS &pos, Item *a)
Definition: item_geofunc.h:334
const char * func_name() const override
Definition: item_geofunc.h:337
String * val_str(String *) override
Definition: item_geofunc.cc:3253
Item_func_as_wkb(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:335
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:339
Definition: item_geofunc.h:322
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.cc:3244
String * val_str_ascii(String *) override
Definition: item_geofunc.cc:3134
Item_func_as_wkt(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:325
const char * func_name() const override
Definition: item_geofunc.h:327
Item_func_as_wkt(const POS &pos, Item *a)
Definition: item_geofunc.h:324
Definition: item_geofunc.h:1320
char tmp_buffer[16]
Definition: item_geofunc.h:1324
String tmp_value
Definition: item_geofunc.h:1323
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc_buffer.cc:178
const char * func_name() const override
Definition: item_geofunc.h:1327
String * val_str(String *) override
Definition: item_geofunc_buffer.cc:186
Item_func_buffer_strategy(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc_buffer.cc:170
Definition: item_geofunc.h:1249
String tmp_value
Definition: item_geofunc.h:1305
String * strategies[side_strategy+1]
Definition: item_geofunc.h:1298
BG_result_buf_mgr bg_resbuf_mgr
Definition: item_geofunc.h:1296
void set_strategies()
Definition: item_geofunc_buffer.cc:118
enum_buffer_strategies
Definition: item_geofunc.h:1269
@ max_strategy
Definition: item_geofunc.h:1277
@ end_round
Definition: item_geofunc.h:1271
@ point_circle
Definition: item_geofunc.h:1275
@ join_round
Definition: item_geofunc.h:1273
@ point_square
Definition: item_geofunc.h:1276
@ join_miter
Definition: item_geofunc.h:1274
@ invalid_strategy
Definition: item_geofunc.h:1270
@ end_flat
Definition: item_geofunc.h:1272
String m_tmp_geombuf
Definition: item_geofunc.h:1306
Item_func_buffer(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc_buffer.cc:341
enum_buffer_strategy_types
Definition: item_geofunc.h:1254
@ join_strategy
Definition: item_geofunc.h:1257
@ point_strategy
Definition: item_geofunc.h:1258
@ invalid_strategy_type
Definition: item_geofunc.h:1255
@ end_strategy
Definition: item_geofunc.h:1256
@ distance_strategy
Definition: item_geofunc.h:1260
@ side_strategy
Definition: item_geofunc.h:1261
const char * func_name() const override
Definition: item_geofunc.h:1317
int num_strats
Definition: item_geofunc.h:1297
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1308
Definition: item_geofunc.h:697
const char * func_name() const override
Definition: item_geofunc.h:705
bool bg_centroid(const Geometry *geom, String *ptwkb)
Definition: item_geofunc.cc:3824
String * val_str(String *) override
Definition: item_geofunc.cc:3607
Item_func_centroid(const POS &pos, Item *a)
Definition: item_geofunc.h:704
BG_result_buf_mgr bg_resbuf_mgr
Definition: item_geofunc.h:698
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:708
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:3603
Definition: item_geofunc.h:714
BG_result_buf_mgr bg_resbuf_mgr
Definition: item_geofunc.h:715
bool bg_convex_hull(const Geometry *geom, String *wkb)
Definition: item_geofunc.cc:3930
const char * func_name() const override
Definition: item_geofunc.h:722
String * val_str(String *) override
Definition: item_geofunc.cc:3894
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:725
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:3890
Item_func_convex_hull(const POS &pos, Item *a)
Definition: item_geofunc.h:721
The abstract superclass for all geometry coordinate mutator functions (ST_X, ST_Y,...
Definition: item_geofunc.h:1400
virtual int coordinate_number(const dd::Spatial_reference_system *srs) const =0
Returns the coordinate number accessed by this item.
Item_func_coordinate_mutator(const POS &pos, Item *a, Item *b, bool geographic_only)
Definition: item_geofunc.h:1402
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1416
const char * func_name() const override=0
bool m_geographic_only
Whether this item will accept only geographic geometries/SRSs.
Definition: item_geofunc.h:1424
String * val_str(String *) override
Definition: item_geofunc.cc:4920
The abstract superclass for all geometry coordinate oberserver functions (ST_X, ST_Y,...
Definition: item_geofunc.h:1431
double val_real() override
Definition: item_geofunc.cc:4992
bool m_geographic_only
Whether this item will accept only geographic geometries/SRSs.
Definition: item_geofunc.h:1453
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1446
Item_func_coordinate_observer(const POS &pos, Item *a, bool geographic_only)
Definition: item_geofunc.h:1433
virtual int coordinate_number(const dd::Spatial_reference_system *srs) const =0
Returns the coordinate number accessed by this item.
const char * func_name() const override=0
Definition: item_geofunc.h:1381
String value
Definition: item_geofunc.h:1382
const char * func_name() const override
Definition: item_geofunc.h:1387
longlong val_int() override
Definition: item_geofunc.cc:4844
Item_func_dimension(const POS &pos, Item *a)
Definition: item_geofunc.h:1385
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1388
Definition: item_geofunc.h:1700
double val_real() override
Definition: item_geofunc.cc:5667
double geometry_collection_distance(const Geometry *g1, const Geometry *g2)
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1720
const char * func_name() const override
Definition: item_geofunc.h:1727
double bg_distance(const Geometry *g1, const Geometry *g2)
double distance_dispatch_second_geometry(const BG_geometry &bg1, const Geometry *g2)
Item_func_distance(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1711
Definition: item_geofunc.h:731
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:737
const char * func_name() const override
Definition: item_geofunc.h:734
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:3566
String * val_str(String *) override
Definition: item_geofunc.cc:3570
Item_func_envelope(const POS &pos, Item *a)
Definition: item_geofunc.h:733
This class handles two forms of the same function:
Definition: item_geofunc.h:545
char char_to_base32(char char_input)
Converts a char value to it's base32 representation, where 0 = a, 1 = b, ... , 30 = y,...
Definition: item_geofunc.cc:2861
uint geohash_max_output_length
The maximum output length of the geohash, supplied by the user.
Definition: item_geofunc.h:552
Item_func_geohash(const POS &pos, Item *longitude, Item *latitude, Item *length)
Definition: item_geofunc.h:592
String * val_str_ascii(String *) override
Encodes a pair of longitude and latitude values into a geohash string.
Definition: item_geofunc.cc:2668
double longitude
The longitude argument supplied by the user (directly or by a POINT).
Definition: item_geofunc.h:550
bool fill_and_check_fields()
Populate member variables with values from arguments.
Definition: item_geofunc.cc:2576
const double min_latitude
The minimum input latitude.
Definition: item_geofunc.h:564
bool fix_fields(THD *thd, Item **ref) override
Here we check for valid types.
Definition: item_geofunc.cc:2735
void encode_bit(double *upper_value, double *lower_value, double target_value, char *char_value, int bit_number)
Sets the bit number in char_value, determined by following formula:
Definition: item_geofunc.cc:2836
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.cc:2725
bool check_valid_latlong_type(Item *ref)
Checks if supplied item is a valid latitude or longitude, based on which type it is.
Definition: item_geofunc.cc:2526
const uint upper_limit_output_length
The absolute upper limit of geohash output length.
Definition: item_geofunc.h:582
const double min_longitude
The minimum input longitude.
Definition: item_geofunc.h:576
double latitude
The latitude argument supplied by the user (directly or by a POINT).
Definition: item_geofunc.h:548
const double max_latitude
The maximum input latitude.
Definition: item_geofunc.h:558
const double max_longitude
The maximum input longitude.
Definition: item_geofunc.h:570
const char * func_name() const override
Definition: item_geofunc.h:603
Item_func_geohash(const POS &pos, Item *point, Item *length)
Definition: item_geofunc.h:585
Definition: item_geofunc.h:200
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:253
Item_func_geometry_from_text(const POS &pos, Item *a, Item *srid, Item *option, Functype functype)
Definition: item_geofunc.h:246
Functype
Definition: item_geofunc.h:202
Functype m_functype
Definition: item_geofunc.h:223
Item_func_geometry_from_text(const POS &pos, Item *a, Functype functype)
Definition: item_geofunc.h:241
Geometry::wkbType allowed_wkb_type() const
Get the type of geometry that this Item can return.
Definition: item_geofunc.cc:362
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize() but with additional parameter.
Definition: item_geofunc.cc:313
String * val_str(String *) override
Parses a WKT string to produce a geometry encoded with an SRID prepending its WKB bytes,...
Definition: item_geofunc.cc:420
const char * func_name() const override
Definition: item_geofunc.cc:322
Item_geometry_func super
Definition: item_geofunc.h:222
bool is_allowed_wkb_type(Geometry::wkbType type) const
Check if a geometry type is a valid return type for this Item.
Definition: item_geofunc.cc:394
Item_func_geometry_from_text(const POS &pos, Item *a, Item *srid, Functype functype)
Definition: item_geofunc.h:243
Definition: item_geofunc.h:261
Item_geometry_func super
Definition: item_geofunc.h:282
Functype
Definition: item_geofunc.h:263
Item_func_geometry_from_wkb(const POS &pos, Item *a, Item *srid, Item *option, Functype functype)
Definition: item_geofunc.h:313
Item_func_geometry_from_wkb(const POS &pos, Item *a, Item *srid, Functype functype)
Definition: item_geofunc.h:310
String tmp_value
Definition: item_geofunc.h:283
Functype m_functype
Definition: item_geofunc.h:284
String * val_str(String *) override
Parses a WKB string to produce a geometry encoded with an SRID prepending its WKB bytes,...
Definition: item_geofunc.cc:677
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize() but with additional parameter.
Definition: item_geofunc.cc:573
Item_func_geometry_from_wkb(const POS &pos, Item *a, Functype functype)
Definition: item_geofunc.h:308
const char * func_name() const override
Definition: item_geofunc.cc:582
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:300
Geometry::wkbType allowed_wkb_type() const
Get the type of geometry that this Item can return.
Definition: item_geofunc.cc:620
bool is_allowed_wkb_type(Geometry::wkbType type) const
Check if a geometry type is a valid return type for this Item.
Definition: item_geofunc.cc:651
Definition: item_geofunc.h:348
Item_func_geometry_type(const POS &pos, Item *a)
Definition: item_geofunc.h:350
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:354
const char * func_name() const override
Definition: item_geofunc.h:353
String * val_str_ascii(String *) override
Definition: item_geofunc.cc:3360
This handles one function:
Definition: item_geofunc.h:376
bool m_toplevel
True if we're currently parsing the top-level object.
Definition: item_geofunc.h:468
static const char * TYPE_MEMBER
Definition of various string constants used for writing and reading GeoJSON data.
Definition: item_geofunc.h:423
static const char * FEATURECOLLECTION_TYPE
Definition: item_geofunc.h:443
bool parse_object(const Json_object *object, bool *rollback, String *buffer, bool is_parent_featurecollection, Geometry **geometry)
Takes a JSON object as input, and parses the data to a Geometry object.
Definition: item_geofunc.cc:1064
static const char * SHORT_EPSG_PREFIX
Definition: item_geofunc.h:432
static const char * CRS_NAME_MEMBER
Definition: item_geofunc.h:430
bool is_member_valid(const Json_dom *member, const char *member_name, enum_json_type expected_type, bool allow_null, bool *was_null)
Checks if a JSON member is valid based on input criteria.
Definition: item_geofunc.cc:1780
static const char * LINESTRING_TYPE
Definition: item_geofunc.h:437
bool parse_object_array(const Json_array *points, Geometry::wkbType type, bool *rollback, String *buffer, bool is_parent_featurecollection, Geometry **geometry)
Takes a JSON array as input, does a recursive parsing and returns a Geometry object.
Definition: item_geofunc.cc:1351
longlong m_srid_found_in_document
The SRID value of the document CRS, if one is found.
Definition: item_geofunc.h:458
double m_min_latitude
The minimum allowed latitude value (inclusive).
Definition: item_geofunc.h:464
static const char * MULTIPOLYGON_TYPE
Definition: item_geofunc.h:440
bool parse_crs_object(const Json_object *crs_object)
Takes a GeoJSON CRS object as input and parses it into a SRID.
Definition: item_geofunc.cc:1660
const Json_dom * my_find_member_ncase(const Json_object *object, const char *member_name)
Case insensitive lookup of a member in a JSON object.
Definition: item_geofunc.cc:1035
bool m_user_provided_srid
Is set to true if user provided a SRID as an argument.
Definition: item_geofunc.h:451
static const char * GEOMETRIES_MEMBER
Definition: item_geofunc.h:428
double m_min_longitude
The minimum allowed longitude value (non-inclusive).
Definition: item_geofunc.h:460
static const char * LONG_EPSG_PREFIX
Definition: item_geofunc.h:433
enum_handle_coordinate_dimension m_handle_coordinate_dimension
How higher coordinate dimensions than currently supported should be handled.
Definition: item_geofunc.h:449
static const char * COORDINATES_MEMBER
Definition: item_geofunc.h:429
static const char * FEATURE_TYPE
Definition: item_geofunc.h:442
String * val_str(String *) override
<geometry> = ST_GEOMFROMGEOJSON(<string>[, <options>[, <srid>]])
Definition: item_geofunc.cc:862
gis::srid_t m_user_srid
The SRID user provided as an argument.
Definition: item_geofunc.h:453
bool get_linestring(const Json_array *data_array, Gis_line_string *linestring)
Create a Gis_line_string from a JSON array.
Definition: item_geofunc.cc:1513
bool get_positions(const Json_array *coordinates, Gis_point *point)
Parse an array of coordinates to a Gis_point.
Definition: item_geofunc.cc:1251
const char * func_name() const override
Definition: item_geofunc.h:403
double m_max_longitude
The maximum allowed longitude (inclusive).
Definition: item_geofunc.h:462
double m_max_latitude
The maximum allowed latitude (inclusive).
Definition: item_geofunc.h:466
Item_func_geomfromgeojson(const POS &pos, Item *json_string, Item *options)
Definition: item_geofunc.h:393
static const char * CRS84_URN
Definition: item_geofunc.h:434
Geometry::wkbType get_wkbtype(const char *typestring)
Converts GeoJSON type string to a wkbType.
Definition: item_geofunc.cc:1623
static bool check_argument_valid_integer(Item *argument)
Checks if the supplied argument is a valid integer type.
Definition: item_geofunc.cc:1833
bool get_polygon(const Json_array *data_array, Gis_polygon *polygon)
Create a Gis_polygon from a JSON array.
Definition: item_geofunc.cc:1545
static const char * MULTIPOINT_TYPE
Definition: item_geofunc.h:436
Item_func_geomfromgeojson(const POS &pos, Item *json_string, Item *options, Item *srid)
Definition: item_geofunc.h:397
static const char * POINT_TYPE
Definition: item_geofunc.h:435
static const char * CRS_MEMBER
Definition: item_geofunc.h:424
bool fix_fields(THD *, Item **ref) override
Do type checking on all provided arguments.
Definition: item_geofunc.cc:1855
static const char * NAMED_CRS
Definition: item_geofunc.h:431
static const char * PROPERTIES_MEMBER
Definition: item_geofunc.h:426
Item_func_geomfromgeojson(const POS &pos, Item *json_string)
Definition: item_geofunc.h:388
static const char * GEOMETRYCOLLECTION_TYPE
Definition: item_geofunc.h:441
enum_handle_coordinate_dimension
Describing how coordinate dimensions higher than supported in MySQL should be handled.
Definition: item_geofunc.h:382
@ strip_now_reject_future
Definition: item_geofunc.h:385
@ reject_document
Definition: item_geofunc.h:383
@ strip_now_accept_future
Definition: item_geofunc.h:384
@ strip_now_strip_future
Definition: item_geofunc.h:386
static const char * FEATURES_MEMBER
Definition: item_geofunc.h:427
static const char * POLYGON_TYPE
Definition: item_geofunc.h:439
static const char * MULTILINESTRING_TYPE
Definition: item_geofunc.h:438
static const char * GEOMETRY_MEMBER
Definition: item_geofunc.h:425
Definition: item_geofunc.h:1356
longlong val_int() override
Definition: item_geofunc.cc:4781
Item_func_isclosed(const POS &pos, Item *a)
Definition: item_geofunc.h:1358
optimize_type select_optimize(const THD *) override
Definition: item_geofunc.h:1360
const char * func_name() const override
Definition: item_geofunc.h:1361
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1362
Definition: item_geofunc.h:1332
Item_func_isempty(const POS &pos, Item *a)
Definition: item_geofunc.h:1334
optimize_type select_optimize(const THD *) override
Definition: item_geofunc.h:1336
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1338
longlong val_int() override
Definition: item_geofunc.cc:4717
const char * func_name() const override
Definition: item_geofunc.h:1337
Definition: item_geofunc.h:1369
Item_func_isvalid(const POS &pos, Item *a)
Definition: item_geofunc.h:1371
optimize_type select_optimize(const THD *) override
Definition: item_geofunc.h:1373
const char * func_name() const override
Definition: item_geofunc.h:1374
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1375
longlong val_int() override
Definition: item_geofunc.cc:4803
This handles the <double> = ST_LATFROMGEOHASH(<string>) function.
Definition: item_geofunc.h:675
const char * func_name() const override
Definition: item_geofunc.h:681
Item_func_latfromgeohash(const POS &pos, Item *a)
Definition: item_geofunc.h:677
This is a superclass for Item_func_longfromgeohash and Item_func_latfromgeohash, since they share alm...
Definition: item_geofunc.h:615
const double lower_latitude
The lower limit for latitude output value.
Definition: item_geofunc.h:621
bool fix_fields(THD *thd, Item **ref) override
Definition: item_geofunc.cc:2882
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.cc:2876
Item_func_latlongfromgeohash(const POS &pos, Item *a, double lower_latitude, double upper_latitude, double lower_longitude, double upper_longitude, bool start_on_even_bit_arg)
Definition: item_geofunc.h:649
const bool start_on_even_bit
If this is set to true the algorithm will start decoding on the first bit, which decodes a longitude ...
Definition: item_geofunc.h:646
static bool decode_geohash(String *geohash, double upper_latitude, double lower_latitude, double upper_longitude, double lower_longitude, double *result_latitude, double *result_longitude)
Decodes a geohash string into longitude and latitude.
Definition: item_geofunc.cc:2947
const double upper_longitude
The upper limit for longitude output value.
Definition: item_geofunc.h:639
static double round_latlongitude(double latlongitude, double error_range, double lower_limit, double upper_limit)
Rounds a latitude or longitude value.
Definition: item_geofunc.cc:3061
static bool check_geohash_argument_valid_type(Item *item)
Checks if geohash arguments is of valid type.
Definition: item_geofunc.cc:2906
const double upper_latitude
The upper limit for latitude output value.
Definition: item_geofunc.h:627
const double lower_longitude
The lower limit for longitude output value.
Definition: item_geofunc.h:633
double val_real() override
Decodes a geohash into longitude if start_on_even_bit == true, or latitude if start_on_even_bit == fa...
Definition: item_geofunc.cc:3104
Definition: item_geofunc.h:1772
Item_func_lineinterpolate(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1774
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1781
String * val_str(String *str) override
Definition: item_geofunc.cc:5887
virtual bool returnMultiplePoints() const =0
virtual bool isFractionalDistance() const =0
Definition: item_geofunc.h:1788
bool isFractionalDistance() const override
Definition: item_geofunc.h:1795
Item_func_lineinterpolatepoint(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1790
const char * func_name() const override
Definition: item_geofunc.h:1794
bool returnMultiplePoints() const override
Definition: item_geofunc.h:1796
Definition: item_geofunc.h:1799
bool isFractionalDistance() const override
Definition: item_geofunc.h:1806
const char * func_name() const override
Definition: item_geofunc.h:1805
Item_func_lineinterpolatepoints(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1801
bool returnMultiplePoints() const override
Definition: item_geofunc.h:1807
This handles the <double> = ST_LONGFROMGEOHASH(<string>) function.
Definition: item_geofunc.h:688
Item_func_longfromgeohash(const POS &pos, Item *a)
Definition: item_geofunc.h:690
const char * func_name() const override
Definition: item_geofunc.h:694
Definition: item_geofunc.h:743
String * val_str(String *) override
Definition: item_geofunc.cc:3425
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:750
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:3421
Item_func_make_envelope(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:745
const char * func_name() const override
Definition: item_geofunc.h:747
Definition: item_geofunc.h:1070
Item_func_mbrcontains(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1072
enum Functype functype() const override
Definition: item_geofunc.h:1074
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:154
enum Functype rev_functype() const override
Definition: item_geofunc.h:1075
const char * func_name() const override
Definition: item_geofunc.h:1076
Definition: item_geofunc.h:1081
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:161
enum Functype rev_functype() const override
Definition: item_geofunc.h:1086
Item_func_mbrcoveredby(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1083
enum Functype functype() const override
Definition: item_geofunc.h:1085
const char * func_name() const override
Definition: item_geofunc.h:1087
Definition: item_geofunc.h:1092
enum Functype rev_functype() const override
Definition: item_geofunc.h:1097
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:168
Item_func_mbrcovers(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1094
enum Functype functype() const override
Definition: item_geofunc.h:1096
const char * func_name() const override
Definition: item_geofunc.h:1098
Definition: item_geofunc.h:1103
enum Functype functype() const override
Definition: item_geofunc.h:1107
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:174
const char * func_name() const override
Definition: item_geofunc.h:1109
Item_func_mbrdisjoint(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1105
enum Functype rev_functype() const override
Definition: item_geofunc.h:1108
Definition: item_geofunc.h:1114
Item_func_mbrequals(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1116
enum Functype functype() const override
Definition: item_geofunc.h:1118
const char * func_name() const override
Definition: item_geofunc.h:1120
enum Functype rev_functype() const override
Definition: item_geofunc.h:1119
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:181
Definition: item_geofunc.h:1125
enum Functype functype() const override
Definition: item_geofunc.h:1129
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:187
enum Functype rev_functype() const override
Definition: item_geofunc.h:1130
Item_func_mbrintersects(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1127
const char * func_name() const override
Definition: item_geofunc.h:1131
Definition: item_geofunc.h:1136
enum Functype functype() const override
Definition: item_geofunc.h:1140
Item_func_mbroverlaps(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1138
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:194
const char * func_name() const override
Definition: item_geofunc.h:1142
enum Functype rev_functype() const override
Definition: item_geofunc.h:1141
Definition: item_geofunc.h:1147
const char * func_name() const override
Definition: item_geofunc.h:1153
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:201
Item_func_mbrtouches(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1149
enum Functype functype() const override
Definition: item_geofunc.h:1151
enum Functype rev_functype() const override
Definition: item_geofunc.h:1152
Definition: item_geofunc.h:1158
const char * func_name() const override
Definition: item_geofunc.h:1164
Item_func_mbrwithin(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1160
enum Functype functype() const override
Definition: item_geofunc.h:1162
enum Functype rev_functype() const override
Definition: item_geofunc.h:1163
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:208
Definition: item_geofunc.h:1576
longlong val_int() override
Definition: item_geofunc.cc:4882
String value
Definition: item_geofunc.h:1577
const char * func_name() const override
Definition: item_geofunc.h:1582
Item_func_numgeometries(const POS &pos, Item *a)
Definition: item_geofunc.h:1580
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1583
Definition: item_geofunc.h:1591
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1598
Item_func_numinteriorring(const POS &pos, Item *a)
Definition: item_geofunc.h:1595
const char * func_name() const override
Definition: item_geofunc.h:1597
String value
Definition: item_geofunc.h:1592
longlong val_int() override
Definition: item_geofunc.cc:4863
Definition: item_geofunc.h:1606
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1613
longlong val_int() override
Definition: item_geofunc.cc:4901
String value
Definition: item_geofunc.h:1607
const char * func_name() const override
Definition: item_geofunc.h:1612
Item_func_numpoints(const POS &pos, Item *a)
Definition: item_geofunc.h:1610
Definition: item_geofunc.h:785
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:792
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:4212
String * val_str(String *) override
Definition: item_geofunc.cc:4216
const char * func_name() const override
Definition: item_geofunc.h:789
Item_func_point(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:787
This handles the <point> = ST_POINTFROMGEOHASH(<string>, <srid>) function.
Definition: item_geofunc.h:806
const double upper_latitude
The maximum output latitude value when decoding the geohash value.
Definition: item_geofunc.h:809
const double lower_longitude
The minimum output longitude value when decoding the geohash value.
Definition: item_geofunc.h:818
const double lower_latitude
The minimum output latitude value when decoding the geohash value.
Definition: item_geofunc.h:812
String * val_str(String *) override
Definition: item_geofunc.cc:4301
Item_func_pointfromgeohash(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:821
const char * func_name() const override
Definition: item_geofunc.h:827
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.cc:4295
const double upper_longitude
The maximum output longitude value when decoding the geohash value.
Definition: item_geofunc.h:815
bool fix_fields(THD *thd, Item **ref) override
This will check if arguments passed (geohash and SRID) are of valid types.
Definition: item_geofunc.cc:4249
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.h:831
Definition: item_geofunc.h:894
Item_func_spatial_collection(const POS &pos, PT_item_list *list, enum Geometry::wkbType ct, enum Geometry::wkbType it)
Definition: item_geofunc.h:900
enum Geometry::wkbType item_type
Definition: item_geofunc.h:897
String tmp_value
Definition: item_geofunc.h:895
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:908
enum Geometry::wkbType coll_type
Definition: item_geofunc.h:896
String * val_str(String *) override
Concatenates various items into various collections with checkings for valid wkb type of items.
Definition: item_geofunc.cc:4384
const char * func_name() const override
Definition: item_geofunc.cc:4344
Definition: item_geofunc.h:864
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:866
const char * func_name() const override
Definition: item_geofunc.h:878
String * val_str(String *) override
Definition: item_geofunc.cc:4155
Item_func_spatial_decomp_n(const POS &pos, Item *a, Item *b, Item_func::Functype ft)
Definition: item_geofunc.h:873
enum Functype decomp_func_n
Definition: item_geofunc.h:865
Definition: item_geofunc.h:836
enum Functype decomp_func
Definition: item_geofunc.h:837
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:838
Item_func_spatial_decomp(const POS &pos, Item *a, Item_func::Functype ft)
Definition: item_geofunc.h:844
String * val_str(String *) override
Definition: item_geofunc.cc:4111
const char * func_name() const override
Definition: item_geofunc.h:848
Definition: item_geofunc.h:930
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.h:957
enum Functype rev_functype() const override
Definition: item_geofunc.h:945
enum Functype spatial_rel
Definition: item_geofunc.h:931
enum Functype functype() const override
Definition: item_geofunc.h:944
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:961
Item_func_spatial_mbr_rel(Item *a, Item *b, enum Functype sp_rel)
Definition: item_geofunc.h:934
Item_func_spatial_mbr_rel(const POS &pos, Item *a, Item *b, enum Functype sp_rel)
Definition: item_geofunc.h:938
const char * func_name() const override
longlong val_int() override
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_geofunc.h:965
Spatial operations.
Definition: item_geofunc.h:1205
Item_func_spatial_operation(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1207
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1211
Definition: item_geofunc.h:971
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_geofunc.h:988
longlong val_int() override
Definition: item_geofunc_relchecks.cc:67
virtual bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null)=0
Evaluate the spatial relation function.
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.h:983
Item_func_spatial_relation(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:973
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:975
Definition: item_geofunc.h:1621
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1626
double val_real() override
Definition: item_geofunc.cc:5103
const char * func_name() const override
Definition: item_geofunc.h:1625
Item_func_st_area(const POS &pos, Item *a)
Definition: item_geofunc.h:1623
Definition: item_geofunc.h:1634
Item_func_st_buffer(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1639
String * val_str(String *) override
Definition: item_geofunc.cc:5154
const char * func_name() const override
Definition: item_geofunc.h:1643
bool parse_strategy(String *arg, gis::BufferStrategies &strats)
Parses strategy stored in String object, and sets values in strats.
Definition: item_geofunc.cc:5212
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1644
Definition: item_geofunc.h:1015
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:120
const char * func_name() const override
Definition: item_geofunc.h:1021
enum Functype rev_functype() const override
Definition: item_geofunc.h:1020
Item_func_st_contains(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1017
enum Functype functype() const override
Definition: item_geofunc.h:1019
Definition: item_geofunc.h:1026
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:127
enum Functype rev_functype() const override
Definition: item_geofunc.h:1031
enum Functype functype() const override
Definition: item_geofunc.h:1030
const char * func_name() const override
Definition: item_geofunc.h:1032
Item_func_st_crosses(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1028
Definition: item_geofunc.h:1217
String * val_str(String *) override
Definition: item_geofunc.cc:5602
Item_func_st_difference(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1219
const char * func_name() const override
Definition: item_geofunc.h:1222
Definition: item_geofunc.h:1037
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:134
enum Functype functype() const override
Definition: item_geofunc.h:1041
Item_func_st_disjoint(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1039
enum Functype rev_functype() const override
Definition: item_geofunc.h:1042
const char * func_name() const override
Definition: item_geofunc.h:1043
Definition: item_geofunc.h:1758
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1764
Item_func_st_distance_sphere(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1760
const char * func_name() const override
Definition: item_geofunc.h:1763
double val_real() override
Definition: item_geofunc.cc:5734
Definition: item_geofunc.h:1048
enum Functype rev_functype() const override
Definition: item_geofunc.h:1053
enum Functype functype() const override
Definition: item_geofunc.h:1052
const char * func_name() const override
Definition: item_geofunc.h:1054
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:141
Item_func_st_equals(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1050
Definition: item_geofunc.h:1730
Item_func_st_frechet_distance(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1732
const char * func_name() const override
Definition: item_geofunc.h:1735
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1736
double val_real() override
Definition: item_geofunc.cc:5474
Definition: item_geofunc.h:1744
Item_func_st_hausdorff_distance(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1746
const char * func_name() const override
Definition: item_geofunc.h:1749
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1750
double val_real() override
Definition: item_geofunc.cc:5538
Definition: item_geofunc.h:1225
String * val_str(String *) override
Definition: item_geofunc.cc:5831
const char * func_name() const override
Definition: item_geofunc.h:1230
Item_func_st_intersection(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1227
Definition: item_geofunc.h:1059
enum Functype functype() const override
Definition: item_geofunc.h:1063
enum Functype rev_functype() const override
Definition: item_geofunc.h:1064
Item_func_st_intersects(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1061
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:147
const char * func_name() const override
Definition: item_geofunc.h:1065
Definition: item_geofunc.h:1345
longlong val_int() override
Definition: item_geofunc.cc:4735
const char * func_name() const override
Definition: item_geofunc.h:1349
Item_func_st_issimple(const POS &pos, Item *a)
Definition: item_geofunc.h:1347
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1350
This class implements the two-parameter ST_Latitude function which sets the latitude of a geographic ...
Definition: item_geofunc.h:1459
Item_func_st_latitude_mutator(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1461
const char * func_name() const override
Definition: item_geofunc.h:1465
int coordinate_number(const dd::Spatial_reference_system *) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.h:1466
This class implements the one-parameter ST_Latitude function which returns the latitude coordinate of...
Definition: item_geofunc.h:1474
Item_func_st_latitude_observer(const POS &pos, Item *a)
Definition: item_geofunc.h:1476
const char * func_name() const override
Definition: item_geofunc.h:1480
int coordinate_number(const dd::Spatial_reference_system *) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.h:1481
Definition: item_geofunc.h:1653
const char * func_name() const override
Definition: item_geofunc.h:1660
String value
Definition: item_geofunc.h:1654
Item_func_st_length(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1657
double val_real() override
Definition: item_geofunc.cc:5333
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1661
This class implements the two-parameter ST_Longitude function which sets the longitude coordinate of ...
Definition: item_geofunc.h:1489
Item_func_st_longitude_mutator(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1491
const char * func_name() const override
Definition: item_geofunc.h:1495
int coordinate_number(const dd::Spatial_reference_system *) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.h:1496
This class implements the one-parameter ST_Longitude function which returns the longitude coordinate ...
Definition: item_geofunc.h:1504
int coordinate_number(const dd::Spatial_reference_system *) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.h:1511
Item_func_st_longitude_observer(const POS &pos, Item *a)
Definition: item_geofunc.h:1506
const char * func_name() const override
Definition: item_geofunc.h:1510
Definition: item_geofunc.h:1169
Item_func_st_overlaps(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1171
enum Functype functype() const override
Definition: item_geofunc.h:1173
enum Functype rev_functype() const override
Definition: item_geofunc.h:1174
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:214
const char * func_name() const override
Definition: item_geofunc.h:1175
Definition: item_geofunc.h:1810
Item_func_st_pointatdistance(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1812
bool returnMultiplePoints() const override
Definition: item_geofunc.h:1818
bool isFractionalDistance() const override
Definition: item_geofunc.h:1817
const char * func_name() const override
Definition: item_geofunc.h:1816
Item that implements function ST_Simplify, which simplifies a geometry using the Douglas-Peucker algo...
Definition: item_geofunc.h:771
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:775
String * val_str(String *) override
Definition: item_geofunc.cc:4064
Item_func_st_simplify(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:773
const char * func_name() const override
Definition: item_geofunc.h:782
This class implements the two-parameter ST_SRID function which sets the SRID of a geometry.
Definition: item_geofunc.h:1672
String * val_str(String *) override
Definition: item_geofunc.cc:5428
const char * func_name() const override
Definition: item_geofunc.h:1677
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1678
Item_func_st_srid_mutator(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1674
This class implements the one-parameter ST_SRID function which returns the SRID of a geometry.
Definition: item_geofunc.h:1687
Item_func_st_srid_observer(const POS &pos, Item *a)
Definition: item_geofunc.h:1689
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1692
const char * func_name() const override
Definition: item_geofunc.h:1691
longlong val_int() override
Definition: item_geofunc.cc:5388
Definition: item_geofunc.h:1233
String * val_str(String *) override
Definition: item_geofunc.cc:5958
Item_func_st_symdifference(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1235
const char * func_name() const override
Definition: item_geofunc.h:1238
Definition: item_geofunc.h:1180
enum Functype functype() const override
Definition: item_geofunc.h:1184
Item_func_st_touches(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1182
enum Functype rev_functype() const override
Definition: item_geofunc.h:1185
const char * func_name() const override
Definition: item_geofunc.h:1186
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:221
This class implements ST_Transform function that transforms a geometry from one SRS to another.
Definition: item_geofunc.h:1823
const char * func_name() const override
Definition: item_geofunc.h:1830
String * val_str(String *str) override
Definition: item_geofunc.cc:6023
Item_func_st_transform(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1825
Definition: item_geofunc.h:1241
Item_func_st_union(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1243
String * val_str(String *) override
Definition: item_geofunc.cc:4652
const char * func_name() const override
Definition: item_geofunc.h:1246
Definition: item_geofunc.h:1191
bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1, const gis::Geometry *g2, bool *result, bool *null) override
Evaluate the spatial relation function.
Definition: item_geofunc_relchecks.cc:228
enum Functype rev_functype() const override
Definition: item_geofunc.h:1196
enum Functype functype() const override
Definition: item_geofunc.h:1195
Item_func_st_within(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1193
const char * func_name() const override
Definition: item_geofunc.h:1197
This class implements the two-parameter ST_X function which sets the X coordinate of a point.
Definition: item_geofunc.h:1518
int coordinate_number(const dd::Spatial_reference_system *srs) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.cc:5046
Item_func_st_x_mutator(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1520
const char * func_name() const override
Definition: item_geofunc.h:1524
This class implements the one-parameter ST_X function which returns the X coordinate of a point.
Definition: item_geofunc.h:1530
int coordinate_number(const dd::Spatial_reference_system *srs) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.cc:5052
Item_func_st_x_observer(const POS &pos, Item *a)
Definition: item_geofunc.h:1532
const char * func_name() const override
Definition: item_geofunc.h:1536
This class implements the two-parameter ST_Y function which sets the Y coordinate of a point.
Definition: item_geofunc.h:1542
int coordinate_number(const dd::Spatial_reference_system *srs) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.cc:5058
const char * func_name() const override
Definition: item_geofunc.h:1548
Item_func_st_y_mutator(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1544
This class implements the one-parameter ST_Y function which returns the Y coordinate of a point.
Definition: item_geofunc.h:1554
int coordinate_number(const dd::Spatial_reference_system *srs) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.cc:5064
const char * func_name() const override
Definition: item_geofunc.h:1560
Item_func_st_y_observer(const POS &pos, Item *a)
Definition: item_geofunc.h:1556
Definition: item_geofunc.h:1564
const char * func_name() const override
Definition: item_geofunc.h:1572
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1565
String * val_str(String *) override
Definition: item_geofunc.cc:5070
Item_func_swap_xy(const POS &pos, Item *a)
Definition: item_geofunc.h:1571
Definition: item_geofunc.h:756
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:762
String * val_str(String *) override
Definition: item_geofunc.cc:3381
const char * func_name() const override
Definition: item_geofunc.h:761
Item_func_validate(const POS &pos, Item *a)
Definition: item_geofunc.h:760
String arg_val
Definition: item_geofunc.h:757
Item ** args
Array of pointers to arguments.
Definition: item_func.h:100
virtual enum Functype functype() const
Definition: item_func.h:306
Functype
Definition: item_func.h:178
@ SP_CROSSES_FUNC
Definition: item_func.h:205
@ SP_EXTERIORRING
Definition: item_func.h:213
@ SP_EQUALS_FUNC
Definition: item_func.h:201
@ SP_COVEREDBY_FUNC
Definition: item_func.h:208
@ SP_TOUCHES_FUNC
Definition: item_func.h:204
@ SP_DISJOINT_FUNC
Definition: item_func.h:202
@ SP_STARTPOINT
Definition: item_func.h:211
@ SP_POINTN
Definition: item_func.h:214
@ SP_GEOMETRYN
Definition: item_func.h:215
@ TYPECAST_FUNC
Definition: item_func.h:225
@ SP_WITHIN_FUNC
Definition: item_func.h:206
@ SP_INTERIORRINGN
Definition: item_func.h:216
@ SP_INTERSECTS_FUNC
Definition: item_func.h:203
@ SP_COVERS_FUNC
Definition: item_func.h:209
@ SP_CONTAINS_FUNC
Definition: item_func.h:207
@ SP_ENDPOINT
Definition: item_func.h:212
@ SP_OVERLAPS_FUNC
Definition: item_func.h:210
optimize_type
Definition: item_func.h:298
@ OPTIMIZE_NONE
Definition: item_func.h:299
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:591
enum Type type() const override
Definition: item_func.h:305
bool param_type_is_default(THD *thd, uint start, uint end, uint step, enum_field_types def)
For arguments of this Item_func ("args" array), in range [start, start+step, start+2*step,...
Definition: item_func.cc:516
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:720
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:123
Definition: item_geofunc.h:180
Field * tmp_table_field(TABLE *t_arg) override
Definition: item_geofunc.cc:296
Item_geometry_func(Item *a, Item *b)
Definition: item_geofunc.h:187
Item_geometry_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_geofunc.h:192
Item_geometry_func(Item *a)
Definition: item_geofunc.h:184
Item_geometry_func(Item *a, Item *b, Item *c)
Definition: item_geofunc.h:191
Item_geometry_func(const POS &pos, Item *a)
Definition: item_geofunc.h:185
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.cc:305
Item_geometry_func()
Definition: item_geofunc.h:182
Item_geometry_func(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:188
Definition: item_func.h:895
Base class for all item functions that a return JSON value.
Definition: item_json_func.h:149
Definition: item_func.h:707
Definition: item_strfunc.h:141
Definition: item_strfunc.h:75
Definition: item_geofunc.h:1834
const char * func_name() const override=0
enum Functype functype() const override
Definition: item_geofunc.h:1842
Item_typecast_geometry(const POS &pos, Item *a)
Definition: item_geofunc.h:1836
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1844
String * val_str(String *str) override
Definition: item_geofunc.cc:6091
virtual bool cast(const dd::Spatial_reference_system *srs, std::unique_ptr< gis::Geometry > *source_geometry, std::unique_ptr< gis::Geometry > *target_geometry) const =0
Casts certain geometry types to certain target geometry types.
void print(const THD *thd, String *str, enum_query_type query_type) const override=0
This method is used for to:
Field::geometry_type get_geometry_type() const override=0
Definition: item_geofunc.h:1950
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:7030
bool cast(const dd::Spatial_reference_system *, std::unique_ptr< gis::Geometry > *source_geometry, std::unique_ptr< gis::Geometry > *target_geometry) const override
Casts certain geometry types to certain target geometry types.
Definition: item_geofunc.cc:6975
const char * func_name() const override
Definition: item_geofunc.h:1956
Item_typecast_geometrycollection(const POS &pos, Item *a)
Definition: item_geofunc.h:1952
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:7025
Definition: item_geofunc.h:1879
Item_typecast_linestring(const POS &pos, Item *a)
Definition: item_geofunc.h:1881
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6333
bool cast(const dd::Spatial_reference_system *, std::unique_ptr< gis::Geometry > *source_geometry, std::unique_ptr< gis::Geometry > *target_geometry) const override
Casts certain geometry types to certain target geometry types.
Definition: item_geofunc.cc:6212
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6329
const char * func_name() const override
Definition: item_geofunc.h:1885
Definition: item_geofunc.h:1921
Item_typecast_multilinestring(const POS &pos, Item *a)
Definition: item_geofunc.h:1923
bool cast(const dd::Spatial_reference_system *, std::unique_ptr< gis::Geometry > *source_geometry, std::unique_ptr< gis::Geometry > *target_geometry) const override
Casts certain geometry types to certain target geometry types.
Definition: item_geofunc.cc:6666
const char * func_name() const override
Definition: item_geofunc.h:1927
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6803
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6799
Definition: item_geofunc.h:1907
Item_typecast_multipoint(const POS &pos, Item *a)
Definition: item_geofunc.h:1909
const char * func_name() const override
Definition: item_geofunc.h:1913
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6659
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6655
bool cast(const dd::Spatial_reference_system *, std::unique_ptr< gis::Geometry > *source_geometry, std::unique_ptr< gis::Geometry > *target_geometry) const override
Casts certain geometry types to certain target geometry types.
Definition: item_geofunc.cc:6565
Definition: item_geofunc.h:1935
Item_typecast_multipolygon(const POS &pos, Item *a)
Definition: item_geofunc.h:1937
const char * func_name() const override
Definition: item_geofunc.h:1941
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6968
bool cast(const dd::Spatial_reference_system *srs, std::unique_ptr< gis::Geometry > *source_geometry, std::unique_ptr< gis::Geometry > *target_geometry) const override
Casts certain geometry types to certain target geometry types.
Definition: item_geofunc.cc:6810
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6964
Definition: item_geofunc.h:1865
bool cast(const dd::Spatial_reference_system *, std::unique_ptr< gis::Geometry > *source_geometry, std::unique_ptr< gis::Geometry > *target_geometry) const override
Casts certain geometry types to certain target geometry types.
Definition: item_geofunc.cc:6139
const char * func_name() const override
Definition: item_geofunc.h:1871
Item_typecast_point(const POS &pos, Item *a)
Definition: item_geofunc.h:1867
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6205
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6201
Definition: item_geofunc.h:1893
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6554
const char * func_name() const override
Definition: item_geofunc.h:1899
Item_typecast_polygon(const POS &pos, Item *a)
Definition: item_geofunc.h:1895
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6558
bool cast(const dd::Spatial_reference_system *srs, std::unique_ptr< gis::Geometry > *source_geometry, std::unique_ptr< gis::Geometry > *target_geometry) const override
Casts certain geometry types to certain target geometry types.
Definition: item_geofunc.cc:6340
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:802
void set_nullable(bool nullable)
Definition: item.h:3344
static const CHARSET_INFO * default_charset()
Definition: item.cc:1599
void set_data_type_blob(uint32 max_l)
Set the Item to be of BLOB type.
Definition: item.h:1469
virtual void print(const THD *, String *str, enum_query_type) const
This method is used for to:
Definition: item.h:2227
enum_field_types data_type() const
Retrieve the derived data type of the Item.
Definition: item.h:1297
bool fixed
True if item has been resolved.
Definition: item.h:3332
bool null_value
True if item is null.
Definition: item.h:3369
void set_data_type_string(uint32 max_l)
Set the Item to be variable length string.
Definition: item.h:1387
uint32 max_length
Maximum length of result of evaluating this item, in number of bytes.
Definition: item.h:3286
Represents a JSON array container, i.e.
Definition: json_dom.h:520
JSON DOM abstract base class.
Definition: json_dom.h:171
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:369
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1167
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:101
void error(Context *pc, const POS &pos) const
syntax_error() function replacement for deferred reporting of syntax errors
Definition: parse_tree_node_base.h:169
size_type erase_unique(const value_type &val)
Similar to std::set<>::erase() Removes a single element from the array by value.
Definition: prealloced_array.h:440
void clear()
Removes (and destroys) all elements.
Definition: prealloced_array.h:600
void * * iterator
Definition: prealloced_array.h:115
iterator begin()
begin : Returns a pointer to the first element in the array.
Definition: prealloced_array.h:253
std::pair< iterator, bool > insert_unique(const value_type &val)
Similar to std::set<>::insert() Extends the array by inserting a new element, but only if it cannot b...
Definition: prealloced_array.h:420
iterator end()
Definition: prealloced_array.h:254
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:945
Definition: spatial_reference_system.h:52
Abstract superclass for all geometric objects.
Definition: geometries.h:99
char * pos
Definition: do_ctype.cc:76
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:30
@ QT_NO_DATA_EXPANSION
If an expression is constant, print the expression, not the value it evaluates to.
Definition: enum_query_type.h:75
Fido Client Authentication nullptr
Definition: fido_client_plugin.cc:221
This file contains the field type.
@ MYSQL_TYPE_LONGLONG
Definition: field_types.h:65
@ MYSQL_TYPE_GEOMETRY
Definition: field_types.h:90
@ MYSQL_TYPE_DOUBLE
Definition: field_types.h:62
void my_error(int nr, myf MyFlags,...)
Fill in and print a previously registered error message.
Definition: my_error.cc:215
static constexpr unsigned PSI_INSTRUMENT_ME
Definition: psi_bits.h:42
static const int MAX_CRS_WIDTH
Max width of long CRS URN supported + max width of SRID + '\0'.
Definition: item_geofunc.h:472
enum_json_type
Json values in MySQL comprises the stand set of JSON values plus a MySQL specific set.
Definition: json_dom.h:107
Some integer typedefs for easier portability.
long long int longlong
Definition: my_inttypes.h:54
#define MYF(v)
Definition: my_inttypes.h:96
uint32_t uint32
Definition: my_inttypes.h:66
Common header for many mysys elements.
Common definition between mysql server & client.
#define MAX_INT_WIDTH
Max width for a LONG w.o.
Definition: mysql_com.h:897
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1055
Definition: buf0block_hint.cc:29
PT & ref(PT *tp)
Definition: tablespace_impl.cc:358
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
Definition: area.cc:46
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
std::uint32_t srid_t
A spatial reference system ID (SRID).
Definition: srid.h:32
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:391
Definition: options.cc:48
Performance schema instrumentation interface.
void gis_wkb_raw_free(void *p)
Definition: spatial.h:212
static bool rollback(THD *thd)
Abort the current statement and transaction.
Definition: sql_cmd_srs.cc:139
Our own string classes, used pervasively throughout the executor.
Definition: item_geofunc.h:1288
enum_buffer_strategies strategy
Definition: item_geofunc.h:1289
double value
Definition: item_geofunc.h:1292
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:90
Definition: table.h:1394
Bison "location" class.
Definition: parse_location.h:42
Definition: buffer_strategies.h:44
Definition: result.h:29
Definition: dbug.cc:186
unsigned int uint
Definition: uca-dump.cc:29