MySQL 8.3.0
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, 2023, 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
173 private:
174 bool store_geometry(const Geometry *geo, bool break_multi_geom);
175 Geometry *store(const Geometry *geo);
176};
177
179 public:
181
183 Item_geometry_func(const POS &pos, Item *a) : Item_str_func(pos, a) {}
184
186 Item_geometry_func(const POS &pos, Item *a, Item *b)
187 : Item_str_func(pos, a, b) {}
188
190 Item_geometry_func(const POS &pos, Item *a, Item *b, Item *c)
191 : Item_str_func(pos, a, b, c) {}
193
194 bool resolve_type(THD *) override;
195 Field *tmp_table_field(TABLE *t_arg) override;
196};
197
199 public:
200 enum class Functype {
217 };
218
219 private:
222 /**
223 Get the type of geometry that this Item can return.
224
225 @return The geometry type
226 */
228 /**
229 Check if a geometry type is a valid return type for this Item.
230
231 @param type The type to check
232
233 @retval true The geometry type is allowed
234 @retval false The geometry type is not allowed
235 */
237
238 public:
243 : Item_geometry_func(pos, a, srid), m_functype(functype) {}
245 Item *option, Functype functype)
246 : Item_geometry_func(pos, a, srid, option), m_functype(functype) {}
247
248 bool do_itemize(Parse_context *pc, Item **res) override;
249 const char *func_name() const override;
250 String *val_str(String *) override;
251 bool resolve_type(THD *thd) override {
252 if (param_type_is_default(thd, 0, 1)) return true;
253 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
254 if (param_type_is_default(thd, 2, 3)) return true;
256 }
257};
258
260 public:
261 enum class Functype {
277 };
278
279 private:
283 /**
284 Get the type of geometry that this Item can return.
285
286 @return The geometry type
287 */
289 /**
290 Check if a geometry type is a valid return type for this Item.
291
292 @param type The type to check
293
294 @retval true The geometry type is allowed
295 @retval false The geometry type is not allowed
296 */
298 bool resolve_type(THD *thd) override {
299 if (param_type_is_default(thd, 0, 1)) return true;
300 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
301 if (param_type_is_default(thd, 2, 3)) return true;
303 }
304
305 public:
310 : Item_geometry_func(pos, a, srid), m_functype(functype) {}
311 Item_func_geometry_from_wkb(const POS &pos, Item *a, Item *srid, Item *option,
313 : Item_geometry_func(pos, a, srid, option), m_functype(functype) {}
314
315 bool do_itemize(Parse_context *pc, Item **res) override;
316 const char *func_name() const override;
317 String *val_str(String *) override;
318};
319
321 public:
322 Item_func_as_wkt(const POS &pos, Item *a) : Item_str_ascii_func(pos, a) {}
323 Item_func_as_wkt(const POS &pos, Item *a, Item *b)
324 : Item_str_ascii_func(pos, a, b) {}
325 const char *func_name() const override { return "st_astext"; }
326 String *val_str_ascii(String *) override;
327 bool resolve_type(THD *) override;
328};
329
331 public:
332 Item_func_as_wkb(const POS &pos, Item *a) : Item_geometry_func(pos, a) {}
333 Item_func_as_wkb(const POS &pos, Item *a, Item *b)
334 : Item_geometry_func(pos, a, b) {}
335 const char *func_name() const override { return "st_aswkb"; }
336 String *val_str(String *) override;
337 bool resolve_type(THD *thd) override {
338 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
339 if (param_type_is_default(thd, 1, 2)) return true;
340 if (Item_geometry_func::resolve_type(thd)) return true;
342 return false;
343 }
344};
345
347 public:
349 : Item_str_ascii_func(pos, a) {}
350 String *val_str_ascii(String *) override;
351 const char *func_name() const override { return "st_geometrytype"; }
352 bool resolve_type(THD *thd) override {
353 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
354 // "MultiLinestring" is the longest
356 set_nullable(true);
357 return false;
358 }
359};
360
361/**
362 This handles one function:
363
364 @<geometry@> = ST_GEOMFROMGEOJSON(@<string@>[, @<options@>[, @<srid@>]])
365
366 Options is an integer argument which determines how positions with higher
367 coordinate dimension than MySQL support should be handled. The function will
368 accept both single objects, geometry collections and feature objects and
369 collections. All "properties" members of GeoJSON feature objects is ignored.
370
371 The implementation conforms with GeoJSON revision 1.0 described at
372 http://geojson.org/geojson-spec.html.
373*/
375 public:
376 /**
377 Describing how coordinate dimensions higher than supported in MySQL
378 should be handled.
379 */
385 };
386 Item_func_geomfromgeojson(const POS &pos, Item *json_string)
387 : Item_geometry_func(pos, json_string),
391 Item_func_geomfromgeojson(const POS &pos, Item *json_string, Item *options)
392 : Item_geometry_func(pos, json_string, options),
395 Item_func_geomfromgeojson(const POS &pos, Item *json_string, Item *options,
396 Item *srid)
397 : Item_geometry_func(pos, json_string, options, srid),
399 String *val_str(String *) override;
400 bool fix_fields(THD *, Item **ref) override;
401 const char *func_name() const override { return "st_geomfromgeojson"; }
402 Geometry::wkbType get_wkbtype(const char *typestring);
403 bool get_positions(const Json_array *coordinates, Gis_point *point);
404 bool get_linestring(const Json_array *data_array,
405 Gis_line_string *linestring);
406 bool get_polygon(const Json_array *data_array, Gis_polygon *polygon);
407 bool parse_object(const Json_object *object, bool *rollback, String *buffer,
408 bool is_parent_featurecollection, Geometry **geometry);
410 bool *rollback, String *buffer,
411 bool is_parent_featurecollection,
412 Geometry **geometry);
413 static bool check_argument_valid_integer(Item *argument);
414 bool parse_crs_object(const Json_object *crs_object);
415 bool is_member_valid(const Json_dom *member, const char *member_name,
416 enum_json_type expected_type, bool allow_null,
417 bool *was_null);
418 const Json_dom *my_find_member_ncase(const Json_object *object,
419 const char *member_name);
420
421 static const char *TYPE_MEMBER;
422 static const char *CRS_MEMBER;
423 static const char *GEOMETRY_MEMBER;
424 static const char *PROPERTIES_MEMBER;
425 static const char *FEATURES_MEMBER;
426 static const char *GEOMETRIES_MEMBER;
427 static const char *COORDINATES_MEMBER;
428 static const char *CRS_NAME_MEMBER;
429 static const char *NAMED_CRS;
430 static const char *SHORT_EPSG_PREFIX;
431 static const char *LONG_EPSG_PREFIX;
432 static const char *CRS84_URN;
433 static const char *POINT_TYPE;
434 static const char *MULTIPOINT_TYPE;
435 static const char *LINESTRING_TYPE;
436 static const char *MULTILINESTRING_TYPE;
437 static const char *POLYGON_TYPE;
438 static const char *MULTIPOLYGON_TYPE;
439 static const char *GEOMETRYCOLLECTION_TYPE;
440 static const char *FEATURE_TYPE;
441 static const char *FEATURECOLLECTION_TYPE;
442
443 private:
444 /**
445 How higher coordinate dimensions than currently supported should be handled.
446 */
448 /// Is set to true if user provided a SRID as an argument.
450 /// The SRID user provided as an argument.
452 /**
453 The SRID value of the document CRS, if one is found. Otherwise, this value
454 defaults to -1.
455 */
457 /// The minimum allowed longitude value (non-inclusive).
458 double m_min_longitude = -180.0;
459 /// The maximum allowed longitude (inclusive).
460 double m_max_longitude = 180.0;
461 /// The minimum allowed latitude value (inclusive).
462 double m_min_latitude = -90.0;
463 /// The maximum allowed latitude (inclusive).
464 double m_max_latitude = 90.0;
465 /// True if we're currently parsing the top-level object.
466 bool m_toplevel = true;
467};
468
469/// Max width of long CRS URN supported + max width of SRID + '\0'.
470static const int MAX_CRS_WIDTH = (22 + MAX_INT_WIDTH + 1);
471
472/**
473 This class handles the following function:
474
475 @<json@> = ST_ASGEOJSON(@<geometry@>[, @<maxdecimaldigits@>[, @<options@>]])
476
477 It converts a GEOMETRY into a valid GeoJSON string. If maxdecimaldigits is
478 specified, the coordinates written are rounded to the number of decimals
479 specified (e.g with decimaldigits = 3: 10.12399 => 10.124).
480
481 Options is a bitmask with the following flags:
482 0 No options (default values).
483 1 Add a bounding box to the output.
484 2 Add a short CRS URN to the output. The default format is a
485 short format ("EPSG:<srid>").
486 4 Add a long format CRS URN ("urn:ogc:def:crs:EPSG::<srid>"). This
487 implies 2. This means that, e.g., bitmask 5 and 7 mean the
488 same: add a bounding box and a long format CRS URN.
489*/
491 private:
492 /// Maximum number of decimal digits in printed coordinates.
494 /// If true, the output GeoJSON has a bounding box for each GEOMETRY.
496 /**
497 If true, the output GeoJSON has a CRS object in the short
498 form (e.g "EPSG:4326").
499 */
501 /**
502 If true, the output GeoJSON has a CRS object in the long
503 form (e.g "urn:ogc:def:crs:EPSG::4326").
504 */
506 /// The SRID found in the input GEOMETRY.
508
509 public:
510 Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry)
511 : Item_json_func(thd, pos, geometry),
512 m_add_bounding_box(false),
513 m_add_short_crs_urn(false),
514 m_add_long_crs_urn(false) {}
515 Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry,
516 Item *maxdecimaldigits)
517 : Item_json_func(thd, pos, geometry, maxdecimaldigits),
518 m_add_bounding_box(false),
519 m_add_short_crs_urn(false),
520 m_add_long_crs_urn(false) {}
521 Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry,
522 Item *maxdecimaldigits, Item *options)
523 : Item_json_func(thd, pos, geometry, maxdecimaldigits, options),
524 m_add_bounding_box(false),
525 m_add_short_crs_urn(false),
526 m_add_long_crs_urn(false) {}
527 bool fix_fields(THD *thd, Item **ref) override;
528 bool val_json(Json_wrapper *wr) override;
529 const char *func_name() const override { return "st_asgeojson"; }
532};
533
534/**
535 This class handles two forms of the same function:
536
537 @<string@> = ST_GEOHASH(@<point@>, @<maxlength@>);
538 @<string@> = ST_GEOHASH(@<longitude@>, @<latitude@>, @<maxlength@>)
539
540 It returns an encoded geohash string, no longer than @<maxlength@> characters
541 long. Note that it might be shorter than @<maxlength@>.
542*/
544 private:
545 /// The latitude argument supplied by the user (directly or by a POINT).
546 double latitude;
547 /// The longitude argument supplied by the user (directly or by a POINT).
548 double longitude;
549 /// The maximum output length of the geohash, supplied by the user.
551
552 /**
553 The maximum input latitude. For now, this is set to 90.0. It can be
554 changed to support a different range than the normal [90, -90].
555 */
556 const double max_latitude;
557
558 /**
559 The minimum input latitude. For now, this is set to -90.0. It can be
560 changed to support a different range than the normal [90, -90].
561 */
562 const double min_latitude;
563
564 /**
565 The maximum input longitude. For now, this is set to 180.0. It can be
566 changed to support a different range than the normal [180, -180].
567 */
568 const double max_longitude;
569
570 /**
571 The minimum input longitude. For now, this is set to -180.0. It can be
572 changed to support a different range than the normal [180, -180].
573 */
574 const double min_longitude;
575
576 /**
577 The absolute upper limit of geohash output length. User will get an error
578 if they supply a max geohash length argument greater than this.
579 */
581
582 public:
583 Item_func_geohash(const POS &pos, Item *point, Item *length)
584 : Item_str_ascii_func(pos, point, length),
585 max_latitude(90.0),
586 min_latitude(-90.0),
587 max_longitude(180.0),
588 min_longitude(-180.0),
591 Item *length)
593 max_latitude(90.0),
594 min_latitude(-90.0),
595 max_longitude(180.0),
596 min_longitude(-180.0),
598 String *val_str_ascii(String *) override;
599 bool resolve_type(THD *) override;
600 bool fix_fields(THD *thd, Item **ref) override;
601 const char *func_name() const override { return "st_geohash"; }
602 char char_to_base32(char char_input);
603 void encode_bit(double *upper_value, double *lower_value, double target_value,
604 char *char_value, int bit_number);
607};
608
609/**
610 This is a superclass for Item_func_longfromgeohash and
611 Item_func_latfromgeohash, since they share almost all code.
612*/
614 private:
615 /**
616 The lower limit for latitude output value. Normally, this will be
617 set to -90.0.
618 */
619 const double lower_latitude;
620
621 /**
622 The upper limit for latitude output value. Normally, this will be
623 set to 90.0.
624 */
625 const double upper_latitude;
626
627 /**
628 The lower limit for longitude output value. Normally, this will
629 be set to -180.0.
630 */
631 const double lower_longitude;
632
633 /**
634 The upper limit for longitude output value. Normally, this will
635 be set to 180.0.
636 */
637 const double upper_longitude;
638
639 /**
640 If this is set to true the algorithm will start decoding on the first bit,
641 which decodes a longitude value. If it is false, it will start on the
642 second bit which decodes a latitude value.
643 */
645
646 public:
648 double upper_latitude, double lower_longitude,
649 double upper_longitude,
650 bool start_on_even_bit_arg)
651 : Item_real_func(pos, a),
656 start_on_even_bit(start_on_even_bit_arg) {}
657 double val_real() override;
658 bool resolve_type(THD *thd) override;
659 bool fix_fields(THD *thd, Item **ref) override;
660 static bool decode_geohash(String *geohash, double upper_latitude,
661 double lower_latitude, double upper_longitude,
662 double lower_longitude, double *result_latitude,
663 double *result_longitude);
664 static double round_latlongitude(double latlongitude, double error_range,
665 double lower_limit, double upper_limit);
666 static bool check_geohash_argument_valid_type(Item *item);
667};
668
669/**
670 This handles the @<double@> = ST_LATFROMGEOHASH(@<string@>) function.
671 It returns the latitude-part of a geohash, in the range of [-90, 90].
672*/
674 public:
676 : Item_func_latlongfromgeohash(pos, a, -90.0, 90.0, -180.0, 180.0,
677 false) {}
678
679 const char *func_name() const override { return "ST_LATFROMGEOHASH"; }
680};
681
682/**
683 This handles the @<double@> = ST_LONGFROMGEOHASH(@<string@>) function.
684 It returns the longitude-part of a geohash, in the range of [-180, 180].
685*/
687 public:
689 : Item_func_latlongfromgeohash(pos, a, -90.0, 90.0, -180.0, 180.0, true) {
690 }
691
692 const char *func_name() const override { return "ST_LONGFROMGEOHASH"; }
693};
694
697
698 template <typename Coordsys>
699 bool bg_centroid(const Geometry *geom, String *ptwkb);
700
701 public:
702 Item_func_centroid(const POS &pos, Item *a) : Item_geometry_func(pos, a) {}
703 const char *func_name() const override { return "st_centroid"; }
704 String *val_str(String *) override;
706 bool resolve_type(THD *thd) override {
707 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
709 }
710};
711
714
715 template <typename Coordsys>
716 bool bg_convex_hull(const Geometry *geom, String *wkb);
717
718 public:
720 const char *func_name() const override { return "st_convexhull"; }
721 String *val_str(String *) override;
723 bool resolve_type(THD *thd) override {
724 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
726 }
727};
728
730 public:
731 Item_func_envelope(const POS &pos, Item *a) : Item_geometry_func(pos, a) {}
732 const char *func_name() const override { return "st_envelope"; }
733 String *val_str(String *) override;
735 bool resolve_type(THD *thd) override {
736 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
738 }
739};
740
742 public:
744 : Item_geometry_func(pos, a, b) {}
745 const char *func_name() const override { return "st_makeenvelope"; }
746 String *val_str(String *) override;
748 bool resolve_type(THD *thd) override {
749 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
751 }
752};
753
756
757 public:
758 Item_func_validate(const POS &pos, Item *a) : Item_geometry_func(pos, a) {}
759 const char *func_name() const override { return "st_validate"; }
760 bool resolve_type(THD *thd) override {
761 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
763 }
764 String *val_str(String *) override;
765};
766
767/// Item that implements function ST_Simplify, which simplifies a geometry using
768/// the Douglas-Peucker algorithm.
770 public:
771 Item_func_st_simplify(const POS &pos, Item *a, Item *b)
772 : Item_geometry_func(pos, a, b) {}
773 bool resolve_type(THD *thd) override {
774 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
775 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
777 }
778 String *val_str(String *) override;
779
780 const char *func_name() const override { return "st_simplify"; }
781};
782
784 public:
785 Item_func_point(const POS &pos, Item *a, Item *b)
786 : Item_geometry_func(pos, a, b) {}
787 const char *func_name() const override { return "point"; }
788 String *val_str(String *) override;
790 bool resolve_type(THD *thd) override {
791 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_DOUBLE)) return true;
793 }
794};
795
796/**
797 This handles the @<point@> = ST_POINTFROMGEOHASH(@<string@>, @<srid@>)
798 function.
799
800 It returns a point containing the decoded geohash value, where X is the
801 longitude in the range of [-180, 180] and Y is the latitude in the range
802 of [-90, 90].
803*/
805 private:
806 /// The maximum output latitude value when decoding the geohash value.
807 const double upper_latitude;
808
809 /// The minimum output latitude value when decoding the geohash value.
810 const double lower_latitude;
811
812 /// The maximum output longitude value when decoding the geohash value.
813 const double upper_longitude;
814
815 /// The minimum output longitude value when decoding the geohash value.
816 const double lower_longitude;
817
818 public:
820 : Item_geometry_func(pos, a, b),
821 upper_latitude(90.0),
822 lower_latitude(-90.0),
823 upper_longitude(180.0),
824 lower_longitude(-180.0) {}
825 const char *func_name() const override { return "st_pointfromgeohash"; }
826 String *val_str(String *) override;
827 bool fix_fields(THD *thd, Item **ref) override;
828 bool resolve_type(THD *thd) override;
830 return Field::GEOM_POINT;
831 }
832};
833
836 bool resolve_type(THD *thd) override {
837 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
839 }
840
841 public:
843 : Item_geometry_func(pos, a) {
844 decomp_func = ft;
845 }
846 const char *func_name() const override {
847 switch (decomp_func) {
848 case SP_STARTPOINT:
849 return "st_startpoint";
850 case SP_ENDPOINT:
851 return "st_endpoint";
852 case SP_EXTERIORRING:
853 return "st_exteriorring";
854 default:
855 assert(0); // Should never happened
856 return "spatial_decomp_unknown";
857 }
858 }
859 String *val_str(String *) override;
860};
861
864 bool resolve_type(THD *thd) override {
865 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
866 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
868 }
869
870 public:
873 : Item_geometry_func(pos, a, b) {
874 decomp_func_n = ft;
875 }
876 const char *func_name() const override {
877 switch (decomp_func_n) {
878 case SP_POINTN:
879 return "st_pointn";
880 case SP_GEOMETRYN:
881 return "st_geometryn";
882 case SP_INTERIORRINGN:
883 return "st_interiorringn";
884 default:
885 assert(0); // Should never happened
886 return "spatial_decomp_n_unknown";
887 }
888 }
889 String *val_str(String *) override;
890};
891
896
897 public:
899 enum Geometry::wkbType ct,
900 enum Geometry::wkbType it)
901 : Item_geometry_func(pos, list) {
902 coll_type = ct;
903 item_type = it;
904 }
905 String *val_str(String *) override;
906 bool resolve_type(THD *thd) override {
907 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
908 if (Item_geometry_func::resolve_type(thd)) return true;
909 for (unsigned int i = 0; i < arg_count; ++i) {
910 if (args[i]->fixed && args[i]->data_type() != MYSQL_TYPE_GEOMETRY) {
911 String str;
913 str.append('\0');
914 my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "non geometric", str.ptr());
915 return true;
916 }
917 }
918 return false;
919 }
920
921 const char *func_name() const override;
922};
923
924/*
925 Spatial relations
926*/
927
930
931 public:
933 : Item_bool_func2(a, b) {
934 spatial_rel = sp_rel;
935 }
937 enum Functype sp_rel)
938 : Item_bool_func2(pos, a, b) {
939 spatial_rel = sp_rel;
940 }
941 longlong val_int() override;
942 enum Functype functype() const override { return spatial_rel; }
943 enum Functype rev_functype() const override {
944 switch (spatial_rel) {
945 case SP_CONTAINS_FUNC:
946 return SP_WITHIN_FUNC;
947 case SP_WITHIN_FUNC:
948 return SP_CONTAINS_FUNC;
949 default:
950 return spatial_rel;
951 }
952 }
953
954 const char *func_name() const override;
955 void print(const THD *thd, String *str,
956 enum_query_type query_type) const override {
957 Item_func::print(thd, str, query_type);
958 }
959 bool resolve_type(THD *) override {
960 set_nullable(true);
961 return false;
962 }
963 bool is_null() override {
964 val_int();
965 return null_value;
966 }
967};
968
970 public:
972 : Item_bool_func2(pos, a, b) {}
973 bool resolve_type(THD *thd) override {
974 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
975 // Spatial relation functions may return NULL if either parameter is NULL or
976 // an empty geometry. Since we can't check for empty geometries at resolve
977 // time, this item is always nullable.
978 set_nullable(true);
979 return false;
980 }
981 void print(const THD *thd, String *str,
982 enum_query_type query_type) const override {
983 Item_func::print(thd, str, query_type);
984 }
985 longlong val_int() override;
986 bool is_null() override {
987 // The superclass implementation only checks is_null on the item's
988 // arguments. However, relational functions may return NULL even if the
989 // arguments are not NULL, e.g., if one or more argument is an empty
990 // geometry. Therefore, we must evaluate the item to find out if it is NULL
991 // or not.
992 val_int();
993 return null_value;
994 }
995
996 /**
997 Evaluate the spatial relation function.
998
999 @param[in] srs Spatial reference system common to both g1 and g2.
1000 @param[in] g1 First geometry.
1001 @param[in] g2 Second geometry.
1002 @param[out] result Result of the relational operation.
1003 @param[out] null True if the function should return NULL, false otherwise.
1004
1005 @retval true An error has occurred and has been reported with my_error.
1006 @retval false Success.
1007 */
1008 virtual bool eval(const dd::Spatial_reference_system *srs,
1009 const gis::Geometry *g1, const gis::Geometry *g2,
1010 bool *result, bool *null) = 0;
1011};
1012
1014 public:
1016 : Item_func_spatial_relation(pos, a, b) {}
1017 enum Functype functype() const override { return SP_CONTAINS_FUNC; }
1018 enum Functype rev_functype() const override { return SP_WITHIN_FUNC; }
1019 const char *func_name() const override { return "st_contains"; }
1020 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1021 const gis::Geometry *g2, bool *result, bool *null) override;
1022};
1023
1025 public:
1026 Item_func_st_crosses(const POS &pos, Item *a, Item *b)
1027 : Item_func_spatial_relation(pos, a, b) {}
1028 enum Functype functype() const override { return SP_CROSSES_FUNC; }
1029 enum Functype rev_functype() const override { return SP_CROSSES_FUNC; }
1030 const char *func_name() const override { return "st_crosses"; }
1031 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1032 const gis::Geometry *g2, bool *result, bool *null) override;
1033};
1034
1036 public:
1038 : Item_func_spatial_relation(pos, a, b) {}
1039 enum Functype functype() const override { return SP_DISJOINT_FUNC; }
1040 enum Functype rev_functype() const override { return SP_DISJOINT_FUNC; }
1041 const char *func_name() const override { return "st_disjoint"; }
1042 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1043 const gis::Geometry *g2, bool *result, bool *null) override;
1044};
1045
1047 public:
1048 Item_func_st_equals(const POS &pos, Item *a, Item *b)
1049 : Item_func_spatial_relation(pos, a, b) {}
1050 enum Functype functype() const override { return SP_EQUALS_FUNC; }
1051 enum Functype rev_functype() const override { return SP_EQUALS_FUNC; }
1052 const char *func_name() const override { return "st_equals"; }
1053 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1054 const gis::Geometry *g2, bool *result, bool *null) override;
1055};
1056
1058 public:
1060 : Item_func_spatial_relation(pos, a, b) {}
1061 enum Functype functype() const override { return SP_INTERSECTS_FUNC; }
1062 enum Functype rev_functype() const override { return SP_INTERSECTS_FUNC; }
1063 const char *func_name() const override { return "st_intersects"; }
1064 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1065 const gis::Geometry *g2, bool *result, bool *null) override;
1066};
1067
1069 public:
1071 : Item_func_spatial_relation(pos, a, b) {}
1072 enum Functype functype() const override { return SP_CONTAINS_FUNC; }
1073 enum Functype rev_functype() const override { return SP_WITHIN_FUNC; }
1074 const char *func_name() const override { return "mbrcontains"; }
1075 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1076 const gis::Geometry *g2, bool *result, bool *null) override;
1077};
1078
1080 public:
1082 : Item_func_spatial_relation(pos, a, b) {}
1083 enum Functype functype() const override { return SP_COVEREDBY_FUNC; }
1084 enum Functype rev_functype() const override { return SP_COVERS_FUNC; }
1085 const char *func_name() const override { return "mbrcoveredby"; }
1086 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1087 const gis::Geometry *g2, bool *result, bool *null) override;
1088};
1089
1091 public:
1092 Item_func_mbrcovers(const POS &pos, Item *a, Item *b)
1093 : Item_func_spatial_relation(pos, a, b) {}
1094 enum Functype functype() const override { return SP_COVERS_FUNC; }
1095 enum Functype rev_functype() const override { return SP_COVEREDBY_FUNC; }
1096 const char *func_name() const override { return "mbrcovers"; }
1097 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1098 const gis::Geometry *g2, bool *result, bool *null) override;
1099};
1100
1102 public:
1104 : Item_func_spatial_relation(pos, a, b) {}
1105 enum Functype functype() const override { return SP_DISJOINT_FUNC; }
1106 enum Functype rev_functype() const override { return SP_DISJOINT_FUNC; }
1107 const char *func_name() const override { return "mbrdisjoint"; }
1108 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1109 const gis::Geometry *g2, bool *result, bool *null) override;
1110};
1111
1113 public:
1114 Item_func_mbrequals(const POS &pos, Item *a, Item *b)
1115 : Item_func_spatial_relation(pos, a, b) {}
1116 enum Functype functype() const override { return SP_EQUALS_FUNC; }
1117 enum Functype rev_functype() const override { return SP_EQUALS_FUNC; }
1118 const char *func_name() const override { return "mbrequals"; }
1119 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1120 const gis::Geometry *g2, bool *result, bool *null) override;
1121};
1122
1124 public:
1126 : Item_func_spatial_relation(pos, a, b) {}
1127 enum Functype functype() const override { return SP_INTERSECTS_FUNC; }
1128 enum Functype rev_functype() const override { return SP_INTERSECTS_FUNC; }
1129 const char *func_name() const override { return "mbrintersects"; }
1130 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1131 const gis::Geometry *g2, bool *result, bool *null) override;
1132};
1133
1135 public:
1137 : Item_func_spatial_relation(pos, a, b) {}
1138 enum Functype functype() const override { return SP_OVERLAPS_FUNC; }
1139 enum Functype rev_functype() const override { return SP_OVERLAPS_FUNC; }
1140 const char *func_name() const override { return "mbroverlaps"; }
1141 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1142 const gis::Geometry *g2, bool *result, bool *null) override;
1143};
1144
1146 public:
1147 Item_func_mbrtouches(const POS &pos, Item *a, Item *b)
1148 : Item_func_spatial_relation(pos, a, b) {}
1149 enum Functype functype() const override { return SP_TOUCHES_FUNC; }
1150 enum Functype rev_functype() const override { return SP_TOUCHES_FUNC; }
1151 const char *func_name() const override { return "mbrtouches"; }
1152 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1153 const gis::Geometry *g2, bool *result, bool *null) override;
1154};
1155
1157 public:
1158 Item_func_mbrwithin(const POS &pos, Item *a, Item *b)
1159 : Item_func_spatial_relation(pos, a, b) {}
1160 enum Functype functype() const override { return SP_WITHIN_FUNC; }
1161 enum Functype rev_functype() const override { return SP_CONTAINS_FUNC; }
1162 const char *func_name() const override { return "mbrwithin"; }
1163 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1164 const gis::Geometry *g2, bool *result, bool *null) override;
1165};
1166
1168 public:
1170 : Item_func_spatial_relation(pos, a, b) {}
1171 enum Functype functype() const override { return SP_OVERLAPS_FUNC; }
1172 enum Functype rev_functype() const override { return SP_OVERLAPS_FUNC; }
1173 const char *func_name() const override { return "st_overlaps"; }
1174 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1175 const gis::Geometry *g2, bool *result, bool *null) override;
1176};
1177
1179 public:
1180 Item_func_st_touches(const POS &pos, Item *a, Item *b)
1181 : Item_func_spatial_relation(pos, a, b) {}
1182 enum Functype functype() const override { return SP_TOUCHES_FUNC; }
1183 enum Functype rev_functype() const override { return SP_TOUCHES_FUNC; }
1184 const char *func_name() const override { return "st_touches"; }
1185 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1186 const gis::Geometry *g2, bool *result, bool *null) override;
1187};
1188
1190 public:
1191 Item_func_st_within(const POS &pos, Item *a, Item *b)
1192 : Item_func_spatial_relation(pos, a, b) {}
1193 enum Functype functype() const override { return SP_WITHIN_FUNC; }
1194 enum Functype rev_functype() const override { return SP_CONTAINS_FUNC; }
1195 const char *func_name() const override { return "st_within"; }
1196 bool eval(const dd::Spatial_reference_system *srs, const gis::Geometry *g1,
1197 const gis::Geometry *g2, bool *result, bool *null) override;
1198};
1199
1200/**
1201 Spatial operations
1202*/
1204 protected:
1206 : Item_geometry_func(pos, a, b) {}
1207
1208 private:
1209 bool resolve_type(THD *thd) override {
1210 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1212 }
1213};
1214
1216 public:
1218 : Item_func_spatial_operation(pos, a, b) {}
1219 String *val_str(String *) override;
1220 const char *func_name() const override { return "st_difference"; }
1221};
1222
1224 public:
1226 : Item_func_spatial_operation(pos, a, b) {}
1227 String *val_str(String *) override;
1228 const char *func_name() const override { return "st_intersection"; }
1229};
1230
1232 public:
1234 : Item_func_spatial_operation(pos, a, b) {}
1235 String *val_str(String *) override;
1236 const char *func_name() const override { return "st_symdifference"; }
1237};
1238
1240 public:
1241 Item_func_st_union(const POS &pos, Item *a, Item *b)
1242 : Item_func_spatial_operation(pos, a, b) {}
1243 String *val_str(String *) override;
1244 const char *func_name() const override { return "st_union"; }
1245};
1246
1248 private:
1258
1259 // Distance and side strategies are fixed, so no need to implement
1260 // parameterization for them.
1262
1263 friend class Item_func_buffer;
1265 char tmp_buffer[16]; // The buffer for tmp_value.
1266 public:
1267 Item_func_buffer_strategy(const POS &pos, PT_item_list *ilist);
1268 const char *func_name() const override { return "st_buffer_strategy"; }
1269 String *val_str(String *) override;
1270 bool resolve_type(THD *thd) override;
1271};
1272
1274 public:
1275 Item_func_isempty(const POS &pos, Item *a) : Item_bool_func(pos, a) {}
1276 longlong val_int() override;
1277 optimize_type select_optimize(const THD *) override { return OPTIMIZE_NONE; }
1278 const char *func_name() const override { return "st_isempty"; }
1279 bool resolve_type(THD *thd) override {
1280 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1281 set_nullable(true);
1282 return false;
1283 }
1284};
1285
1287 public:
1288 Item_func_st_issimple(const POS &pos, Item *a) : Item_bool_func(pos, a) {}
1289 longlong val_int() override;
1290 const char *func_name() const override { return "st_issimple"; }
1291 bool resolve_type(THD *thd) override {
1292 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1293 return Item_bool_func::resolve_type(thd);
1294 }
1295};
1296
1298 public:
1299 Item_func_isclosed(const POS &pos, Item *a) : Item_bool_func(pos, a) {}
1300 longlong val_int() override;
1301 optimize_type select_optimize(const THD *) override { return OPTIMIZE_NONE; }
1302 const char *func_name() const override { return "st_isclosed"; }
1303 bool resolve_type(THD *thd) override {
1304 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1305 set_nullable(true);
1306 return false;
1307 }
1308};
1309
1311 public:
1312 Item_func_isvalid(const POS &pos, Item *a) : Item_bool_func(pos, a) {}
1313 longlong val_int() override;
1314 optimize_type select_optimize(const THD *) override { return OPTIMIZE_NONE; }
1315 const char *func_name() const override { return "st_isvalid"; }
1316 bool resolve_type(THD *thd) override {
1317 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1318 return Item_bool_func::resolve_type(thd);
1319 }
1320};
1321
1324
1325 public:
1326 Item_func_dimension(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1327 longlong val_int() override;
1328 const char *func_name() const override { return "st_dimension"; }
1329 bool resolve_type(THD *thd) override {
1330 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1331 max_length = 10;
1332 set_nullable(true);
1333 return false;
1334 }
1335};
1336
1337/// The abstract superclass for all geometry coordinate mutator functions (ST_X,
1338/// ST_Y, ST_Latitude and ST_Longitude with two parameters).
1339///
1340/// @see Item_func_coordinate_observer
1342 public:
1344 bool geographic_only)
1345 : Item_geometry_func(pos, a, b), m_geographic_only(geographic_only) {}
1346 String *val_str(String *) override;
1347
1348 protected:
1349 const char *func_name() const override = 0;
1350 /// Returns the coordinate number accessed by this item.
1351 ///
1352 /// @param[in] srs The spatial reference system of the point.
1353 ///
1354 /// @return The coordinate number to access.
1356 const dd::Spatial_reference_system *srs) const = 0;
1357 bool resolve_type(THD *thd) override {
1358 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1359 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
1361 }
1362
1363 private:
1364 /// Whether this item will accept only geographic geometries/SRSs.
1366};
1367
1368/// The abstract superclass for all geometry coordinate oberserver functions
1369/// (ST_X, ST_Y, ST_Latitude, ST_Longitude with one parameter).
1370///
1371/// @see Item_func_coordinate_mutator
1373 public:
1374 Item_func_coordinate_observer(const POS &pos, Item *a, bool geographic_only)
1375 : Item_real_func(pos, a), m_geographic_only(geographic_only) {}
1376 double val_real() override;
1377
1378 protected:
1379 const char *func_name() const override = 0;
1380 /// Returns the coordinate number accessed by this item.
1381 ///
1382 /// @param[in] srs The spatial reference system of the point.
1383 ///
1384 /// @return The coordinate number to access.
1386 const dd::Spatial_reference_system *srs) const = 0;
1387 bool resolve_type(THD *thd) override {
1388 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1389 return Item_real_func::resolve_type(thd);
1390 }
1391
1392 private:
1393 /// Whether this item will accept only geographic geometries/SRSs.
1395};
1396
1397/// This class implements the two-parameter ST_Latitude function which sets the
1398/// latitude of a geographic point.
1401 public:
1403 : Item_func_coordinate_mutator(pos, a, b, true) {}
1404
1405 protected:
1406 const char *func_name() const override { return "st_latitude"; }
1408 return 1;
1409 }
1410};
1411
1412/// This class implements the one-parameter ST_Latitude function which returns
1413/// the latitude coordinate of a geographic point.
1416 public:
1418 : Item_func_coordinate_observer(pos, a, true) {}
1419
1420 protected:
1421 const char *func_name() const override { return "st_latitude"; }
1423 return 1;
1424 }
1425};
1426
1427/// This class implements the two-parameter ST_Longitude function which sets the
1428/// longitude coordinate of a point.
1431 public:
1433 : Item_func_coordinate_mutator(pos, a, b, true) {}
1434
1435 protected:
1436 const char *func_name() const override { return "st_longitude"; }
1438 return 0;
1439 }
1440};
1441
1442/// This class implements the one-parameter ST_Longitude function which returns
1443/// the longitude coordinate of a geographic point.
1446 public:
1448 : Item_func_coordinate_observer(pos, a, true) {}
1449
1450 protected:
1451 const char *func_name() const override { return "st_longitude"; }
1453 return 0;
1454 }
1455};
1456
1457/// This class implements the two-parameter ST_X function which sets the X
1458/// coordinate of a point.
1460 public:
1462 : Item_func_coordinate_mutator(pos, a, b, false) {}
1463
1464 protected:
1465 const char *func_name() const override { return "st_x"; }
1466 int coordinate_number(const dd::Spatial_reference_system *srs) const override;
1467};
1468
1469/// This class implements the one-parameter ST_X function which returns the X
1470/// coordinate of a point.
1472 public:
1474 : Item_func_coordinate_observer(pos, a, false) {}
1475
1476 protected:
1477 const char *func_name() const override { return "st_x"; }
1478 int coordinate_number(const dd::Spatial_reference_system *srs) const override;
1479};
1480
1481/// This class implements the two-parameter ST_Y function which sets the Y
1482/// coordinate of a point.
1484 public:
1486 : Item_func_coordinate_mutator(pos, a, b, false) {}
1487
1488 protected:
1489 const char *func_name() const override { return "st_y"; }
1490 int coordinate_number(const dd::Spatial_reference_system *srs) const override;
1491};
1492
1493/// This class implements the one-parameter ST_Y function which returns the Y
1494/// coordinate of a point.
1496 public:
1498 : Item_func_coordinate_observer(pos, a, false) {}
1499
1500 protected:
1501 const char *func_name() const override { return "st_y"; }
1502 int coordinate_number(const dd::Spatial_reference_system *srs) const override;
1503};
1504
1506 bool resolve_type(THD *thd) override {
1507 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1509 }
1510
1511 public:
1512 Item_func_swap_xy(const POS &pos, Item *a) : Item_geometry_func(pos, a) {}
1513 const char *func_name() const override { return "st_swapxy"; }
1514 String *val_str(String *) override;
1515};
1516
1519
1520 public:
1521 Item_func_numgeometries(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1522 longlong val_int() override;
1523 const char *func_name() const override { return "st_numgeometries"; }
1524 bool resolve_type(THD *thd) override {
1525 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1526 max_length = 10;
1527 set_nullable(true);
1528 return false;
1529 }
1530};
1531
1534
1535 public:
1537 longlong val_int() override;
1538 const char *func_name() const override { return "st_numinteriorrings"; }
1539 bool resolve_type(THD *thd) override {
1540 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1541 max_length = 10;
1542 set_nullable(true);
1543 return false;
1544 }
1545};
1546
1549
1550 public:
1551 Item_func_numpoints(const POS &pos, Item *a) : Item_int_func(pos, a) {}
1552 longlong val_int() override;
1553 const char *func_name() const override { return "st_numpoints"; }
1554 bool resolve_type(THD *thd) override {
1555 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1556 max_length = 10;
1557 set_nullable(true);
1558 return false;
1559 }
1560};
1561
1563 public:
1564 Item_func_st_area(const POS &pos, Item *a) : Item_real_func(pos, a) {}
1565 double val_real() override;
1566 const char *func_name() const override { return "st_area"; }
1567 bool resolve_type(THD *thd) override {
1568 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1569 // ST_Area returns NULL if the geometry is empty.
1570 set_nullable(true);
1571 return false;
1572 }
1573};
1574
1576 public:
1577 /// Parses strategy stored in String object, and sets values in strats.
1578 bool parse_strategy(String *arg, gis::BufferStrategies &strats);
1579
1581 : Item_geometry_func(pos, ilist) {}
1582
1583 String *val_str(String *) override;
1584 const char *func_name() const override { return "st_buffer"; }
1585 bool resolve_type(THD *thd) override {
1586 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1587 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
1588 if (param_type_is_default(thd, 2, -1))
1589 return true; // Does nothing with the strategy args
1591 }
1592};
1593
1596
1597 public:
1599 : Item_real_func(pos, ilist) {}
1600 double val_real() override;
1601 const char *func_name() const override { return "st_length"; }
1602 bool resolve_type(THD *thd) override {
1603 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1604 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1605 if (Item_real_func::resolve_type(thd)) return true;
1606 set_nullable(true);
1607 return false;
1608 }
1609};
1610
1611/// This class implements the two-parameter ST_SRID function which sets
1612/// the SRID of a geometry.
1614 public:
1616 : Item_geometry_func(pos, a, b) {}
1617 String *val_str(String *) override;
1618 const char *func_name() const override { return "st_srid"; }
1619 bool resolve_type(THD *thd) override {
1620 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1621 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_LONGLONG)) return true;
1623 }
1624};
1625
1626/// This class implements the one-parameter ST_SRID function which
1627/// returns the SRID of a geometry.
1629 public:
1631 longlong val_int() override;
1632 const char *func_name() const override { return "st_srid"; }
1633 bool resolve_type(THD *thd) override {
1634 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1636 max_length = 10;
1637 return error;
1638 }
1639};
1640
1642 double geometry_collection_distance(const Geometry *g1, const Geometry *g2);
1643
1644 template <typename Coordsys, typename BG_geometry>
1645 double distance_dispatch_second_geometry(const BG_geometry &bg1,
1646 const Geometry *g2);
1647
1648 public:
1649 template <typename Coordsys>
1650 double bg_distance(const Geometry *g1, const Geometry *g2);
1651
1653 : Item_real_func(pos, ilist) {
1654 /*
1655 Either operand can be an empty geometry collection, and it's meaningless
1656 for a distance between them.
1657 */
1658 set_nullable(true);
1659 }
1660
1661 bool resolve_type(THD *thd) override {
1662 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_GEOMETRY)) return true;
1663 set_nullable(true);
1664 return false;
1665 }
1666
1667 double val_real() override;
1668 enum Functype functype() const override { return SP_DISTANCE_FUNC; }
1669 const char *func_name() const override { return "st_distance"; }
1670};
1671
1673 public:
1675 : Item_real_func(pos, ilist) {}
1676 double val_real() override;
1677 const char *func_name() const override { return "st_frechetdistance"; }
1678 bool resolve_type(THD *thd) override {
1680 if (Item_real_func::resolve_type(thd)) return true;
1681 set_nullable(true);
1682 return false;
1683 }
1684};
1685
1687 public:
1689 : Item_real_func(pos, ilist) {}
1690 double val_real() override;
1691 const char *func_name() const override { return "st_hausdorffdistance"; }
1692 bool resolve_type(THD *thd) override {
1694 if (Item_real_func::resolve_type(thd)) return true;
1695 set_nullable(true);
1696 return false;
1697 }
1698};
1699
1701 public:
1703 : Item_real_func(pos, ilist) {}
1704 double val_real() override;
1705 const char *func_name() const override { return "st_distance_sphere"; }
1706 bool resolve_type(THD *thd) override {
1707 if (param_type_is_default(thd, 0, 2, MYSQL_TYPE_GEOMETRY)) return true;
1708 if (param_type_is_default(thd, 2, 3, MYSQL_TYPE_DOUBLE)) return true;
1709 return Item_real_func::resolve_type(thd);
1710 }
1711};
1712
1713// The abstract superclass for interpolating point(s) along a line.
1715 public:
1717 : Item_geometry_func(pos, a, b) {}
1718 String *val_str(String *str) override;
1719
1720 protected:
1721 virtual bool isFractionalDistance() const = 0;
1722 virtual bool returnMultiplePoints() const = 0;
1723 bool resolve_type(THD *thd) override {
1724 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_GEOMETRY)) return true;
1725 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
1727 }
1728};
1729
1731 public:
1733 : Item_func_lineinterpolate(pos, a, b) {}
1734
1735 protected:
1736 const char *func_name() const override { return "st_lineinterpolatepoint"; }
1737 bool isFractionalDistance() const override { return true; }
1738 bool returnMultiplePoints() const override { return false; }
1739};
1740
1742 public:
1744 : Item_func_lineinterpolate(pos, a, b) {}
1745
1746 protected:
1747 const char *func_name() const override { return "st_lineinterpolatepoints"; }
1748 bool isFractionalDistance() const override { return true; }
1749 bool returnMultiplePoints() const override { return true; }
1750};
1751
1753 public:
1755 : Item_func_lineinterpolate(pos, a, b) {}
1756
1757 protected:
1758 const char *func_name() const override { return "st_pointatdistance"; }
1759 bool isFractionalDistance() const override { return false; }
1760 bool returnMultiplePoints() const override { return false; }
1761};
1762
1763/// This class implements ST_Transform function that transforms a geometry from
1764/// one SRS to another.
1766 public:
1768 : Item_geometry_func(pos, a, b) {}
1769 String *val_str(String *str) override;
1770
1771 private:
1772 const char *func_name() const override { return "st_transform"; }
1773};
1774
1775// This is an abstract class that is inherited by geometry cast items.
1777 public:
1779 : Item_geometry_func(pos, a) {}
1780 String *val_str(String *str) override;
1781 void print(const THD *thd, String *str,
1782 enum_query_type query_type) const override = 0;
1783 const char *func_name() const override = 0;
1784 enum Functype functype() const override { return TYPECAST_FUNC; }
1786 bool resolve_type(THD *thd) override {
1789 }
1790
1791 /// Casts certain geometry types to certain target geometry types.
1792 ///
1793 /// @param[in] srs The srs of the geometry being cast.
1794 /// @param[in] source_geometry The geometry being cast.
1795 /// @param[out] target_geometry The result geometry of the cast.
1796 ///
1797 /// @retval false Success.
1798 /// @retval true An error has occurred. The error has been reported with
1799 /// my_error().
1800
1801 virtual bool cast(const dd::Spatial_reference_system *srs,
1802 std::unique_ptr<gis::Geometry> *source_geometry,
1803 std::unique_ptr<gis::Geometry> *target_geometry) const = 0;
1804};
1805
1806// This class implements CAST from certain geometries to POINT type.
1808 public:
1810 : Item_typecast_geometry(pos, a) {}
1811 void print(const THD *thd, String *str,
1812 enum_query_type query_type) const override;
1813 const char *func_name() const override { return "cast_as_point"; }
1814 Field::geometry_type get_geometry_type() const override;
1816 std::unique_ptr<gis::Geometry> *source_geometry,
1817 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1818};
1819
1820// This class implements CAST from certain geometries to LINESTRING type.
1822 public:
1824 : Item_typecast_geometry(pos, a) {}
1825 void print(const THD *thd, String *str,
1826 enum_query_type query_type) const override;
1827 const char *func_name() const override { return "cast_as_linestring"; }
1828 Field::geometry_type get_geometry_type() const override;
1830 std::unique_ptr<gis::Geometry> *source_geometry,
1831 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1832};
1833
1834// This class implements CAST from certain geometries to POLYGON type.
1836 public:
1838 : Item_typecast_geometry(pos, a) {}
1839 void print(const THD *thd, String *str,
1840 enum_query_type query_type) const override;
1841 const char *func_name() const override { return "cast_as_polygon"; }
1842 Field::geometry_type get_geometry_type() const override;
1843 bool cast(const dd::Spatial_reference_system *srs,
1844 std::unique_ptr<gis::Geometry> *source_geometry,
1845 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1846};
1847
1848// This class implements CAST from certain geometries to MULTIPOINT type.
1850 public:
1852 : Item_typecast_geometry(pos, a) {}
1853 void print(const THD *thd, String *str,
1854 enum_query_type query_type) const override;
1855 const char *func_name() const override { return "cast_as_multipoint"; }
1856 Field::geometry_type get_geometry_type() const override;
1858 std::unique_ptr<gis::Geometry> *source_geometry,
1859 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1860};
1861
1862// This class implements CAST from certain geometries to MULTILINESTRING type.
1864 public:
1866 : Item_typecast_geometry(pos, a) {}
1867 void print(const THD *thd, String *str,
1868 enum_query_type query_type) const override;
1869 const char *func_name() const override { return "cast_as_multilinestring"; }
1870 Field::geometry_type get_geometry_type() const override;
1872 std::unique_ptr<gis::Geometry> *source_geometry,
1873 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1874};
1875
1876// This class implements CAST from certain geometries to MULTIPOLYGON type.
1878 public:
1880 : Item_typecast_geometry(pos, a) {}
1881 void print(const THD *thd, String *str,
1882 enum_query_type query_type) const override;
1883 const char *func_name() const override { return "cast_as_multipolygon"; }
1884 Field::geometry_type get_geometry_type() const override;
1885 bool cast(const dd::Spatial_reference_system *srs,
1886 std::unique_ptr<gis::Geometry> *source_geometry,
1887 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1888};
1889
1890// This class implements CAST from certain geometries to GEOMETRYCOLLECTION
1891// type.
1893 public:
1895 : Item_typecast_geometry(pos, a) {}
1896 void print(const THD *thd, String *str,
1897 enum_query_type query_type) const override;
1898 const char *func_name() const override {
1899 return "cast_as_geometrycollection";
1900 }
1901 Field::geometry_type get_geometry_type() const override;
1903 std::unique_ptr<gis::Geometry> *source_geometry,
1904 std::unique_ptr<gis::Geometry> *target_geometry) const override;
1905};
1906
1907#endif /*ITEM_GEOFUNC_INCLUDED*/
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:250
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:4610
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:4552
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:4535
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
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:574
static constexpr size_t MAX_LONG_BLOB_WIDTH
Definition: field.h:736
geometry_type
Definition: field.h:717
@ GEOM_POINT
Definition: field.h:719
Definition: spatial.h:212
wkbType
Definition: spatial.h:289
Definition: spatial.h:2098
Definition: spatial.h:1151
Definition: spatial.h:2186
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:623
Definition: item_cmpfunc.h:294
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_cmpfunc.h:328
This class handles the following function:
Definition: item_geofunc.h:490
bool val_json(Json_wrapper *wr) override
Create a GeoJSON object, according to GeoJSON specification revision 1.0.
Definition: item_geofunc.cc:2364
Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry, Item *maxdecimaldigits)
Definition: item_geofunc.h:515
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:500
bool parse_maxdecimaldigits_argument()
Parse the value in maxdecimaldigits argument.
Definition: item_geofunc.cc:2454
Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry, Item *maxdecimaldigits, Item *options)
Definition: item_geofunc.h:521
int m_max_decimal_digits
Maximum number of decimal digits in printed coordinates.
Definition: item_geofunc.h:493
bool m_add_bounding_box
If true, the output GeoJSON has a bounding box for each GEOMETRY.
Definition: item_geofunc.h:495
const char * func_name() const override
Definition: item_geofunc.h:529
Item_func_as_geojson(THD *thd, const POS &pos, Item *geometry)
Definition: item_geofunc.h:510
bool parse_options_argument()
Parse the value in options argument.
Definition: item_geofunc.cc:2417
uint32 m_geometry_srid
The SRID found in the input GEOMETRY.
Definition: item_geofunc.h:507
bool fix_fields(THD *thd, Item **ref) override
Perform type checking on all arguments.
Definition: item_geofunc.cc:2487
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:505
Definition: item_geofunc.h:330
Item_func_as_wkb(const POS &pos, Item *a)
Definition: item_geofunc.h:332
const char * func_name() const override
Definition: item_geofunc.h:335
String * val_str(String *) override
Definition: item_geofunc.cc:3258
Item_func_as_wkb(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:333
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:337
Definition: item_geofunc.h:320
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.cc:3249
String * val_str_ascii(String *) override
Definition: item_geofunc.cc:3139
Item_func_as_wkt(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:323
const char * func_name() const override
Definition: item_geofunc.h:325
Item_func_as_wkt(const POS &pos, Item *a)
Definition: item_geofunc.h:322
Definition: item_geofunc.h:1247
char tmp_buffer[16]
Definition: item_geofunc.h:1265
enum_buffer_strategies
Definition: item_geofunc.h:1249
@ point_circle
Definition: item_geofunc.h:1255
@ point_square
Definition: item_geofunc.h:1256
@ join_miter
Definition: item_geofunc.h:1254
@ max_strategy
Definition: item_geofunc.h:1257
@ end_flat
Definition: item_geofunc.h:1252
@ invalid_strategy
Definition: item_geofunc.h:1250
@ end_round
Definition: item_geofunc.h:1251
@ join_round
Definition: item_geofunc.h:1253
friend class Item_func_buffer
Definition: item_geofunc.h:1263
String tmp_value
Definition: item_geofunc.h:1264
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:124
const char * func_name() const override
Definition: item_geofunc.h:1268
String * val_str(String *) override
Definition: item_geofunc_buffer.cc:132
Item_func_buffer_strategy(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc_buffer.cc:116
Definition: item_geofunc.h:695
const char * func_name() const override
Definition: item_geofunc.h:703
bool bg_centroid(const Geometry *geom, String *ptwkb)
Definition: item_geofunc.cc:3829
String * val_str(String *) override
Definition: item_geofunc.cc:3612
Item_func_centroid(const POS &pos, Item *a)
Definition: item_geofunc.h:702
BG_result_buf_mgr bg_resbuf_mgr
Definition: item_geofunc.h:696
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:706
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:3608
Definition: item_geofunc.h:712
BG_result_buf_mgr bg_resbuf_mgr
Definition: item_geofunc.h:713
bool bg_convex_hull(const Geometry *geom, String *wkb)
Definition: item_geofunc.cc:3935
const char * func_name() const override
Definition: item_geofunc.h:720
String * val_str(String *) override
Definition: item_geofunc.cc:3899
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:723
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:3895
Item_func_convex_hull(const POS &pos, Item *a)
Definition: item_geofunc.h:719
The abstract superclass for all geometry coordinate mutator functions (ST_X, ST_Y,...
Definition: item_geofunc.h:1341
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:1343
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1357
const char * func_name() const override=0
bool m_geographic_only
Whether this item will accept only geographic geometries/SRSs.
Definition: item_geofunc.h:1365
String * val_str(String *) override
Definition: item_geofunc.cc:4903
The abstract superclass for all geometry coordinate oberserver functions (ST_X, ST_Y,...
Definition: item_geofunc.h:1372
double val_real() override
Definition: item_geofunc.cc:4975
bool m_geographic_only
Whether this item will accept only geographic geometries/SRSs.
Definition: item_geofunc.h:1394
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1387
Item_func_coordinate_observer(const POS &pos, Item *a, bool geographic_only)
Definition: item_geofunc.h:1374
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:1322
String value
Definition: item_geofunc.h:1323
const char * func_name() const override
Definition: item_geofunc.h:1328
longlong val_int() override
Definition: item_geofunc.cc:4827
Item_func_dimension(const POS &pos, Item *a)
Definition: item_geofunc.h:1326
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1329
Definition: item_geofunc.h:1641
double val_real() override
Definition: item_geofunc.cc:5651
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:1661
const char * func_name() const override
Definition: item_geofunc.h:1669
double bg_distance(const Geometry *g1, const Geometry *g2)
enum Functype functype() const override
Definition: item_geofunc.h:1668
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:1652
Definition: item_geofunc.h:729
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:735
const char * func_name() const override
Definition: item_geofunc.h:732
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:3571
String * val_str(String *) override
Definition: item_geofunc.cc:3575
Item_func_envelope(const POS &pos, Item *a)
Definition: item_geofunc.h:731
This class handles two forms of the same function:
Definition: item_geofunc.h:543
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:2866
uint geohash_max_output_length
The maximum output length of the geohash, supplied by the user.
Definition: item_geofunc.h:550
Item_func_geohash(const POS &pos, Item *longitude, Item *latitude, Item *length)
Definition: item_geofunc.h:590
String * val_str_ascii(String *) override
Encodes a pair of longitude and latitude values into a geohash string.
Definition: item_geofunc.cc:2672
double longitude
The longitude argument supplied by the user (directly or by a POINT).
Definition: item_geofunc.h:548
bool fill_and_check_fields()
Populate member variables with values from arguments.
Definition: item_geofunc.cc:2580
const double min_latitude
The minimum input latitude.
Definition: item_geofunc.h:562
bool fix_fields(THD *thd, Item **ref) override
Here we check for valid types.
Definition: item_geofunc.cc:2739
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:2841
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.cc:2729
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:2530
const uint upper_limit_output_length
The absolute upper limit of geohash output length.
Definition: item_geofunc.h:580
const double min_longitude
The minimum input longitude.
Definition: item_geofunc.h:574
double latitude
The latitude argument supplied by the user (directly or by a POINT).
Definition: item_geofunc.h:546
const double max_latitude
The maximum input latitude.
Definition: item_geofunc.h:556
const double max_longitude
The maximum input longitude.
Definition: item_geofunc.h:568
const char * func_name() const override
Definition: item_geofunc.h:601
Item_func_geohash(const POS &pos, Item *point, Item *length)
Definition: item_geofunc.h:583
Definition: item_geofunc.h:198
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_geofunc.cc:315
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:251
Item_func_geometry_from_text(const POS &pos, Item *a, Item *srid, Item *option, Functype functype)
Definition: item_geofunc.h:244
Functype
Definition: item_geofunc.h:200
Functype m_functype
Definition: item_geofunc.h:221
Item_func_geometry_from_text(const POS &pos, Item *a, Functype functype)
Definition: item_geofunc.h:239
Geometry::wkbType allowed_wkb_type() const
Get the type of geometry that this Item can return.
Definition: item_geofunc.cc:364
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:422
const char * func_name() const override
Definition: item_geofunc.cc:324
Item_geometry_func super
Definition: item_geofunc.h:220
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:396
Item_func_geometry_from_text(const POS &pos, Item *a, Item *srid, Functype functype)
Definition: item_geofunc.h:241
Definition: item_geofunc.h:259
Item_geometry_func super
Definition: item_geofunc.h:280
Functype
Definition: item_geofunc.h:261
Item_func_geometry_from_wkb(const POS &pos, Item *a, Item *srid, Item *option, Functype functype)
Definition: item_geofunc.h:311
Item_func_geometry_from_wkb(const POS &pos, Item *a, Item *srid, Functype functype)
Definition: item_geofunc.h:308
String tmp_value
Definition: item_geofunc.h:281
bool do_itemize(Parse_context *pc, Item **res) override
The core function that does the actual itemization.
Definition: item_geofunc.cc:575
Functype m_functype
Definition: item_geofunc.h:282
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:679
Item_func_geometry_from_wkb(const POS &pos, Item *a, Functype functype)
Definition: item_geofunc.h:306
const char * func_name() const override
Definition: item_geofunc.cc:584
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:298
Geometry::wkbType allowed_wkb_type() const
Get the type of geometry that this Item can return.
Definition: item_geofunc.cc:622
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:653
Definition: item_geofunc.h:346
Item_func_geometry_type(const POS &pos, Item *a)
Definition: item_geofunc.h:348
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:352
const char * func_name() const override
Definition: item_geofunc.h:351
String * val_str_ascii(String *) override
Definition: item_geofunc.cc:3365
This handles one function:
Definition: item_geofunc.h:374
bool m_toplevel
True if we're currently parsing the top-level object.
Definition: item_geofunc.h:466
static const char * TYPE_MEMBER
Definition of various string constants used for writing and reading GeoJSON data.
Definition: item_geofunc.h:421
static const char * FEATURECOLLECTION_TYPE
Definition: item_geofunc.h:441
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:1065
static const char * SHORT_EPSG_PREFIX
Definition: item_geofunc.h:430
static const char * CRS_NAME_MEMBER
Definition: item_geofunc.h:428
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:1783
static const char * LINESTRING_TYPE
Definition: item_geofunc.h:435
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:1353
longlong m_srid_found_in_document
The SRID value of the document CRS, if one is found.
Definition: item_geofunc.h:456
double m_min_latitude
The minimum allowed latitude value (inclusive).
Definition: item_geofunc.h:462
static const char * MULTIPOLYGON_TYPE
Definition: item_geofunc.h:438
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:1662
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:1036
bool m_user_provided_srid
Is set to true if user provided a SRID as an argument.
Definition: item_geofunc.h:449
static const char * GEOMETRIES_MEMBER
Definition: item_geofunc.h:426
double m_min_longitude
The minimum allowed longitude value (non-inclusive).
Definition: item_geofunc.h:458
static const char * LONG_EPSG_PREFIX
Definition: item_geofunc.h:431
enum_handle_coordinate_dimension m_handle_coordinate_dimension
How higher coordinate dimensions than currently supported should be handled.
Definition: item_geofunc.h:447
static const char * COORDINATES_MEMBER
Definition: item_geofunc.h:427
static const char * FEATURE_TYPE
Definition: item_geofunc.h:440
String * val_str(String *) override
<geometry> = ST_GEOMFROMGEOJSON(<string>[, <options>[, <srid>]])
Definition: item_geofunc.cc:864
gis::srid_t m_user_srid
The SRID user provided as an argument.
Definition: item_geofunc.h:451
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:1515
bool get_positions(const Json_array *coordinates, Gis_point *point)
Parse an array of coordinates to a Gis_point.
Definition: item_geofunc.cc:1253
const char * func_name() const override
Definition: item_geofunc.h:401
double m_max_longitude
The maximum allowed longitude (inclusive).
Definition: item_geofunc.h:460
double m_max_latitude
The maximum allowed latitude (inclusive).
Definition: item_geofunc.h:464
Item_func_geomfromgeojson(const POS &pos, Item *json_string, Item *options)
Definition: item_geofunc.h:391
static const char * CRS84_URN
Definition: item_geofunc.h:432
Geometry::wkbType get_wkbtype(const char *typestring)
Converts GeoJSON type string to a wkbType.
Definition: item_geofunc.cc:1625
static bool check_argument_valid_integer(Item *argument)
Checks if the supplied argument is a valid integer type.
Definition: item_geofunc.cc:1836
bool get_polygon(const Json_array *data_array, Gis_polygon *polygon)
Create a Gis_polygon from a JSON array.
Definition: item_geofunc.cc:1547
static const char * MULTIPOINT_TYPE
Definition: item_geofunc.h:434
Item_func_geomfromgeojson(const POS &pos, Item *json_string, Item *options, Item *srid)
Definition: item_geofunc.h:395
static const char * POINT_TYPE
Definition: item_geofunc.h:433
static const char * CRS_MEMBER
Definition: item_geofunc.h:422
bool fix_fields(THD *, Item **ref) override
Do type checking on all provided arguments.
Definition: item_geofunc.cc:1859
static const char * NAMED_CRS
Definition: item_geofunc.h:429
static const char * PROPERTIES_MEMBER
Definition: item_geofunc.h:424
Item_func_geomfromgeojson(const POS &pos, Item *json_string)
Definition: item_geofunc.h:386
static const char * GEOMETRYCOLLECTION_TYPE
Definition: item_geofunc.h:439
enum_handle_coordinate_dimension
Describing how coordinate dimensions higher than supported in MySQL should be handled.
Definition: item_geofunc.h:380
@ strip_now_reject_future
Definition: item_geofunc.h:383
@ reject_document
Definition: item_geofunc.h:381
@ strip_now_accept_future
Definition: item_geofunc.h:382
@ strip_now_strip_future
Definition: item_geofunc.h:384
static const char * FEATURES_MEMBER
Definition: item_geofunc.h:425
static const char * POLYGON_TYPE
Definition: item_geofunc.h:437
static const char * MULTILINESTRING_TYPE
Definition: item_geofunc.h:436
static const char * GEOMETRY_MEMBER
Definition: item_geofunc.h:423
Definition: item_geofunc.h:1297
longlong val_int() override
Definition: item_geofunc.cc:4764
Item_func_isclosed(const POS &pos, Item *a)
Definition: item_geofunc.h:1299
optimize_type select_optimize(const THD *) override
Definition: item_geofunc.h:1301
const char * func_name() const override
Definition: item_geofunc.h:1302
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1303
Definition: item_geofunc.h:1273
Item_func_isempty(const POS &pos, Item *a)
Definition: item_geofunc.h:1275
optimize_type select_optimize(const THD *) override
Definition: item_geofunc.h:1277
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1279
longlong val_int() override
Definition: item_geofunc.cc:4700
const char * func_name() const override
Definition: item_geofunc.h:1278
Definition: item_geofunc.h:1310
Item_func_isvalid(const POS &pos, Item *a)
Definition: item_geofunc.h:1312
optimize_type select_optimize(const THD *) override
Definition: item_geofunc.h:1314
const char * func_name() const override
Definition: item_geofunc.h:1315
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1316
longlong val_int() override
Definition: item_geofunc.cc:4786
This handles the <double> = ST_LATFROMGEOHASH(<string>) function.
Definition: item_geofunc.h:673
const char * func_name() const override
Definition: item_geofunc.h:679
Item_func_latfromgeohash(const POS &pos, Item *a)
Definition: item_geofunc.h:675
This is a superclass for Item_func_longfromgeohash and Item_func_latfromgeohash, since they share alm...
Definition: item_geofunc.h:613
const double lower_latitude
The lower limit for latitude output value.
Definition: item_geofunc.h:619
bool fix_fields(THD *thd, Item **ref) override
Definition: item_geofunc.cc:2887
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.cc:2881
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:647
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:644
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:2952
const double upper_longitude
The upper limit for longitude output value.
Definition: item_geofunc.h:637
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:3066
static bool check_geohash_argument_valid_type(Item *item)
Checks if geohash arguments is of valid type.
Definition: item_geofunc.cc:2911
const double upper_latitude
The upper limit for latitude output value.
Definition: item_geofunc.h:625
const double lower_longitude
The lower limit for longitude output value.
Definition: item_geofunc.h:631
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:3109
Definition: item_geofunc.h:1714
Item_func_lineinterpolate(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1716
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1723
String * val_str(String *str) override
Definition: item_geofunc.cc:5871
virtual bool returnMultiplePoints() const =0
virtual bool isFractionalDistance() const =0
Definition: item_geofunc.h:1730
bool isFractionalDistance() const override
Definition: item_geofunc.h:1737
Item_func_lineinterpolatepoint(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1732
const char * func_name() const override
Definition: item_geofunc.h:1736
bool returnMultiplePoints() const override
Definition: item_geofunc.h:1738
Definition: item_geofunc.h:1741
bool isFractionalDistance() const override
Definition: item_geofunc.h:1748
const char * func_name() const override
Definition: item_geofunc.h:1747
Item_func_lineinterpolatepoints(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1743
bool returnMultiplePoints() const override
Definition: item_geofunc.h:1749
This handles the <double> = ST_LONGFROMGEOHASH(<string>) function.
Definition: item_geofunc.h:686
Item_func_longfromgeohash(const POS &pos, Item *a)
Definition: item_geofunc.h:688
const char * func_name() const override
Definition: item_geofunc.h:692
Definition: item_geofunc.h:741
String * val_str(String *) override
Definition: item_geofunc.cc:3430
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:748
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:3426
Item_func_make_envelope(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:743
const char * func_name() const override
Definition: item_geofunc.h:745
Definition: item_geofunc.h:1068
Item_func_mbrcontains(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1070
enum Functype functype() const override
Definition: item_geofunc.h:1072
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:158
enum Functype rev_functype() const override
Definition: item_geofunc.h:1073
const char * func_name() const override
Definition: item_geofunc.h:1074
Definition: item_geofunc.h:1079
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:165
enum Functype rev_functype() const override
Definition: item_geofunc.h:1084
Item_func_mbrcoveredby(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1081
enum Functype functype() const override
Definition: item_geofunc.h:1083
const char * func_name() const override
Definition: item_geofunc.h:1085
Definition: item_geofunc.h:1090
enum Functype rev_functype() const override
Definition: item_geofunc.h:1095
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:172
Item_func_mbrcovers(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1092
enum Functype functype() const override
Definition: item_geofunc.h:1094
const char * func_name() const override
Definition: item_geofunc.h:1096
Definition: item_geofunc.h:1101
enum Functype functype() const override
Definition: item_geofunc.h:1105
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:178
const char * func_name() const override
Definition: item_geofunc.h:1107
Item_func_mbrdisjoint(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1103
enum Functype rev_functype() const override
Definition: item_geofunc.h:1106
Definition: item_geofunc.h:1112
Item_func_mbrequals(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1114
enum Functype functype() const override
Definition: item_geofunc.h:1116
const char * func_name() const override
Definition: item_geofunc.h:1118
enum Functype rev_functype() const override
Definition: item_geofunc.h:1117
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:185
Definition: item_geofunc.h:1123
enum Functype functype() const override
Definition: item_geofunc.h:1127
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:191
enum Functype rev_functype() const override
Definition: item_geofunc.h:1128
Item_func_mbrintersects(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1125
const char * func_name() const override
Definition: item_geofunc.h:1129
Definition: item_geofunc.h:1134
enum Functype functype() const override
Definition: item_geofunc.h:1138
Item_func_mbroverlaps(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1136
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:198
const char * func_name() const override
Definition: item_geofunc.h:1140
enum Functype rev_functype() const override
Definition: item_geofunc.h:1139
Definition: item_geofunc.h:1145
const char * func_name() const override
Definition: item_geofunc.h:1151
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:205
Item_func_mbrtouches(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1147
enum Functype functype() const override
Definition: item_geofunc.h:1149
enum Functype rev_functype() const override
Definition: item_geofunc.h:1150
Definition: item_geofunc.h:1156
const char * func_name() const override
Definition: item_geofunc.h:1162
Item_func_mbrwithin(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1158
enum Functype functype() const override
Definition: item_geofunc.h:1160
enum Functype rev_functype() const override
Definition: item_geofunc.h:1161
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:212
Definition: item_geofunc.h:1517
longlong val_int() override
Definition: item_geofunc.cc:4865
String value
Definition: item_geofunc.h:1518
const char * func_name() const override
Definition: item_geofunc.h:1523
Item_func_numgeometries(const POS &pos, Item *a)
Definition: item_geofunc.h:1521
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1524
Definition: item_geofunc.h:1532
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1539
Item_func_numinteriorring(const POS &pos, Item *a)
Definition: item_geofunc.h:1536
const char * func_name() const override
Definition: item_geofunc.h:1538
String value
Definition: item_geofunc.h:1533
longlong val_int() override
Definition: item_geofunc.cc:4846
Definition: item_geofunc.h:1547
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1554
longlong val_int() override
Definition: item_geofunc.cc:4884
String value
Definition: item_geofunc.h:1548
const char * func_name() const override
Definition: item_geofunc.h:1553
Item_func_numpoints(const POS &pos, Item *a)
Definition: item_geofunc.h:1551
Definition: item_geofunc.h:783
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:790
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:4217
String * val_str(String *) override
Definition: item_geofunc.cc:4221
const char * func_name() const override
Definition: item_geofunc.h:787
Item_func_point(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:785
This handles the <point> = ST_POINTFROMGEOHASH(<string>, <srid>) function.
Definition: item_geofunc.h:804
const double upper_latitude
The maximum output latitude value when decoding the geohash value.
Definition: item_geofunc.h:807
const double lower_longitude
The minimum output longitude value when decoding the geohash value.
Definition: item_geofunc.h:816
const double lower_latitude
The minimum output latitude value when decoding the geohash value.
Definition: item_geofunc.h:810
String * val_str(String *) override
Definition: item_geofunc.cc:4306
Item_func_pointfromgeohash(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:819
const char * func_name() const override
Definition: item_geofunc.h:825
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.cc:4300
const double upper_longitude
The maximum output longitude value when decoding the geohash value.
Definition: item_geofunc.h:813
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:4254
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.h:829
Definition: item_geofunc.h:892
Item_func_spatial_collection(const POS &pos, PT_item_list *list, enum Geometry::wkbType ct, enum Geometry::wkbType it)
Definition: item_geofunc.h:898
enum Geometry::wkbType item_type
Definition: item_geofunc.h:895
String tmp_value
Definition: item_geofunc.h:893
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:906
enum Geometry::wkbType coll_type
Definition: item_geofunc.h:894
String * val_str(String *) override
Concatenates various items into various collections with checkings for valid wkb type of items.
Definition: item_geofunc.cc:4389
const char * func_name() const override
Definition: item_geofunc.cc:4349
Definition: item_geofunc.h:862
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:864
const char * func_name() const override
Definition: item_geofunc.h:876
String * val_str(String *) override
Definition: item_geofunc.cc:4160
Item_func_spatial_decomp_n(const POS &pos, Item *a, Item *b, Item_func::Functype ft)
Definition: item_geofunc.h:871
enum Functype decomp_func_n
Definition: item_geofunc.h:863
Definition: item_geofunc.h:834
enum Functype decomp_func
Definition: item_geofunc.h:835
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:836
Item_func_spatial_decomp(const POS &pos, Item *a, Item_func::Functype ft)
Definition: item_geofunc.h:842
String * val_str(String *) override
Definition: item_geofunc.cc:4116
const char * func_name() const override
Definition: item_geofunc.h:846
Definition: item_geofunc.h:928
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.h:955
enum Functype rev_functype() const override
Definition: item_geofunc.h:943
enum Functype spatial_rel
Definition: item_geofunc.h:929
enum Functype functype() const override
Definition: item_geofunc.h:942
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:959
Item_func_spatial_mbr_rel(Item *a, Item *b, enum Functype sp_rel)
Definition: item_geofunc.h:932
Item_func_spatial_mbr_rel(const POS &pos, Item *a, Item *b, enum Functype sp_rel)
Definition: item_geofunc.h:936
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:963
Spatial operations.
Definition: item_geofunc.h:1203
Item_func_spatial_operation(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1205
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1209
Definition: item_geofunc.h:969
bool is_null() override
The method allows to determine nullness of a complex expression without fully evaluating it,...
Definition: item_geofunc.h:986
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:981
Item_func_spatial_relation(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:971
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:973
Definition: item_geofunc.h:1562
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1567
double val_real() override
Definition: item_geofunc.cc:5086
const char * func_name() const override
Definition: item_geofunc.h:1566
Item_func_st_area(const POS &pos, Item *a)
Definition: item_geofunc.h:1564
Definition: item_geofunc.h:1575
Item_func_st_buffer(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1580
String * val_str(String *) override
Definition: item_geofunc.cc:5137
const char * func_name() const override
Definition: item_geofunc.h:1584
bool parse_strategy(String *arg, gis::BufferStrategies &strats)
Parses strategy stored in String object, and sets values in strats.
Definition: item_geofunc.cc:5195
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1585
Definition: item_geofunc.h:1013
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:124
const char * func_name() const override
Definition: item_geofunc.h:1019
enum Functype rev_functype() const override
Definition: item_geofunc.h:1018
Item_func_st_contains(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1015
enum Functype functype() const override
Definition: item_geofunc.h:1017
Definition: item_geofunc.h:1024
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:131
enum Functype rev_functype() const override
Definition: item_geofunc.h:1029
enum Functype functype() const override
Definition: item_geofunc.h:1028
const char * func_name() const override
Definition: item_geofunc.h:1030
Item_func_st_crosses(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1026
Definition: item_geofunc.h:1215
String * val_str(String *) override
Definition: item_geofunc.cc:5586
Item_func_st_difference(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1217
const char * func_name() const override
Definition: item_geofunc.h:1220
Definition: item_geofunc.h:1035
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:138
enum Functype functype() const override
Definition: item_geofunc.h:1039
Item_func_st_disjoint(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1037
enum Functype rev_functype() const override
Definition: item_geofunc.h:1040
const char * func_name() const override
Definition: item_geofunc.h:1041
Definition: item_geofunc.h:1700
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1706
Item_func_st_distance_sphere(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1702
const char * func_name() const override
Definition: item_geofunc.h:1705
double val_real() override
Definition: item_geofunc.cc:5718
Definition: item_geofunc.h:1046
enum Functype rev_functype() const override
Definition: item_geofunc.h:1051
enum Functype functype() const override
Definition: item_geofunc.h:1050
const char * func_name() const override
Definition: item_geofunc.h:1052
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:145
Item_func_st_equals(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1048
Definition: item_geofunc.h:1672
Item_func_st_frechet_distance(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1674
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
double val_real() override
Definition: item_geofunc.cc:5458
Definition: item_geofunc.h:1686
Item_func_st_hausdorff_distance(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1688
const char * func_name() const override
Definition: item_geofunc.h:1691
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
double val_real() override
Definition: item_geofunc.cc:5522
Definition: item_geofunc.h:1223
String * val_str(String *) override
Definition: item_geofunc.cc:5815
const char * func_name() const override
Definition: item_geofunc.h:1228
Item_func_st_intersection(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1225
Definition: item_geofunc.h:1057
enum Functype functype() const override
Definition: item_geofunc.h:1061
enum Functype rev_functype() const override
Definition: item_geofunc.h:1062
Item_func_st_intersects(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1059
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:151
const char * func_name() const override
Definition: item_geofunc.h:1063
Definition: item_geofunc.h:1286
longlong val_int() override
Definition: item_geofunc.cc:4718
const char * func_name() const override
Definition: item_geofunc.h:1290
Item_func_st_issimple(const POS &pos, Item *a)
Definition: item_geofunc.h:1288
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1291
This class implements the two-parameter ST_Latitude function which sets the latitude of a geographic ...
Definition: item_geofunc.h:1400
Item_func_st_latitude_mutator(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1402
const char * func_name() const override
Definition: item_geofunc.h:1406
int coordinate_number(const dd::Spatial_reference_system *) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.h:1407
This class implements the one-parameter ST_Latitude function which returns the latitude coordinate of...
Definition: item_geofunc.h:1415
Item_func_st_latitude_observer(const POS &pos, Item *a)
Definition: item_geofunc.h:1417
const char * func_name() const override
Definition: item_geofunc.h:1421
int coordinate_number(const dd::Spatial_reference_system *) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.h:1422
Definition: item_geofunc.h:1594
const char * func_name() const override
Definition: item_geofunc.h:1601
String value
Definition: item_geofunc.h:1595
Item_func_st_length(const POS &pos, PT_item_list *ilist)
Definition: item_geofunc.h:1598
double val_real() override
Definition: item_geofunc.cc:5317
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1602
This class implements the two-parameter ST_Longitude function which sets the longitude coordinate of ...
Definition: item_geofunc.h:1430
Item_func_st_longitude_mutator(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1432
const char * func_name() const override
Definition: item_geofunc.h:1436
int coordinate_number(const dd::Spatial_reference_system *) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.h:1437
This class implements the one-parameter ST_Longitude function which returns the longitude coordinate ...
Definition: item_geofunc.h:1445
int coordinate_number(const dd::Spatial_reference_system *) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.h:1452
Item_func_st_longitude_observer(const POS &pos, Item *a)
Definition: item_geofunc.h:1447
const char * func_name() const override
Definition: item_geofunc.h:1451
Definition: item_geofunc.h:1167
Item_func_st_overlaps(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1169
enum Functype functype() const override
Definition: item_geofunc.h:1171
enum Functype rev_functype() const override
Definition: item_geofunc.h:1172
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:218
const char * func_name() const override
Definition: item_geofunc.h:1173
Definition: item_geofunc.h:1752
Item_func_st_pointatdistance(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1754
bool returnMultiplePoints() const override
Definition: item_geofunc.h:1760
bool isFractionalDistance() const override
Definition: item_geofunc.h:1759
const char * func_name() const override
Definition: item_geofunc.h:1758
Item that implements function ST_Simplify, which simplifies a geometry using the Douglas-Peucker algo...
Definition: item_geofunc.h:769
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:773
String * val_str(String *) override
Definition: item_geofunc.cc:4069
Item_func_st_simplify(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:771
const char * func_name() const override
Definition: item_geofunc.h:780
This class implements the two-parameter ST_SRID function which sets the SRID of a geometry.
Definition: item_geofunc.h:1613
String * val_str(String *) override
Definition: item_geofunc.cc:5412
const char * func_name() const override
Definition: item_geofunc.h:1618
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1619
Item_func_st_srid_mutator(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1615
This class implements the one-parameter ST_SRID function which returns the SRID of a geometry.
Definition: item_geofunc.h:1628
Item_func_st_srid_observer(const POS &pos, Item *a)
Definition: item_geofunc.h:1630
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1633
const char * func_name() const override
Definition: item_geofunc.h:1632
longlong val_int() override
Definition: item_geofunc.cc:5372
Definition: item_geofunc.h:1231
String * val_str(String *) override
Definition: item_geofunc.cc:5942
Item_func_st_symdifference(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1233
const char * func_name() const override
Definition: item_geofunc.h:1236
Definition: item_geofunc.h:1178
enum Functype functype() const override
Definition: item_geofunc.h:1182
Item_func_st_touches(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1180
enum Functype rev_functype() const override
Definition: item_geofunc.h:1183
const char * func_name() const override
Definition: item_geofunc.h:1184
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:225
This class implements ST_Transform function that transforms a geometry from one SRS to another.
Definition: item_geofunc.h:1765
const char * func_name() const override
Definition: item_geofunc.h:1772
String * val_str(String *str) override
Definition: item_geofunc.cc:6007
Item_func_st_transform(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1767
Definition: item_geofunc.h:1239
Item_func_st_union(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1241
String * val_str(String *) override
Definition: item_geofunc.cc:4635
const char * func_name() const override
Definition: item_geofunc.h:1244
Definition: item_geofunc.h:1189
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:232
enum Functype rev_functype() const override
Definition: item_geofunc.h:1194
enum Functype functype() const override
Definition: item_geofunc.h:1193
Item_func_st_within(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1191
const char * func_name() const override
Definition: item_geofunc.h:1195
This class implements the two-parameter ST_X function which sets the X coordinate of a point.
Definition: item_geofunc.h:1459
int coordinate_number(const dd::Spatial_reference_system *srs) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.cc:5029
Item_func_st_x_mutator(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1461
const char * func_name() const override
Definition: item_geofunc.h:1465
This class implements the one-parameter ST_X function which returns the X coordinate of a point.
Definition: item_geofunc.h:1471
int coordinate_number(const dd::Spatial_reference_system *srs) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.cc:5035
Item_func_st_x_observer(const POS &pos, Item *a)
Definition: item_geofunc.h:1473
const char * func_name() const override
Definition: item_geofunc.h:1477
This class implements the two-parameter ST_Y function which sets the Y coordinate of a point.
Definition: item_geofunc.h:1483
int coordinate_number(const dd::Spatial_reference_system *srs) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.cc:5041
const char * func_name() const override
Definition: item_geofunc.h:1489
Item_func_st_y_mutator(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:1485
This class implements the one-parameter ST_Y function which returns the Y coordinate of a point.
Definition: item_geofunc.h:1495
int coordinate_number(const dd::Spatial_reference_system *srs) const override
Returns the coordinate number accessed by this item.
Definition: item_geofunc.cc:5047
const char * func_name() const override
Definition: item_geofunc.h:1501
Item_func_st_y_observer(const POS &pos, Item *a)
Definition: item_geofunc.h:1497
Definition: item_geofunc.h:1505
const char * func_name() const override
Definition: item_geofunc.h:1513
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1506
String * val_str(String *) override
Definition: item_geofunc.cc:5053
Item_func_swap_xy(const POS &pos, Item *a)
Definition: item_geofunc.h:1512
Definition: item_geofunc.h:754
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:760
String * val_str(String *) override
Definition: item_geofunc.cc:3386
const char * func_name() const override
Definition: item_geofunc.h:759
Item_func_validate(const POS &pos, Item *a)
Definition: item_geofunc.h:758
String arg_val
Definition: item_geofunc.h:755
Item ** args
Array of pointers to arguments.
Definition: item_func.h:107
virtual enum Functype functype() const
Definition: item_func.h:329
Functype
Definition: item_func.h:183
@ SP_CROSSES_FUNC
Definition: item_func.h:211
@ SP_EXTERIORRING
Definition: item_func.h:219
@ SP_EQUALS_FUNC
Definition: item_func.h:206
@ SP_COVEREDBY_FUNC
Definition: item_func.h:214
@ SP_TOUCHES_FUNC
Definition: item_func.h:210
@ SP_DISJOINT_FUNC
Definition: item_func.h:207
@ SP_STARTPOINT
Definition: item_func.h:217
@ SP_POINTN
Definition: item_func.h:220
@ SP_GEOMETRYN
Definition: item_func.h:221
@ TYPECAST_FUNC
Definition: item_func.h:232
@ SP_DISTANCE_FUNC
Definition: item_func.h:208
@ SP_WITHIN_FUNC
Definition: item_func.h:212
@ SP_INTERIORRINGN
Definition: item_func.h:222
@ SP_INTERSECTS_FUNC
Definition: item_func.h:209
@ SP_COVERS_FUNC
Definition: item_func.h:215
@ SP_CONTAINS_FUNC
Definition: item_func.h:213
@ SP_ENDPOINT
Definition: item_func.h:218
@ SP_OVERLAPS_FUNC
Definition: item_func.h:216
optimize_type
Definition: item_func.h:321
@ OPTIMIZE_NONE
Definition: item_func.h:322
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:674
enum Type type() const override
Definition: item_func.h:328
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:526
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:737
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:130
Definition: item_geofunc.h:178
Field * tmp_table_field(TABLE *t_arg) override
Definition: item_geofunc.cc:298
Item_geometry_func(Item *a, Item *b)
Definition: item_geofunc.h:185
Item_geometry_func(const POS &pos, Item *a, Item *b, Item *c)
Definition: item_geofunc.h:190
Item_geometry_func(Item *a)
Definition: item_geofunc.h:182
Item_geometry_func(Item *a, Item *b, Item *c)
Definition: item_geofunc.h:189
Item_geometry_func(const POS &pos, Item *a)
Definition: item_geofunc.h:183
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.cc:307
Item_geometry_func()
Definition: item_geofunc.h:180
Item_geometry_func(const POS &pos, Item *a, Item *b)
Definition: item_geofunc.h:186
Definition: item_func.h:977
Base class for all item functions that a return JSON value.
Definition: item_json_func.h:156
Definition: item_func.h:789
Definition: item_strfunc.h:147
Definition: item_strfunc.h:75
Definition: item_geofunc.h:1776
const char * func_name() const override=0
enum Functype functype() const override
Definition: item_geofunc.h:1784
Item_typecast_geometry(const POS &pos, Item *a)
Definition: item_geofunc.h:1778
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_geofunc.h:1786
String * val_str(String *str) override
Definition: item_geofunc.cc:6075
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:1892
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:7014
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:6959
const char * func_name() const override
Definition: item_geofunc.h:1898
Item_typecast_geometrycollection(const POS &pos, Item *a)
Definition: item_geofunc.h:1894
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:7009
Definition: item_geofunc.h:1821
Item_typecast_linestring(const POS &pos, Item *a)
Definition: item_geofunc.h:1823
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6317
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:6196
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6313
const char * func_name() const override
Definition: item_geofunc.h:1827
Definition: item_geofunc.h:1863
Item_typecast_multilinestring(const POS &pos, Item *a)
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:6650
const char * func_name() const override
Definition: item_geofunc.h:1869
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6787
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6783
Definition: item_geofunc.h:1849
Item_typecast_multipoint(const POS &pos, Item *a)
Definition: item_geofunc.h:1851
const char * func_name() const override
Definition: item_geofunc.h:1855
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6643
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6639
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:6549
Definition: item_geofunc.h:1877
Item_typecast_multipolygon(const POS &pos, Item *a)
Definition: item_geofunc.h:1879
const char * func_name() const override
Definition: item_geofunc.h:1883
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6952
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:6794
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6948
Definition: item_geofunc.h:1807
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:6123
const char * func_name() const override
Definition: item_geofunc.h:1813
Item_typecast_point(const POS &pos, Item *a)
Definition: item_geofunc.h:1809
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6189
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6185
Definition: item_geofunc.h:1835
Field::geometry_type get_geometry_type() const override
Definition: item_geofunc.cc:6538
const char * func_name() const override
Definition: item_geofunc.h:1841
Item_typecast_polygon(const POS &pos, Item *a)
Definition: item_geofunc.h:1837
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_geofunc.cc:6542
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:6324
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:933
void set_nullable(bool nullable)
Definition: item.h:3627
void set_data_type_blob(enum_field_types type, uint32 max_l)
Set the Item to be of BLOB type.
Definition: item.h:1670
static const CHARSET_INFO * default_charset()
Definition: item.cc:1802
virtual void print(const THD *, String *str, enum_query_type) const
This method is used for to:
Definition: item.h:2461
enum_field_types data_type() const
Retrieve the derived data type of the Item.
Definition: item.h:1472
bool fixed
True if item has been resolved.
Definition: item.h:3615
bool null_value
True if item is null.
Definition: item.h:3652
void set_data_type_string(uint32 max_l)
Set the Item to be variable length string.
Definition: item.h:1587
uint32 max_length
Maximum length of result of evaluating this item, in number of bytes.
Definition: item.h:3543
Represents a JSON array container, i.e.
Definition: json_dom.h:514
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:367
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1161
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:104
void error(Context *pc, const POS &pos) const
syntax_error() function replacement for deferred reporting of syntax errors
Definition: parse_tree_node_base.h:343
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_lexer_thd.h:35
Definition: spatial_reference_system.h:52
Abstract superclass for all geometric objects.
Definition: geometries.h:99
static char buf[MAX_BUF]
Definition: conf_to_src.cc:72
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
This file contains the field type.
@ MYSQL_TYPE_LONGLONG
Definition: field_types.h:63
@ MYSQL_TYPE_LONG_BLOB
Definition: field_types.h:84
@ MYSQL_TYPE_GEOMETRY
Definition: field_types.h:88
@ MYSQL_TYPE_DOUBLE
Definition: field_types.h:60
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:470
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:906
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1065
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:417
Definition: options.cc:56
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2877
Performance schema instrumentation interface.
void gis_wkb_raw_free(void *p)
Definition: spatial.h:210
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.
Bison "location" class.
Definition: parse_location.h:42
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:419
Definition: table.h:1403
Definition: buffer_strategies.h:44
Definition: result.h:29