MySQL 9.0.0
Source Code Documentation
item_json_func.h
Go to the documentation of this file.
1#ifndef ITEM_JSON_FUNC_INCLUDED
2#define ITEM_JSON_FUNC_INCLUDED
3
4/* Copyright (c) 2015, 2024, 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 <cstdint>
31#include <memory>
32#include <utility> // std::forward
33
34#include "field_types.h"
35#include "my_alloc.h"
36#include "my_inttypes.h"
37#include "my_table_map.h"
38#include "my_time.h"
41#include "mysql_com.h"
42#include "mysql_time.h"
43#include "prealloced_array.h" // Prealloced_array
45#include "sql-common/json_path.h" // Json_path
46#include "sql-common/json_schema.h" //Json_schema_validator_holder
47#include "sql/enum_query_type.h"
48#include "sql/field.h"
49#include "sql/item.h"
50#include "sql/item_cmpfunc.h"
51#include "sql/item_func.h"
52#include "sql/item_strfunc.h" // Item_str_func
53#include "sql/mem_root_array.h" // Mem_root_array
54#include "sql/parse_location.h" // POS
55#include "sql/psi_memory_key.h" // key_memory_JSON
56#include "sql_string.h"
57
58class Json_array;
60class Json_dom;
61class Json_object;
64class Json_wrapper;
65class PT_item_list;
66class THD;
67class my_decimal;
68enum Cast_target : unsigned char;
69enum class Json_on_response_type : uint16;
70enum class enum_json_diff_status;
71
72struct Cast_type;
73struct TABLE;
74
75/** For use by JSON_CONTAINS_PATH() and JSON_SEARCH() */
82};
83
84/**
85 Path cache for JSON functions. Caches parsed path
86 objects for arguments which are string literals.
87 Maintains a vector of path objects and an array of
88 ints which map path argument numbers to slots in
89 the array.
90*/
92 private:
93 /// Holder for path strings.
95
96 /// List of paths.
98
99 /// Enum that tells the status of a cell in m_paths.
100 enum class enum_path_status : uint8 {
103 OK_NULL,
104 };
105
106 /// Struct that points to a cell in m_paths and tells its status.
107 struct Path_cell {
109 size_t m_index = 0;
110 };
111
112 /// Map argument indexes to indexes into m_paths.
114
115 public:
116 Json_path_cache(THD *thd, uint size);
118
119 /**
120 Parse a path expression if necessary. Does nothing if the path
121 expression is constant and it has already been parsed. Assumes that
122 we've already verified that the path expression is not null. Raises an
123 error if the path expression is syntactically incorrect. Raises an
124 error if the path expression contains wildcard tokens but is not
125 supposed to. Otherwise puts the parsed path onto the
126 path vector.
127
128 @param[in] thd THD handle
129 @param[in] args Array of args to a JSON function
130 @param[in] arg_idx Index of the path_expression in args
131 @param[in] forbid_wildcards True if the path shouldn't contain * or **
132
133 @returns false on success (valid path or NULL), true on error
134 */
135 bool parse_and_cache_path(const THD *thd, Item **args, uint arg_idx,
136 bool forbid_wildcards);
137
138 /**
139 Return an already parsed path expression.
140
141 @param[in] arg_idx Index of the path_expression in the JSON function args
142
143 @returns the already parsed path, possibly NULL
144 */
145 const Json_path *get_path(uint arg_idx) const;
146
147 /**
148 Reset the cache for re-use when a statement is re-executed.
149 */
150 void reset_cache();
151};
152
153/* JSON function support */
154
155/**
156 Base class for all item functions that a return JSON value
157*/
158class Item_json_func : public Item_func {
159 /// Can this function type be used in partial update?
160 virtual bool can_use_in_partial_update() const { return false; }
161
162 protected:
163 /// String used when reading JSON binary values or JSON text values.
165 /// String used for converting JSON text values to utf8mb4 charset.
167 /// String used for converting a JSON value to text in val_str().
169
170 // Cache for constant path expressions
172
173 /**
174 Target column for partial update, if this function is used in an
175 update statement and partial update can be used.
176 */
178
179 public:
180 /**
181 Construct an Item_json_func instance.
182 @param thd THD handle
183 @param parent_args arguments to forward to Item_func's constructor
184 */
185 template <typename... Args>
186 Item_json_func(THD *thd, Args &&... parent_args)
187 : Item_func(std::forward<Args>(parent_args)...),
188 m_path_cache(thd, arg_count) {
190 }
191
192 bool resolve_type(THD *) override {
193 if (reject_vector_args()) return true;
194 set_nullable(true);
195 return false;
196 }
197 enum Item_result result_type() const override { return STRING_RESULT; }
198 String *val_str(String *arg) override;
199 bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override;
200 bool get_time(MYSQL_TIME *ltime) override;
201 longlong val_int() override;
202 double val_real() override;
203 my_decimal *val_decimal(my_decimal *decimal_value) override;
204
205 void cleanup() override;
206
207 Item_result cast_to_int_type() const override { return INT_RESULT; }
208
209 /**
210 Does this function call support partial update of the given JSON column?
211
212 JSON_SET, JSON_REPLACE and JSON_REMOVE support partial update of a JSON
213 column if the JSON column is the first argument of the function call, or if
214 the first argument is a sequence of nested JSON_SET, JSON_REPLACE and
215 JSON_REMOVE calls in which the JSON column is the first argument of the
216 inner function call.
217
218 For example, this expression can be used to partially update column
219 `json_col`:
220
221 JSON_SET(JSON_REPLACE(json_col, path1, val1), path2, val2)
222 */
223 bool supports_partial_update(const Field_json *field) const override;
224
225 /**
226 Mark this expression as used in partial update. Should only be
227 called if #supports_partial_update returns true.
228 */
229 void mark_for_partial_update(const Field_json *field);
230};
231
232bool sql_scalar_to_json(Item *arg, const char *calling_function, String *value,
233 String *tmp, Json_wrapper *wr,
234 Json_scalar_holder *scalar, bool scalar_string);
235
236/**
237 Return the JSON value of the argument in a wrapper.
238
239 Handles arguments with type JSON, including array objects (which do
240 not report type JSON but rather the type of individual elements).
241
242 Does not handle literals.
243 See also get_json_wrapper.
244
245 @param[in] arg the argument
246 @param[in,out] result the JSON value wrapper
247 @param[out] has_value true if argument was handled, false otherwise
248 undefined when error
249*/
250bool json_value(Item *arg, Json_wrapper *result, bool *has_value);
251
252/**
253 Return the JSON value of the argument in a wrapper. Abstracts whether
254 the value comes from a field or a function or a valid JSON text.
255
256 @param[in] args the arguments
257 @param[in] arg_idx the argument index
258 @param[out] str the string buffer
259 @param[in] func_name the name of the function we are executing
260 @param[out] wrapper the JSON value wrapper
261 @returns false if we found a value or NULL, true if not.
262*/
263bool get_json_wrapper(Item **args, uint arg_idx, String *str,
264 const char *func_name, Json_wrapper *wrapper);
265
266/**
267 Convert Json values or MySQL values to JSON.
268
269 @param[in] args arguments to function
270 @param[in] arg_idx the index of the argument to process
271 @param[in] calling_function name of the calling function
272 @param[in,out] value working area (if the returned Json_wrapper points
273 to a binary value rather than a DOM, this string
274 will end up holding the binary representation, and
275 it must stay alive until the wrapper is destroyed
276 or converted from binary to DOM)
277 @param[in,out] tmp temporary scratch space for converting strings to
278 the correct charset; only used if accept_string is
279 true and conversion is needed
280 @param[in,out] wr the result wrapper
281 @param[in,out] scalar pointer to pre-allocated memory that can be
282 borrowed by the result wrapper if the result is a
283 scalar. If the pointer is NULL, memory for a
284 scalar result will be allocated on the heap.
285 @param[in] accept_string
286 if true, accept MySQL strings as JSON strings
287 by converting them to UTF8, else emit an error
288 @returns false if we found a value or NULL, true otherwise
289*/
290bool get_json_atom_wrapper(Item **args, uint arg_idx,
291 const char *calling_function, String *value,
292 String *tmp, Json_wrapper *wr,
293 Json_scalar_holder *scalar, bool accept_string);
294
295/**
296 Check a non-empty val for character set. If it has character set
297 my_charset_binary, signal error and return false. Else, try to convert to
298 my_charset_utf8mb4_bin. If this fails, signal error and return true, else
299 return false.
300
301 @param[in] val the string to be checked
302 @param[in,out] buf buffer to hold the converted string
303 @param[out] resptr the resulting, possibly converted string,
304 only set if no error
305 @param[out] reslength the length of resptr
306 @param[in] require_string
307 If true, give error messages if binary string. If we
308 see a conversion error (space), we give error
309 notwithstanding this parameter value
310
311 @returns True if the string could not be converted. False on success.
312*/
313bool ensure_utf8mb4(const String &val, String *buf, const char **resptr,
314 size_t *reslength, bool require_string);
315
316/**
317 Represents the JSON function JSON_VALID( <value> )
318*/
321
322 public:
323 Item_func_json_valid(const POS &pos, Item *a) : Item_int_func(pos, a) {}
324
325 const char *func_name() const override { return "json_valid"; }
326 enum Functype functype() const override { return JSON_VALID_FUNC; }
327
328 bool is_bool_func() const override { return true; }
329
330 longlong val_int() override;
331
332 bool resolve_type(THD *thd) override {
333 if (reject_vector_args()) return true;
334 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_JSON)) return true;
335 set_nullable(true);
336 return false;
337 }
338};
339
340/**
341 Represents the JSON function JSON_SCHEMA_VALID( <json schema>, <json doc> )
342*/
344 public:
345 Item_func_json_schema_valid(const POS &pos, Item *a, Item *b);
347
348 const char *func_name() const override { return "json_schema_valid"; }
349
350 bool val_bool() override;
351
352 longlong val_int() override { return val_bool() ? 1 : 0; }
353
354 bool fix_fields(THD *, Item **) override;
355
356 void cleanup() override;
357
358 private:
360};
361
362/**
363 Represents the JSON function
364 JSON_SCHEMA_VALIDATION_REPORT( <json schema>, <json doc> )
365*/
367 public:
369 PT_item_list *a);
371
372 const char *func_name() const override {
373 return "json_schema_validation_report";
374 }
375
376 bool val_json(Json_wrapper *wr) override;
377
378 bool resolve_type(THD *thd) override {
379 if (reject_vector_args()) return true;
380 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_JSON)) return true;
381 set_nullable(true);
382 return false;
383 }
384
385 bool fix_fields(THD *, Item **) override;
386
387 void cleanup() override;
388
389 private:
391};
392
393/**
394 Represents the JSON function JSON_CONTAINS()
395*/
399
400 public:
402 : Item_int_func(pos, a), m_path_cache(thd, arg_count) {}
403
404 const char *func_name() const override { return "json_contains"; }
405 enum Functype functype() const override { return JSON_CONTAINS; }
406 optimize_type select_optimize(const THD *) override { return OPTIMIZE_KEY; }
407 bool gc_subst_analyzer(uchar **) override { return true; }
408
409 bool is_bool_func() const override { return true; }
410
411 longlong val_int() override;
412
413 bool resolve_type(THD *thd) override {
414 if (reject_vector_args()) return true;
415 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_JSON)) return true;
416 if (param_type_is_default(thd, 1, 3)) return true;
417 set_nullable(true);
418 return false;
419 }
420
421 /** Cleanup between executions of the statement */
422 void cleanup() override;
423
425 return (arg == args[0] || arg == args[1]) ? CACHE_JSON_VALUE : CACHE_NONE;
426 }
427};
428
429/**
430 Represents the JSON function JSON_CONTAINS_PATH()
431*/
435
436 // Cache for constant path expressions
438
439 public:
441 : Item_int_func(pos, a),
443 m_path_cache(thd, arg_count) {}
444
445 const char *func_name() const override { return "json_contains_path"; }
446 enum Functype functype() const override { return JSON_CONTAINS_PATH_FUNC; }
447
448 bool is_bool_func() const override { return true; }
449
450 longlong val_int() override;
451
452 bool resolve_type(THD *thd) override {
453 if (reject_vector_args()) return true;
454 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_JSON)) return true;
455 if (param_type_is_default(thd, 1, -1)) return true;
456 set_nullable(true);
457 return false;
458 }
459
460 /** Cleanup between executions of the statement */
461 void cleanup() override;
462
464 return (arg == args[0]) ? CACHE_JSON_VALUE : CACHE_NONE;
465 }
466};
467
468/**
469 Represents the JSON function JSON_TYPE
470*/
473
474 public:
475 Item_func_json_type(const POS &pos, Item *a) : Item_str_func(pos, a) {}
476
477 const char *func_name() const override { return "json_type"; }
478 enum Functype functype() const override { return JSON_TYPE_FUNC; }
479
480 bool resolve_type(THD *) override;
481
482 String *val_str(String *) override;
483};
484
485/**
486 Represents a "CAST( <value> AS JSON )" coercion.
487*/
488class Item_typecast_json final : public Item_json_func {
490
491 public:
492 Item_typecast_json(THD *thd, const POS &pos, Item *a)
493 : Item_json_func(thd, pos, a) {}
494
495 bool resolve_type(THD *thd) override {
496 if (reject_vector_args()) return true;
497 if (Item_json_func::resolve_type(thd)) return true;
498 return args[0]->propagate_type(thd, MYSQL_TYPE_JSON, false, true);
499 }
500
501 void print(const THD *thd, String *str,
502 enum_query_type query_type) const override;
503 const char *func_name() const override { return "cast_as_json"; }
504 const char *cast_type() const { return "json"; }
505 bool val_json(Json_wrapper *wr) override;
506};
507
508/**
509 Represents the JSON function JSON_LENGTH()
510*/
513
514 public:
515 Item_func_json_length(const POS &pos, Item *doc) : Item_int_func(pos, doc) {}
516
517 bool resolve_type(THD *thd) override {
518 if (reject_vector_args()) return true;
519 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_JSON)) return true;
520 if (param_type_is_default(thd, 1, 2)) return true;
521 set_nullable(true);
522 return false;
523 }
524
525 const char *func_name() const override { return "json_length"; }
526 enum Functype functype() const override { return JSON_LENGTH_FUNC; }
527
528 longlong val_int() override;
529};
530
531/**
532 Represents the JSON function JSON_DEPTH()
533*/
536
537 public:
538 Item_func_json_depth(const POS &pos, Item *a) : Item_int_func(pos, a) {}
539
540 const char *func_name() const override { return "json_depth"; }
541 enum Functype functype() const override { return JSON_DEPTH_FUNC; }
542
543 bool resolve_type(THD *thd) override {
544 if (reject_vector_args()) return true;
545 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_JSON)) return true;
546 set_nullable(true);
547 return false;
548 }
549
550 longlong val_int() override;
551};
552
553/**
554 Represents the JSON function JSON_KEYS()
555*/
558
559 public:
560 Item_func_json_keys(THD *thd, const POS &pos, Item *a)
561 : Item_json_func(thd, pos, a) {}
562
563 Item_func_json_keys(THD *thd, const POS &pos, Item *a, Item *b)
564 : Item_json_func(thd, pos, a, b) {}
565
566 const char *func_name() const override { return "json_keys"; }
567
568 bool resolve_type(THD *thd) override {
569 if (reject_vector_args()) return true;
570 if (Item_json_func::resolve_type(thd)) return true;
571 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_JSON)) return true;
572 if (param_type_is_default(thd, 1, 2)) return true;
573 return false;
574 }
575
576 bool val_json(Json_wrapper *wr) override;
577};
578
579/**
580 Represents the JSON function JSON_EXTRACT()
581*/
584
585 public:
587 : Item_json_func(thd, pos, a) {}
588
589 Item_func_json_extract(THD *thd, const POS &pos, Item *a, Item *b)
590 : Item_json_func(thd, pos, a, b) {}
591
592 const char *func_name() const override { return "json_extract"; }
593 enum Functype functype() const override { return JSON_EXTRACT_FUNC; }
594
595 bool resolve_type(THD *thd) override {
596 if (reject_vector_args()) return true;
597 if (Item_json_func::resolve_type(thd)) return true;
598 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_JSON)) return true;
599 if (param_type_is_default(thd, 1, -1)) return true;
600 return false;
601 }
602
603 bool val_json(Json_wrapper *wr) override;
604
605 bool eq(const Item *item) const override;
606};
607
608/// Base class for all the functions that take a JSON document as the first
609/// argument and one of more pairs of a JSON path and a value to insert into the
610/// JSON document, and returns the modified JSON document.
612 protected:
613 template <typename... Args>
614 explicit Item_func_modify_json_in_path(Args &&... parent_args)
615 : Item_json_func(std::forward<Args>(parent_args)...) {
616 // The function does not necessarily return NULL when an argument is NULL.
617 // It returns NULL only if the first argument is NULL, or if one of the JSON
618 // path arguments is null. The set of tables for which the function is
619 // null-rejecting, is calculated in resolve_type() and possibly updated in
620 // update_used_tables().
621 null_on_null = false;
622 }
624
625 public:
626 bool resolve_type(THD *thd) final;
627 void update_used_tables() final;
628
629 private:
630 /// Calculates the set of tables to return from not_used_tables(). The
631 /// returned value is cached by resolve_type() and update_used_tables().
633};
634
635/**
636 Represents the JSON function JSON_ARRAY_APPEND()
637*/
639 public:
641 : Item_func_modify_json_in_path(thd, pos, a) {}
642
643 const char *func_name() const override { return "json_array_append"; }
644
645 bool val_json(Json_wrapper *wr) override;
646};
647
648/**
649 Represents the JSON function JSON_INSERT()
650*/
652 public:
654 : Item_func_modify_json_in_path(thd, pos, a) {}
655
656 const char *func_name() const override { return "json_insert"; }
657
658 bool val_json(Json_wrapper *wr) override;
659};
660
661/**
662 Represents the JSON function JSON_ARRAY_INSERT()
663*/
665 public:
667 : Item_func_modify_json_in_path(thd, pos, a) {}
668
669 const char *func_name() const override { return "json_array_insert"; }
670
671 bool val_json(Json_wrapper *wr) override;
672};
673
674/**
675 Common base class for JSON_SET() and JSON_REPLACE().
676*/
678 /// True if this is JSON_SET, false if it is JSON_REPLACE.
679 const bool m_json_set;
681 bool can_use_in_partial_update() const override { return true; }
682
683 protected:
684 template <typename... Args>
685 explicit Item_func_json_set_replace(bool json_set, Args &&... parent_args)
686 : Item_func_modify_json_in_path(std::forward<Args>(parent_args)...),
687 m_json_set(json_set),
688 m_path(key_memory_JSON) {}
689
690 public:
691 bool val_json(Json_wrapper *wr) override;
692};
693
694/**
695 Represents the JSON function JSON_SET()
696*/
698 public:
699 template <typename... Args>
700 explicit Item_func_json_set(Args &&... parent_args)
701 : Item_func_json_set_replace(true, std::forward<Args>(parent_args)...) {}
702
703 const char *func_name() const override { return "json_set"; }
704};
705
706/**
707 Represents the JSON function JSON_REPLACE()
708*/
710 public:
711 template <typename... Args>
712 explicit Item_func_json_replace(Args &&... parent_args)
713 : Item_func_json_set_replace(false, std::forward<Args>(parent_args)...) {}
714
715 const char *func_name() const override { return "json_replace"; }
716};
717
718/**
719 Represents the JSON function JSON_ARRAY()
720*/
722 public:
723 template <typename... Args>
724 explicit Item_func_json_array(Args &&... parent_args)
725 : Item_json_func(std::forward<Args>(parent_args)...) {
726 // Does not return NULL on NULL input. A NULL argument is interpreted as the
727 // JSON null literal.
728 null_on_null = false;
729 }
730
731 const char *func_name() const override { return "json_array"; }
732 enum Functype functype() const override { return JSON_ARRAY_FUNC; }
733
734 bool resolve_type(THD *thd) override {
735 if (Item_json_func::resolve_type(thd)) return true;
736 if (param_type_is_default(thd, 0, -1)) return true;
737 return false;
738 }
739
740 bool val_json(Json_wrapper *wr) override;
741};
742
743/**
744 Represents the JSON function JSON_OBJECT()
745*/
748
749 public:
751 : Item_json_func(thd, pos, a) {
752 // Does not return NULL on NULL input. If a key argument is NULL, an error
753 // is raised. If a value argument is NULL, it is interpreted as the JSON
754 // null literal.
755 null_on_null = false;
756 }
757
758 const char *func_name() const override { return "json_object"; }
759 enum Functype functype() const override { return JSON_OBJECT_FUNC; }
760
761 bool resolve_type(THD *thd) override {
762 if (Item_json_func::resolve_type(thd)) return true;
763 if (param_type_is_default(thd, 0, -1)) return true;
764 return false;
765 }
766
767 bool val_json(Json_wrapper *wr) override;
768};
769
770/**
771 Represents the JSON function JSON_SEARCH()
772*/
776
777 // LIKE machinery
780
781 public:
782 /**
783 Construct a JSON_SEARCH() node.
784
785 @param parent_args arguments to pass to Item_json_func's constructor
786 */
787 template <typename... Args>
788 Item_func_json_search(Args &&... parent_args)
789 : Item_json_func(std::forward<Args>(parent_args)...),
790 m_cached_ooa(ooa_uninitialized) {}
791
792 const char *func_name() const override { return "json_search"; }
793
794 enum Functype functype() const override { return JSON_SEARCH_FUNC; }
795
796 bool val_json(Json_wrapper *wr) override;
797
798 /**
799 Bind logic for the JSON_SEARCH() node.
800 */
801 bool fix_fields(THD *, Item **) override;
802
803 bool resolve_type(THD *thd) override {
804 if (Item_json_func::resolve_type(thd)) return true;
805 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_JSON)) return true;
806 if (param_type_is_default(thd, 1, -1)) return true;
807 return false;
808 }
809
810 void cleanup() override;
811};
812
813/**
814 Represents the JSON function JSON_REMOVE()
815*/
818 bool can_use_in_partial_update() const override { return true; }
819
820 public:
821 template <typename... Args>
822 Item_func_json_remove(Args &&... parent_args)
823 : Item_json_func(std::forward<Args>(parent_args)...) {}
824
825 const char *func_name() const override { return "json_remove"; }
826
827 bool resolve_type(THD *thd) override {
828 if (Item_json_func::resolve_type(thd)) return true;
829 if (param_type_is_default(thd, 0, 1, MYSQL_TYPE_JSON)) return true;
830 if (param_type_is_default(thd, 1, -1)) return true;
831 return false;
832 }
833
834 bool val_json(Json_wrapper *wr) override;
835};
836
837/**
838 Represents the JSON function JSON_MERGE_PRESERVE.
839*/
841 public:
843 : Item_json_func(thd, pos, a) {}
844
845 const char *func_name() const override { return "json_merge_preserve"; }
846
847 bool resolve_type(THD *thd) override {
848 if (Item_json_func::resolve_type(thd)) return true;
849 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_JSON)) return true;
850 return false;
851 }
852
853 bool val_json(Json_wrapper *wr) override;
854};
855
856/**
857 Represents the JSON function JSON_MERGE. It is a deprecated alias
858 for JSON_MERGE_PRESERVE.
859*/
861 public:
862 Item_func_json_merge(THD *thd, const POS &pos, PT_item_list *a);
863
864 bool is_deprecated() const override { return true; }
865};
866
867/**
868 Represents the JSON function JSON_MERGE_PATCH.
869*/
871 public:
873 : Item_json_func(thd, pos, a) {}
874
875 const char *func_name() const override { return "json_merge_patch"; }
876
877 bool resolve_type(THD *thd) override {
878 if (Item_json_func::resolve_type(thd)) return true;
879 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_JSON)) return true;
880 return false;
881 }
882
883 bool val_json(Json_wrapper *wr) override;
884};
885
886/**
887 Represents the JSON function JSON_QUOTE()
888*/
891
892 public:
894 : Item_str_func(pos, a) {}
895
896 const char *func_name() const override { return "json_quote"; }
897
898 enum Functype functype() const override { return JSON_QUOTE_FUNC; }
899
900 bool resolve_type(THD *thd) override {
901 if (reject_vector_args()) return true;
902 if (param_type_is_default(thd, 0, -1)) return true;
903 set_nullable(true);
904
905 /*
906 Any interior character could be replaced by a 6 character
907 escape sequence. Plus we will add 2 framing quote characters.
908 */
909 const uint32 max_char_length = (6 * args[0]->max_char_length()) + 2;
911 return false;
912 }
913
914 String *val_str(String *tmpspace) override;
915};
916
917/**
918 Represents the JSON function JSON_UNQUOTE()
919*/
923
924 public:
926 : Item_str_func(pos, a) {}
927
928 Item_func_json_unquote(const POS &pos, Item *a) : Item_str_func(pos, a) {}
929
930 const char *func_name() const override { return "json_unquote"; }
931
932 enum Functype functype() const override { return JSON_UNQUOTE_FUNC; }
933
934 bool resolve_type(THD *thd) override {
935 if (reject_vector_args()) return true;
936 if (param_type_is_default(thd, 0, -1)) return true;
937 set_nullable(true);
939 return false;
940 }
941
942 String *val_str(String *str) override;
943};
944
945/**
946 Represents the JSON_PRETTY function.
947*/
949 public:
950 Item_func_json_pretty(const POS &pos, Item *a) : Item_str_func(pos, a) {}
951
952 const char *func_name() const override { return "json_pretty"; }
953
954 enum Functype functype() const override { return JSON_PRETTY_FUNC; }
955
956 bool resolve_type(THD *thd) override {
957 if (reject_vector_args()) return true;
958 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_JSON)) return true;
960 return false;
961 }
962
963 String *val_str(String *str) override;
964};
965
966/**
967 Class that represents the function JSON_STORAGE_SIZE.
968*/
970 public:
972 : Item_int_func(pos, a) {}
973 const char *func_name() const override { return "json_storage_size"; }
974 enum Functype functype() const override { return JSON_STORAGE_SIZE_FUNC; }
975
976 bool resolve_type(THD *thd) override {
977 if (reject_vector_args()) return true;
978 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_JSON)) return true;
979 if (Item_int_func::resolve_type(thd)) return true;
980 set_nullable(true);
981 return false;
982 }
983
984 longlong val_int() override;
985};
986
987/**
988 Class that represents the function JSON_STORAGE_FREE.
989*/
991 public:
993 : Item_int_func(pos, a) {}
994 const char *func_name() const override { return "json_storage_free"; }
995 enum Functype functype() const override { return JSON_STORAGE_FREE_FUNC; }
996
997 bool resolve_type(THD *thd) override {
998 if (reject_vector_args()) return true;
999 if (param_type_is_default(thd, 0, -1, MYSQL_TYPE_JSON)) return true;
1000 return false;
1001 }
1002
1003 longlong val_int() override;
1004};
1005
1006/**
1007 Class that represents CAST(<expr> AS <type> ARRAY)
1008*/
1009
1010class Item_func_array_cast final : public Item_func {
1011 /// Type to cast to
1013 /**
1014 Whether use of CAST(.. AS .. ARRAY) is allowed
1015
1016 Currently use of CAST(.. AS .. ARRAY) is limited only to CREATE
1017 TABLE/INDEX. In all other cases an error is thrown. This flag is set to
1018 true only for allowed cases to ensure allowed function usage.
1019 */
1020 bool m_is_allowed{false};
1021
1022 /**
1023 An array used by #save_in_field_inner() to store the result of an array cast
1024 operation. It is cached in the Item in order to avoid the need for
1025 reallocation on each row.
1026 */
1028
1029 protected:
1030 void add_json_info(Json_object *obj) override;
1031
1032 public:
1033 Item_func_array_cast(const POS &pos, Item *a, Cast_target type, uint len_arg,
1034 uint dec_arg, const CHARSET_INFO *cs_arg);
1036 const char *func_name() const override { return "cast_as_array"; }
1037 enum Functype functype() const override { return TYPECAST_FUNC; }
1038 bool returns_array() const override { return true; }
1039 bool val_json(Json_wrapper *wr) override;
1040 void print(const THD *thd, String *str,
1041 enum_query_type query_type) const override;
1042 enum Item_result result_type() const override;
1043 bool resolve_type(THD *) override;
1044 Field *tmp_table_field(TABLE *table) override;
1045 bool fix_fields(THD *thd, Item **ref) override;
1046 void cleanup() override;
1047 void allow_array_cast() override { m_is_allowed = true; }
1049 bool no_conversions) override;
1050 // Regular val_x() funcs shouldn't be called
1051 /* purecov: begin inspected */
1052 longlong val_int() override {
1053 assert(false);
1054 return 0;
1055 }
1056 String *val_str(String *) override {
1057 assert(false);
1058 return nullptr;
1059 }
1061 assert(false);
1062 return nullptr;
1063 }
1064 double val_real() override {
1065 assert(false);
1066 return 0;
1067 }
1069 assert(false);
1070 return true;
1071 }
1072 bool get_time(MYSQL_TIME *) override {
1073 assert(false);
1074 return true;
1075 }
1076 /* purecov: end */
1077};
1078
1080 public:
1082 : Item_bool_func(pos, a, b) {}
1083 const char *func_name() const override { return "json_overlaps"; }
1084 enum Functype functype() const override { return JSON_OVERLAPS; }
1085 bool gc_subst_analyzer(uchar **) override { return true; }
1086 optimize_type select_optimize(const THD *) override { return OPTIMIZE_KEY; }
1087 longlong val_int() override;
1088 Item *key_item() const override;
1090 return (arg == args[0] || arg == args[1]) ? CACHE_JSON_VALUE : CACHE_NONE;
1091 }
1092};
1093
1095 public:
1096 Item_func_member_of(const POS &pos, Item *a, Item *b)
1097 : Item_bool_func(pos, a, b) {}
1098 const char *func_name() const override { return "member of"; }
1099 enum Functype functype() const override { return MEMBER_OF_FUNC; }
1100 bool resolve_type(THD *thd) override {
1101 if (reject_vector_args()) return true;
1102 if (param_type_is_default(thd, 0, 2, MYSQL_TYPE_JSON)) return true;
1104 return false;
1105 }
1106 bool gc_subst_analyzer(uchar **) override { return true; }
1107 optimize_type select_optimize(const THD *) override { return OPTIMIZE_KEY; }
1108 longlong val_int() override;
1109 void print(const THD *thd, String *str,
1110 enum_query_type query_type) const override;
1111 Item *key_item() const override { return args[1]; }
1113 return (arg == args[1]) ? CACHE_JSON_VALUE
1114 : ((arg == args[0]) ? CACHE_JSON_ATOM : CACHE_NONE);
1115 }
1116};
1117
1118/**
1119 Class implementing the JSON_VALUE function.
1120
1121 Functionality-wise it's a combination of CAST, JSON_UNQUOTE and JSON_EXTRACT,
1122 but with additional functionality for flexible handling of empty values and
1123 conversion errors.
1124*/
1125class Item_func_json_value final : public Item_func {
1126 public:
1127 Item_func_json_value(const POS &pos, Item *arg, Item *path,
1128 const Cast_type &cast_type, unsigned length,
1129 unsigned precision, Json_on_response_type on_empty_type,
1130 Item *on_empty_default,
1131 Json_on_response_type on_error_type,
1132 Item *on_error_default);
1134 const char *func_name() const override { return "json_value"; }
1135 enum Functype functype() const override { return JSON_VALUE_FUNC; }
1136 enum Item_result result_type() const override;
1137 bool resolve_type(THD *) override;
1138 bool fix_fields(THD *thd, Item **ref) override;
1139 void print(const THD *thd, String *str,
1140 enum_query_type query_type) const override;
1141 bool eq_specific(const Item *item) const override;
1142 bool val_json(Json_wrapper *wr) override;
1143 String *val_str(String *buffer) override;
1144 double val_real() override;
1145 longlong val_int() override;
1146 my_decimal *val_decimal(my_decimal *value) override;
1147 bool get_date(MYSQL_TIME *ltime, my_time_flags_t flags) override;
1148 bool get_time(MYSQL_TIME *ltime) override;
1149 Json_on_response_type on_empty_response_type() const;
1150 Json_on_response_type on_error_response_type() const;
1151
1152 private:
1153 /// Represents a default value given in JSON_VALUE's DEFAULT xxx ON EMPTY or
1154 /// DEFAULT xxx ON ERROR clause.
1155 struct Default_value;
1156
1157 /// Parsed path.
1159 /// Type of the ON EMPTY clause.
1161 /// Type of the ON ERROR clause.
1163 /// The default value for ON EMPTY (if not ERROR or NULL ON EMPTY).
1165 /// The default value for ON EMPTY (if not ERROR or NULL ON EMPTY).
1167 /// The target data type.
1169
1170 /**
1171 Creates a Json_value_default object representing the default value given in
1172 a DEFAULT xxx ON EMPTY clause or a DEFAULT xxx ON ERROR clause.
1173
1174 @param thd the current session
1175 @param item the Item that represents the default value expression
1176 @return a pointer to the created object on success, nullptr on error
1177 */
1178 unique_ptr_destroy_only<Default_value> create_json_value_default(THD *thd,
1179 Item *item);
1180
1181 /**
1182 Extracts the JSON value at the given path.
1183
1184 @param[out] json the extracted JSON value, if the path matched exactly
1185 one value; empty otherwise
1186 @param[out] return_default the default value to return if a
1187 DEFAULT ... ON EMPTY or DEFAULT ... ON ERROR clause was invoked,
1188 or nullptr if no DEFAULT clause was invoked
1189 @return true if an error was raised, false otherwise
1190 */
1191 bool extract_json_value(Json_wrapper *json,
1192 const Default_value **return_default);
1193
1194 /// Implements val_int() for RETURNING SIGNED and RETURNING UNSIGNED.
1195 int64_t extract_integer_value();
1196 /// Implements val_int() for RETURNING YEAR
1197 int64_t extract_year_value();
1198 /// Implements get_date() for RETURNING DATE.
1199 bool extract_date_value(MYSQL_TIME *ltime);
1200 /// Implements get_time() for RETURNING TIME.
1201 bool extract_time_value(MYSQL_TIME *ltime);
1202 /// Implements get_date() for RETURNING DATETIME.
1203 bool extract_datetime_value(MYSQL_TIME *ltime);
1204 /// Implements val_decimal() for RETURNING DECIMAL.
1205 my_decimal *extract_decimal_value(my_decimal *value);
1206 /// Implements val_str() for RETURNING CHAR and RETURNING BINARY.
1207 String *extract_string_value(String *buffer);
1208 /// Implements val_real() for RETURNING FLOAT/REAL/DOUBLE.
1209 double extract_real_value();
1210};
1211
1212/**
1213 Turn a GEOMETRY value into a JSON value per the GeoJSON specification
1214 revision 1.0. This method is implemented in item_geofunc.cc.
1215
1216 @param[in,out] wr The wrapper to be stuffed with the JSON value.
1217 @param[in] swkb The source GEOMETRY value.
1218 @param[in] calling_function Name of user-invoked function (for errors)
1219 @param[in] max_decimal_digits See the user documentation for ST_AsGeoJSON.
1220 @param[in] add_bounding_box See the user documentation for ST_AsGeoJSON.
1221 @param[in] add_short_crs_urn See the user documentation for ST_AsGeoJSON.
1222 @param[in] add_long_crs_urn See the user documentation for ST_AsGeoJSON.
1223 @param[in,out] geometry_srid Spatial Reference System Identifier to be filled
1224 in.
1225
1226 @return false if the conversion succeeds, true otherwise
1227*/
1228bool geometry_to_json(Json_wrapper *wr, String *swkb,
1229 const char *calling_function, int max_decimal_digits,
1230 bool add_bounding_box, bool add_short_crs_urn,
1231 bool add_long_crs_urn, uint32 *geometry_srid);
1232
1233/**
1234 Convert a value represented with an Item to a JSON value
1235
1236 @param[in] item the input value, may be any data type
1237 @param[in] func_name for error reporting
1238 @param[in,out] wr the result wrapper for the JSON value
1239
1240 @return false if success, true if error
1241*/
1242bool convert_value_to_json(Item *item, const char *func_name, Json_wrapper *wr);
1243/**
1244 Convert JSON values or MySQL values to JSON. Converts SQL NULL
1245 to the JSON null literal.
1246
1247 @param[in] args arguments to function
1248 @param[in] arg_idx the index of the argument to process
1249 @param[in] calling_function name of the calling function
1250 @param[in,out] value working area (if the returned Json_wrapper points
1251 to a binary value rather than a DOM, this string
1252 will end up holding the binary representation, and
1253 it must stay alive until the wrapper is destroyed
1254 or converted from binary to DOM)
1255 @param[in,out] tmp temporary scratch space for converting strings to
1256 the correct charset; only used if accept_string is
1257 true and conversion is needed
1258 @param[in,out] wr the result wrapper
1259 @returns false if we found a value or NULL, true otherwise
1260*/
1261bool get_atom_null_as_null(Item **args, uint arg_idx,
1262 const char *calling_function, String *value,
1263 String *tmp, Json_wrapper *wr);
1264
1265/**
1266 Gets a JSON object member name from an Item. An error is raised if
1267 the Item evaluates to NULL, or if it cannot be converted to a
1268 utf8mb4 string.
1269
1270 @param[in] thd THD handle
1271 @param[in] arg_item An argument Item
1272 @param[out] value Where to materialize the arg_item's string value
1273 @param[out] utf8_res Buffer for use by ensure_utf8mb4.
1274 @param[out] safep String pointer after any relevant conversion
1275 @param[out] safe_length Corresponding string length
1276
1277 @returns true if the Item is not a utf8mb4 string
1278*/
1279bool get_json_object_member_name(const THD *thd, Item *arg_item, String *value,
1280 String *utf8_res, const char **safep,
1281 size_t *safe_length);
1282using Json_dom_ptr = std::unique_ptr<Json_dom>;
1283
1284bool parse_json(const String &res, Json_dom_ptr *dom, bool require_str_or_json,
1285 const JsonParseErrorHandler &error_handler,
1286 const JsonErrorHandler &depth_handler);
1287
1288/**
1289 Apply a sequence of JSON diffs to the value stored in a JSON column.
1290
1291 @param field the column to update
1292 @param diffs the diffs to apply
1293 @return an enum_json_diff_status value that tells if the diffs were
1294 applied successfully
1295 */
1297 const Json_diff_vector *diffs);
1298
1299bool save_json_to_field(THD *thd, Field *field, const Json_wrapper *w,
1300 bool no_error);
1301#endif /* ITEM_JSON_FUNC_INCLUDED */
A field that stores a JSON value.
Definition: field.h:4061
Definition: field.h:577
Definition: item_cmpfunc.h:294
Class that represents CAST(<expr> AS <type> ARRAY)
Definition: item_json_func.h:1010
unique_ptr_destroy_only< Json_array > m_result_array
An array used by save_in_field_inner() to store the result of an array cast operation.
Definition: item_json_func.h:1027
bool get_time(MYSQL_TIME *) override
Definition: item_json_func.h:1072
void allow_array_cast() override
A helper function to ensure proper usage of CAST(.
Definition: item_json_func.h:1047
const char * func_name() const override
Definition: item_json_func.h:1036
longlong val_int() override
Definition: item_json_func.h:1052
bool returns_array() const override
Whether the item returns array of its data type.
Definition: item_json_func.h:1038
bool get_date(MYSQL_TIME *, my_time_flags_t) override
Definition: item_json_func.h:1068
my_decimal * val_decimal(my_decimal *) override
Definition: item_json_func.h:1060
enum Functype functype() const override
Definition: item_json_func.h:1037
double val_real() override
Definition: item_json_func.h:1064
~Item_func_array_cast() override
Cast_target cast_type
Type to cast to.
Definition: item_json_func.h:1012
String * val_str(String *) override
Definition: item_json_func.h:1056
Represents the JSON function JSON_ARRAY_APPEND()
Definition: item_json_func.h:638
Item_func_json_array_append(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:640
const char * func_name() const override
Definition: item_json_func.h:643
Represents the JSON function JSON_ARRAY_INSERT()
Definition: item_json_func.h:664
Item_func_json_array_insert(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:666
const char * func_name() const override
Definition: item_json_func.h:669
Represents the JSON function JSON_ARRAY()
Definition: item_json_func.h:721
enum Functype functype() const override
Definition: item_json_func.h:732
const char * func_name() const override
Definition: item_json_func.h:731
Item_func_json_array(Args &&... parent_args)
Definition: item_json_func.h:724
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:734
Represents the JSON function JSON_CONTAINS_PATH()
Definition: item_json_func.h:432
void cleanup() override
Cleanup between executions of the statement.
Definition: item_json_func.cc:906
bool is_bool_func() const override
Definition: item_json_func.h:448
longlong val_int() override
Definition: item_json_func.cc:913
Json_path_cache m_path_cache
Definition: item_json_func.h:437
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:452
enum Functype functype() const override
Definition: item_json_func.h:446
String m_doc_value
Definition: item_json_func.h:433
Item_func_json_contains_path(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:440
const char * func_name() const override
Definition: item_json_func.h:445
enum_const_item_cache can_cache_json_arg(Item *arg) override
Whether an arg of a JSON function can be cached to avoid repetitive string->JSON conversion.
Definition: item_json_func.h:463
enum_one_or_all_type m_cached_ooa
Definition: item_json_func.h:434
Represents the JSON function JSON_CONTAINS()
Definition: item_json_func.h:396
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_json_func.h:407
optimize_type select_optimize(const THD *) override
Definition: item_json_func.h:406
Item_func_json_contains(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:401
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:413
longlong val_int() override
Definition: item_json_func.cc:848
String m_doc_value
Definition: item_json_func.h:397
enum Functype functype() const override
Definition: item_json_func.h:405
Json_path_cache m_path_cache
Definition: item_json_func.h:398
enum_const_item_cache can_cache_json_arg(Item *arg) override
Whether an arg of a JSON function can be cached to avoid repetitive string->JSON conversion.
Definition: item_json_func.h:424
void cleanup() override
Cleanup between executions of the statement.
Definition: item_json_func.cc:842
const char * func_name() const override
Definition: item_json_func.h:404
bool is_bool_func() const override
Definition: item_json_func.h:409
Represents the JSON function JSON_DEPTH()
Definition: item_json_func.h:534
enum Functype functype() const override
Definition: item_json_func.h:541
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:543
longlong val_int() override
Definition: item_json_func.cc:1550
String m_doc_value
Definition: item_json_func.h:535
const char * func_name() const override
Definition: item_json_func.h:540
Item_func_json_depth(const POS &pos, Item *a)
Definition: item_json_func.h:538
Represents the JSON function JSON_EXTRACT()
Definition: item_json_func.h:582
const char * func_name() const override
Definition: item_json_func.h:592
bool eq(const Item *item) const override
Compare this item with another item for equality.
Definition: item_json_func.cc:1699
enum Functype functype() const override
Definition: item_json_func.h:593
Item_func_json_extract(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:586
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:595
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_json_func.cc:1632
Item_func_json_extract(THD *thd, const POS &pos, Item *a, Item *b)
Definition: item_json_func.h:589
String m_doc_value
Definition: item_json_func.h:583
Represents the JSON function JSON_INSERT()
Definition: item_json_func.h:651
Item_func_json_insert(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:653
const char * func_name() const override
Definition: item_json_func.h:656
Represents the JSON function JSON_KEYS()
Definition: item_json_func.h:556
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_json_func.cc:1571
String m_doc_value
Definition: item_json_func.h:557
Item_func_json_keys(THD *thd, const POS &pos, Item *a, Item *b)
Definition: item_json_func.h:563
Item_func_json_keys(THD *thd, const POS &pos, Item *a)
Definition: item_json_func.h:560
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:568
const char * func_name() const override
Definition: item_json_func.h:566
Represents the JSON function JSON_LENGTH()
Definition: item_json_func.h:511
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:517
Item_func_json_length(const POS &pos, Item *doc)
Definition: item_json_func.h:515
longlong val_int() override
Definition: item_json_func.cc:1526
String m_doc_value
Definition: item_json_func.h:512
enum Functype functype() const override
Definition: item_json_func.h:526
const char * func_name() const override
Definition: item_json_func.h:525
Represents the JSON function JSON_MERGE_PATCH.
Definition: item_json_func.h:870
Item_func_json_merge_patch(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:872
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:877
const char * func_name() const override
Definition: item_json_func.h:875
Represents the JSON function JSON_MERGE_PRESERVE.
Definition: item_json_func.h:840
const char * func_name() const override
Definition: item_json_func.h:845
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:847
Item_func_json_merge_preserve(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:842
Represents the JSON function JSON_MERGE.
Definition: item_json_func.h:860
bool is_deprecated() const override
Definition: item_json_func.h:864
Definition: item_json_func.h:1079
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_json_func.h:1085
enum Functype functype() const override
Definition: item_json_func.h:1084
const char * func_name() const override
Definition: item_json_func.h:1083
Item_func_json_overlaps(const POS &pos, Item *a, Item *b)
Definition: item_json_func.h:1081
optimize_type select_optimize(const THD *) override
Definition: item_json_func.h:1086
enum_const_item_cache can_cache_json_arg(Item *arg) override
Whether an arg of a JSON function can be cached to avoid repetitive string->JSON conversion.
Definition: item_json_func.h:1089
Represents the JSON_PRETTY function.
Definition: item_json_func.h:948
const char * func_name() const override
Definition: item_json_func.h:952
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:956
enum Functype functype() const override
Definition: item_json_func.h:954
Item_func_json_pretty(const POS &pos, Item *a)
Definition: item_json_func.h:950
Represents the JSON function JSON_QUOTE()
Definition: item_json_func.h:889
enum Functype functype() const override
Definition: item_json_func.h:898
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:900
String m_value
Definition: item_json_func.h:890
Item_func_json_quote(const POS &pos, PT_item_list *a)
Definition: item_json_func.h:893
const char * func_name() const override
Definition: item_json_func.h:896
Represents the JSON function JSON_REMOVE()
Definition: item_json_func.h:816
const char * func_name() const override
Definition: item_json_func.h:825
bool can_use_in_partial_update() const override
Can this function type be used in partial update?
Definition: item_json_func.h:818
String m_doc_value
Definition: item_json_func.h:817
Item_func_json_remove(Args &&... parent_args)
Definition: item_json_func.h:822
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:827
Represents the JSON function JSON_REPLACE()
Definition: item_json_func.h:709
const char * func_name() const override
Definition: item_json_func.h:715
Item_func_json_replace(Args &&... parent_args)
Definition: item_json_func.h:712
Represents the JSON function JSON_OBJECT()
Definition: item_json_func.h:746
String tmp_key_value
Definition: item_json_func.h:747
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:761
enum Functype functype() const override
Definition: item_json_func.h:759
Item_func_json_row_object(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:750
const char * func_name() const override
Definition: item_json_func.h:758
Represents the JSON function JSON_SCHEMA_VALID( <json schema>, <json doc> )
Definition: item_json_func.h:343
Item_func_json_schema_valid(const POS &pos, Item *a, Item *b)
Definition: item_json_func.cc:682
bool val_bool() override
Definition: item_json_func.cc:745
bool fix_fields(THD *, Item **) override
Definition: item_json_func.cc:669
longlong val_int() override
Definition: item_json_func.h:352
Json_schema_validator m_cached_schema_validator
Definition: item_json_func.h:359
const char * func_name() const override
Definition: item_json_func.h:348
~Item_func_json_schema_valid() override
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_json_func.cc:680
Represents the JSON function JSON_SCHEMA_VALIDATION_REPORT( <json schema>, <json doc> )
Definition: item_json_func.h:366
const char * func_name() const override
Definition: item_json_func.h:372
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:378
Json_schema_validator m_cached_schema_validator
Definition: item_json_func.h:390
void cleanup() override
JSON_*() support methods.
Definition: item_json_func.cc:784
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_json_func.cc:796
bool fix_fields(THD *, Item **) override
Definition: item_json_func.cc:773
Item_func_json_schema_validation_report(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.cc:789
Represents the JSON function JSON_SEARCH()
Definition: item_json_func.h:773
String m_doc_value
Definition: item_json_func.h:774
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:803
enum_one_or_all_type m_cached_ooa
Definition: item_json_func.h:775
Item_func_like * m_like_node
Definition: item_json_func.h:779
Item_func_json_search(Args &&... parent_args)
Construct a JSON_SEARCH() node.
Definition: item_json_func.h:788
enum Functype functype() const override
Definition: item_json_func.h:794
const char * func_name() const override
Definition: item_json_func.h:792
Item_string * m_source_string_item
Definition: item_json_func.h:778
Common base class for JSON_SET() and JSON_REPLACE().
Definition: item_json_func.h:677
Item_func_json_set_replace(bool json_set, Args &&... parent_args)
Definition: item_json_func.h:685
const bool m_json_set
True if this is JSON_SET, false if it is JSON_REPLACE.
Definition: item_json_func.h:679
Json_path_clone m_path
Definition: item_json_func.h:680
bool can_use_in_partial_update() const override
Can this function type be used in partial update?
Definition: item_json_func.h:681
Represents the JSON function JSON_SET()
Definition: item_json_func.h:697
Item_func_json_set(Args &&... parent_args)
Definition: item_json_func.h:700
const char * func_name() const override
Definition: item_json_func.h:703
Class that represents the function JSON_STORAGE_FREE.
Definition: item_json_func.h:990
enum Functype functype() const override
Definition: item_json_func.h:995
Item_func_json_storage_free(const POS &pos, Item *a)
Definition: item_json_func.h:992
const char * func_name() const override
Definition: item_json_func.h:994
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:997
Class that represents the function JSON_STORAGE_SIZE.
Definition: item_json_func.h:969
Item_func_json_storage_size(const POS &pos, Item *a)
Definition: item_json_func.h:971
const char * func_name() const override
Definition: item_json_func.h:973
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:976
enum Functype functype() const override
Definition: item_json_func.h:974
Represents the JSON function JSON_TYPE.
Definition: item_json_func.h:471
const char * func_name() const override
Definition: item_json_func.h:477
String * val_str(String *) override
Definition: item_json_func.cc:1051
String m_value
Definition: item_json_func.h:472
Item_func_json_type(const POS &pos, Item *a)
Definition: item_json_func.h:475
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.cc:1042
enum Functype functype() const override
Definition: item_json_func.h:478
Represents the JSON function JSON_UNQUOTE()
Definition: item_json_func.h:920
String m_value
Definition: item_json_func.h:921
const char * func_name() const override
Definition: item_json_func.h:930
Item_func_json_unquote(const POS &pos, Item *a)
Definition: item_json_func.h:928
Item_func_json_unquote(const POS &pos, PT_item_list *a)
Definition: item_json_func.h:925
enum Functype functype() const override
Definition: item_json_func.h:932
String m_conversion_buffer
Definition: item_json_func.h:922
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:934
Represents the JSON function JSON_VALID( <value> )
Definition: item_json_func.h:319
const char * func_name() const override
Definition: item_json_func.h:325
Item_func_json_valid(const POS &pos, Item *a)
Definition: item_json_func.h:323
longlong val_int() override
Definition: item_json_func.cc:624
enum Functype functype() const override
Definition: item_json_func.h:326
bool is_bool_func() const override
Definition: item_json_func.h:328
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:332
String m_value
Definition: item_json_func.h:320
Class implementing the JSON_VALUE function.
Definition: item_json_func.h:1125
enum Functype functype() const override
Definition: item_json_func.h:1135
unique_ptr_destroy_only< Default_value > m_default_error
The default value for ON EMPTY (if not ERROR or NULL ON EMPTY).
Definition: item_json_func.h:1166
~Item_func_json_value() override
Json_on_response_type m_on_error
Type of the ON ERROR clause.
Definition: item_json_func.h:1162
Cast_target m_cast_target
The target data type.
Definition: item_json_func.h:1168
unique_ptr_destroy_only< Default_value > m_default_empty
The default value for ON EMPTY (if not ERROR or NULL ON EMPTY).
Definition: item_json_func.h:1164
const char * func_name() const override
Definition: item_json_func.h:1134
Json_on_response_type m_on_empty
Type of the ON EMPTY clause.
Definition: item_json_func.h:1160
Json_path m_path_json
Parsed path.
Definition: item_json_func.h:1155
Definition: item_cmpfunc.h:2365
Definition: item_json_func.h:1094
enum_const_item_cache can_cache_json_arg(Item *arg) override
Whether an arg of a JSON function can be cached to avoid repetitive string->JSON conversion.
Definition: item_json_func.h:1112
Item_func_member_of(const POS &pos, Item *a, Item *b)
Definition: item_json_func.h:1096
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:1100
enum Functype functype() const override
Definition: item_json_func.h:1099
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_json_func.h:1106
Item * key_item() const override
Definition: item_json_func.h:1111
optimize_type select_optimize(const THD *) override
Definition: item_json_func.h:1107
const char * func_name() const override
Definition: item_json_func.h:1098
Base class for all the functions that take a JSON document as the first argument and one of more pair...
Definition: item_json_func.h:611
void update_used_tables() final
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_json_func.cc:1746
String m_doc_value
Definition: item_json_func.h:623
table_map calculate_not_null_tables() const
Calculates the set of tables to return from not_used_tables().
Definition: item_json_func.cc:1751
Item_func_modify_json_in_path(Args &&... parent_args)
Definition: item_json_func.h:614
bool resolve_type(THD *thd) final
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.cc:1733
Definition: item_func.h:100
Item ** args
Array of pointers to arguments.
Definition: item_func.h:107
bool reject_vector_args()
Definition: item_func.cc:1600
Functype
Definition: item_func.h:209
@ JSON_VALUE_FUNC
Definition: item_func.h:353
@ JSON_STORAGE_SIZE_FUNC
Definition: item_func.h:351
@ JSON_SEARCH_FUNC
Definition: item_func.h:354
@ JSON_STORAGE_FREE_FUNC
Definition: item_func.h:352
@ JSON_CONTAINS
Definition: item_func.h:327
@ JSON_VALID_FUNC
Definition: item_func.h:346
@ JSON_UNQUOTE_FUNC
Definition: item_func.h:329
@ JSON_CONTAINS_PATH_FUNC
Definition: item_func.h:350
@ JSON_ARRAY_FUNC
Definition: item_func.h:345
@ JSON_DEPTH_FUNC
Definition: item_func.h:342
@ JSON_QUOTE_FUNC
Definition: item_func.h:349
@ JSON_OBJECT_FUNC
Definition: item_func.h:344
@ JSON_TYPE_FUNC
Definition: item_func.h:347
@ JSON_PRETTY_FUNC
Definition: item_func.h:348
@ JSON_EXTRACT_FUNC
Definition: item_func.h:343
@ MEMBER_OF_FUNC
Definition: item_func.h:330
@ TYPECAST_FUNC
Definition: item_func.h:258
@ JSON_OVERLAPS
Definition: item_func.h:328
@ JSON_LENGTH_FUNC
Definition: item_func.h:341
virtual bool eq_specific(const Item *) const
Provide a more specific equality check for a function.
Definition: item_func.h:532
optimize_type
Definition: item_func.h:356
@ OPTIMIZE_KEY
Definition: item_func.h:358
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:716
virtual const char * func_name() const =0
enum Type type() const override
Definition: item_func.h:363
virtual Item * key_item() const
Definition: item_func.h:535
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
bool fix_fields(THD *, Item **ref) override
Definition: item_func.cc:406
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:130
Field * tmp_table_field(TABLE *t_arg) override
Definition: item_func.cc:793
bool null_on_null
Affects how to determine that NULL argument implies a NULL function return.
Definition: item_func.h:186
Definition: item_func.h:1019
Base class for all item functions that a return JSON value.
Definition: item_json_func.h:158
void mark_for_partial_update(const Field_json *field)
Mark this expression as used in partial update.
Definition: item_json_func.cc:2135
String m_conversion_buffer
String used for converting JSON text values to utf8mb4 charset.
Definition: item_json_func.h:166
longlong val_int() override
Definition: item_json_func.cc:1128
Item_result cast_to_int_type() const override
Definition: item_json_func.h:207
String m_value
String used when reading JSON binary values or JSON text values.
Definition: item_json_func.h:164
virtual bool can_use_in_partial_update() const
Can this function type be used in partial update?
Definition: item_json_func.h:160
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_json_func.cc:1105
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:192
bool get_time(MYSQL_TIME *ltime) override
Definition: item_json_func.cc:1117
String * val_str(String *arg) override
Definition: item_json_func.cc:1090
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_json_func.cc:1150
enum Item_result result_type() const override
Definition: item_json_func.h:197
String m_string_buffer
String used for converting a JSON value to text in val_str().
Definition: item_json_func.h:168
bool supports_partial_update(const Field_json *field) const override
Does this function call support partial update of the given JSON column?
Definition: item_json_func.cc:2152
Json_path_cache m_path_cache
Definition: item_json_func.h:171
const Field_json * m_partial_update_column
Target column for partial update, if this function is used in an update statement and partial update ...
Definition: item_json_func.h:177
double val_real() override
Definition: item_json_func.cc:1137
Item_json_func(THD *thd, Args &&... parent_args)
Construct an Item_json_func instance.
Definition: item_json_func.h:186
void cleanup() override
JSON_*() support methods.
Definition: item_json_func.cc:618
Definition: item_strfunc.h:76
Definition: item.h:5457
Represents a "CAST( <value> AS JSON )" coercion.
Definition: item_json_func.h:488
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_json_func.cc:1470
const char * cast_type() const
Definition: item_json_func.h:504
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_json_func.cc:1517
Item_json_func super
Definition: item_json_func.h:489
const char * func_name() const override
Definition: item_json_func.h:503
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:495
Item_typecast_json(THD *thd, const POS &pos, Item *a)
Definition: item_json_func.h:492
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
uint32 max_char_length() const
Definition: item.h:3353
void set_nullable(bool nullable)
Definition: item.h:3670
virtual bool propagate_type(THD *thd, const Type_properties &type)
Propagate data type specifications into parameters and user variables.
Definition: item.h:1313
virtual type_conversion_status save_in_field_inner(Field *field, bool no_conversions)
Helper function which does all of the work for save_in_field(Field*, bool), except some error checkin...
Definition: item.cc:6878
virtual bool val_json(Json_wrapper *result)
Get a JSON value from an Item.
Definition: item.h:2091
enum_const_item_cache
How to cache constant JSON data.
Definition: item.h:998
@ CACHE_NONE
Don't cache.
Definition: item.h:1000
@ CACHE_JSON_VALUE
Source data is a JSON string, parse and cache result.
Definition: item.h:1002
@ CACHE_JSON_ATOM
Source data is SQL scalar, convert and cache result.
Definition: item.h:1004
void set_data_type_json()
Set the data type of the Item to be JSON.
Definition: item.h:1761
void set_data_type_string(uint32 max_l)
Set the Item to be variable length string.
Definition: item.h:1600
virtual void mark_json_as_scalar()
For Items with data type JSON, mark that a string argument is treated as a scalar JSON value.
Definition: item.h:1355
Represents a JSON array container, i.e.
Definition: json_dom.h:516
Vector of logical diffs describing changes to a JSON column.
Definition: json_diff.h:141
JSON DOM abstract base class.
Definition: json_dom.h:173
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:369
Path cache for JSON functions.
Definition: item_json_func.h:91
Json_path_cache(THD *thd, uint size)
Json_path_cache.
Definition: item_json_func.cc:554
const Json_path * get_path(uint arg_idx) const
Return an already parsed path expression.
Definition: item_json_func.cc:599
void reset_cache()
Reset the cache for re-use when a statement is re-executed.
Definition: item_json_func.cc:609
enum_path_status
Enum that tells the status of a cell in m_paths.
Definition: item_json_func.h:100
Prealloced_array< Json_path, 8 > m_paths
List of paths.
Definition: item_json_func.h:97
Mem_root_array< Path_cell > m_arg_idx_to_vector_idx
Map argument indexes to indexes into m_paths.
Definition: item_json_func.h:113
String m_path_value
Holder for path strings.
Definition: item_json_func.h:94
bool parse_and_cache_path(const THD *thd, Item **args, uint arg_idx, bool forbid_wildcards)
Parse a path expression if necessary.
Definition: item_json_func.cc:561
A lightweight path expression.
Definition: json_path.h:447
A JSON path expression.
Definition: json_path.h:353
A class that is capable of holding objects of any sub-type of Json_scalar.
Definition: json_dom.h:1886
This is just a facade to the Json_schema_validator and it is used to hide the dependency on the rapid...
Definition: json_schema.h:155
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1153
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
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
virtual void add_json_info(Json_object *json_obj)
Add all the node-specific json fields.
Definition: parse_tree_node_base.h:303
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:71
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
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:95
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:31
type_conversion_status
Status when storing a value in a field or converting from one datatype to another.
Definition: field.h:204
This file contains the field type.
@ MYSQL_TYPE_JSON
Definition: field_types.h:80
Cast_target
Definition: item_create.h:56
static int flags[50]
Definition: hp_test1.cc:40
bool json_value(Item *arg, Json_wrapper *result, bool *has_value)
Return the JSON value of the argument in a wrapper.
Definition: item_json_func.cc:983
enum_json_diff_status apply_json_diffs(Field_json *field, const Json_diff_vector *diffs)
Apply a sequence of JSON diffs to the value stored in a JSON column.
Definition: item_json_func.cc:158
bool geometry_to_json(Json_wrapper *wr, String *swkb, const char *calling_function, int max_decimal_digits, bool add_bounding_box, bool add_short_crs_urn, bool add_long_crs_urn, uint32 *geometry_srid)
Turn a GEOMETRY value into a JSON value per the GeoJSON specification revision 1.0.
Definition: item_geofunc.cc:2331
bool ensure_utf8mb4(const String &val, String *buf, const char **resptr, size_t *reslength, bool require_string)
Check a non-empty val for character set.
Definition: item_json_func.cc:82
bool save_json_to_field(THD *thd, Field *field, const Json_wrapper *w, bool no_error)
Save JSON to a given field.
Definition: item_json_func.cc:3884
bool get_json_atom_wrapper(Item **args, uint arg_idx, const char *calling_function, String *value, String *tmp, Json_wrapper *wr, Json_scalar_holder *scalar, bool accept_string)
Convert Json values or MySQL values to JSON.
Definition: item_json_func.cc:1399
bool get_json_wrapper(Item **args, uint arg_idx, String *str, const char *func_name, Json_wrapper *wrapper)
Return the JSON value of the argument in a wrapper.
Definition: item_json_func.cc:1003
bool get_json_object_member_name(const THD *thd, Item *arg_item, String *value, String *utf8_res, const char **safep, size_t *safe_length)
Gets a JSON object member name from an Item.
Definition: item_json_func.cc:317
bool parse_json(const String &res, Json_dom_ptr *dom, bool require_str_or_json, const JsonParseErrorHandler &error_handler, const JsonErrorHandler &depth_handler)
Parse a JSON dom out of an argument to a JSON function.
Definition: item_json_func.cc:133
bool sql_scalar_to_json(Item *arg, const char *calling_function, String *value, String *tmp, Json_wrapper *wr, Json_scalar_holder *scalar, bool scalar_string)
Get a JSON value from an SQL scalar value.
Definition: item_json_func.cc:1205
bool get_atom_null_as_null(Item **args, uint arg_idx, const char *calling_function, String *value, String *tmp, Json_wrapper *wr)
Convert JSON values or MySQL values to JSON.
Definition: item_json_func.cc:1456
bool convert_value_to_json(Item *item, const char *func_name, Json_wrapper *wr)
Convert a value represented with an Item to a JSON value.
enum_one_or_all_type
For use by JSON_CONTAINS_PATH() and JSON_SEARCH()
Definition: item_json_func.h:76
@ ooa_null
Definition: item_json_func.h:79
@ ooa_one
Definition: item_json_func.h:77
@ ooa_all
Definition: item_json_func.h:78
@ ooa_uninitialized
Definition: item_json_func.h:81
@ ooa_error
Definition: item_json_func.h:80
enum_json_diff_status
The result of applying JSON diffs on a JSON value using apply_json_diff().
Definition: json_diff.h:264
std::unique_ptr< Json_dom > Json_dom_ptr
Definition: json_dom.h:65
std::function< void()> JsonErrorHandler
Definition: json_error_handler.h:36
std::function< void(const char *parse_err, size_t err_offset)> JsonParseErrorHandler
Definition: json_error_handler.h:35
This file contains interface support for the JSON path abstraction.
Functions for validating a string against a JSON Schema.
A better implementation of the UNIX ctype(3) library.
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb4_bin
Definition: ctype-utf8.cc:7822
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:477
Some integer typedefs for easier portability.
uint8_t uint8
Definition: my_inttypes.h:63
unsigned char uchar
Definition: my_inttypes.h:52
long long int longlong
Definition: my_inttypes.h:55
uint16_t uint16
Definition: my_inttypes.h:65
uint32_t uint32
Definition: my_inttypes.h:67
uint64_t table_map
Definition: my_table_map.h:30
Interface for low level time utilities.
unsigned int my_time_flags_t
Flags to str_to_datetime and number_to_datetime.
Definition: my_time.h:94
Common definition between mysql server & client.
#define MAX_BLOB_WIDTH
Default width for blob in bytes.
Definition: mysql_com.h:906
Time declarations shared between the server and client API: you should not add anything to this heade...
static char * path
Definition: mysqldump.cc:149
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1081
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
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
size_t size(const char *const c)
Definition: base64.h:46
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
Definition: gcs_xcom_synode.h:64
PSI_memory_key key_memory_JSON
Definition: psi_memory_key.cc:53
Our own string classes, used pervasively throughout the executor.
Definition: m_ctype.h:421
Definition: parser_yystype.h:182
Definition: item_json_func.cc:4009
Struct that points to a cell in m_paths and tells its status.
Definition: item_json_func.h:107
size_t m_index
Definition: item_json_func.h:109
enum_path_status m_status
Definition: item_json_func.h:108
Definition: mysql_time.h:82
Bison "location" class.
Definition: parse_location.h:43
Definition: table.h:1407
Definition: result.h:30
Json_on_response_type
Types of ON EMPTY/ON ERROR clauses for JSON_TABLE and JSON_VALUE.
Definition: table_function.h:192
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:39
@ STRING_RESULT
not valid for UDFs
Definition: udf_registration_types.h:41
@ INT_RESULT
double
Definition: udf_registration_types.h:43