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