1#ifndef ITEM_JSON_FUNC_INCLUDED
2#define ITEM_JSON_FUNC_INCLUDED
128 bool forbid_wildcards);
177 template <
typename... Args>
282 const char *calling_function,
String *value,
305 size_t *reslength,
bool require_string);
316 const char *
func_name()
const override {
return "json_valid"; }
337 const char *
func_name()
const override {
return "json_schema_valid"; }
365 return "json_schema_validation_report";
398 const char *
func_name()
const override {
return "json_contains"; }
438 const char *
func_name()
const override {
return "json_contains_path"; }
468 const char *
func_name()
const override {
return "json_type"; }
492 const char *
func_name()
const override {
return "cast_as_json"; }
513 const char *
func_name()
const override {
return "json_length"; }
527 const char *
func_name()
const override {
return "json_depth"; }
551 const char *
func_name()
const override {
return "json_keys"; }
576 const char *
func_name()
const override {
return "json_extract"; }
587 bool eq(
const Item *item,
bool binary_cmp)
const override;
595 template <
typename... Args>
625 const char *
func_name()
const override {
return "json_array_append"; }
638 const char *
func_name()
const override {
return "json_insert"; }
651 const char *
func_name()
const override {
return "json_array_insert"; }
666 template <
typename... Args>
669 m_json_set(json_set),
681 template <
typename... Args>
685 const char *
func_name()
const override {
return "json_set"; }
693 template <
typename... Args>
697 const char *
func_name()
const override {
return "json_replace"; }
705 template <
typename... Args>
713 const char *
func_name()
const override {
return "json_array"; }
739 const char *
func_name()
const override {
return "json_object"; }
767 template <
typename... Args>
772 const char *
func_name()
const override {
return "json_search"; }
799 template <
typename... Args>
803 const char *
func_name()
const override {
return "json_remove"; }
823 const char *
func_name()
const override {
return "json_merge_preserve"; }
853 const char *
func_name()
const override {
return "json_merge_patch"; }
874 const char *
func_name()
const override {
return "json_quote"; }
905 const char *
func_name()
const override {
return "json_unquote"; }
926 const char *
func_name()
const override {
return "json_pretty"; }
944 const char *
func_name()
const override {
return "json_storage_size"; }
963 const char *
func_name()
const override {
return "json_storage_free"; }
987 bool m_is_allowed{
false};
1003 const char *
func_name()
const override {
return "cast_as_array"; }
1016 bool no_conversions)
override;
1050 const char *
func_name()
const override {
return "json_overlaps"; }
1065 const char *
func_name()
const override {
return "member of"; }
1096 Item *on_empty_default,
1098 Item *on_error_default);
1100 const char *
func_name()
const override {
return "json_value"; }
1106 bool eq(
const Item *item,
bool binary_cmp)
const override;
1118 struct Default_value;
1158 int64_t extract_integer_value();
1160 int64_t extract_year_value();
1166 bool extract_datetime_value(
MYSQL_TIME *ltime);
1172 double extract_real_value();
1192 const char *calling_function,
int max_decimal_digits,
1193 bool add_bounding_box,
bool add_short_crs_urn,
1194 bool add_long_crs_urn,
uint32 *geometry_srid);
1225 const char *calling_function,
String *value,
1243 String *utf8_res,
const char **safep,
1244 size_t *safe_length);
A field that stores a JSON value.
Definition: field.h:3992
Definition: item_cmpfunc.h:292
Class that represents CAST(<expr> AS <type> ARRAY)
Definition: item_json_func.h:977
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:994
bool get_time(MYSQL_TIME *) override
Definition: item_json_func.h:1039
void allow_array_cast() override
A helper function to ensure proper usage of CAST(.
Definition: item_json_func.h:1014
const char * func_name() const override
Definition: item_json_func.h:1003
longlong val_int() override
Definition: item_json_func.h:1019
bool returns_array() const override
Whether the item returns array of its data type.
Definition: item_json_func.h:1005
bool get_date(MYSQL_TIME *, my_time_flags_t) override
Definition: item_json_func.h:1035
my_decimal * val_decimal(my_decimal *) override
Definition: item_json_func.h:1027
enum Functype functype() const override
Definition: item_json_func.h:1004
double val_real() override
Definition: item_json_func.h:1031
~Item_func_array_cast() override
Cast_target cast_type
Type to cast to.
Definition: item_json_func.h:979
String * val_str(String *) override
Definition: item_json_func.h:1023
Represents the JSON function JSON_ARRAY_APPEND()
Definition: item_json_func.h:620
Item_func_json_array_append(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:622
const char * func_name() const override
Definition: item_json_func.h:625
Represents the JSON function JSON_ARRAY_INSERT()
Definition: item_json_func.h:646
Item_func_json_array_insert(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:648
const char * func_name() const override
Definition: item_json_func.h:651
Represents the JSON function JSON_ARRAY()
Definition: item_json_func.h:703
const char * func_name() const override
Definition: item_json_func.h:713
Item_func_json_array(Args &&... parent_args)
Definition: item_json_func.h:706
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:715
Represents the JSON function JSON_CONTAINS_PATH()
Definition: item_json_func.h:425
void cleanup() override
Cleanup between executions of the statement.
Definition: item_json_func.cc:983
bool is_bool_func() const override
Definition: item_json_func.h:440
longlong val_int() override
Definition: item_json_func.cc:990
Json_path_cache m_path_cache
Definition: item_json_func.h:430
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:444
String m_doc_value
Definition: item_json_func.h:426
Item_func_json_contains_path(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:433
const char * func_name() const override
Definition: item_json_func.h:438
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:454
enum_one_or_all_type m_cached_ooa
Definition: item_json_func.h:427
Represents the JSON function JSON_CONTAINS()
Definition: item_json_func.h:390
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_json_func.h:401
optimize_type select_optimize(const THD *) override
Definition: item_json_func.h:400
Item_func_json_contains(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:395
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:407
longlong val_int() override
Definition: item_json_func.cc:925
String m_doc_value
Definition: item_json_func.h:391
enum Functype functype() const override
Definition: item_json_func.h:399
Json_path_cache m_path_cache
Definition: item_json_func.h:392
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:417
void cleanup() override
Cleanup between executions of the statement.
Definition: item_json_func.cc:919
const char * func_name() const override
Definition: item_json_func.h:398
bool is_bool_func() const override
Definition: item_json_func.h:403
Represents the JSON function JSON_DEPTH()
Definition: item_json_func.h:521
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:529
longlong val_int() override
Definition: item_json_func.cc:1733
String m_doc_value
Definition: item_json_func.h:522
const char * func_name() const override
Definition: item_json_func.h:527
Item_func_json_depth(const POS &pos, Item *a)
Definition: item_json_func.h:525
Represents the JSON function JSON_INSERT()
Definition: item_json_func.h:633
Item_func_json_insert(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:635
const char * func_name() const override
Definition: item_json_func.h:638
Represents the JSON function JSON_KEYS()
Definition: item_json_func.h:541
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_json_func.cc:1754
String m_doc_value
Definition: item_json_func.h:542
Item_func_json_keys(THD *thd, const POS &pos, Item *a, Item *b)
Definition: item_json_func.h:548
Item_func_json_keys(THD *thd, const POS &pos, Item *a)
Definition: item_json_func.h:545
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:553
const char * func_name() const override
Definition: item_json_func.h:551
Represents the JSON function JSON_LENGTH()
Definition: item_json_func.h:500
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:506
Item_func_json_length(const POS &pos, Item *doc)
Definition: item_json_func.h:504
longlong val_int() override
Definition: item_json_func.cc:1709
String m_doc_value
Definition: item_json_func.h:501
const char * func_name() const override
Definition: item_json_func.h:513
Represents the JSON function JSON_MERGE_PATCH.
Definition: item_json_func.h:848
Item_func_json_merge_patch(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:850
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:855
const char * func_name() const override
Definition: item_json_func.h:853
Represents the JSON function JSON_MERGE_PRESERVE.
Definition: item_json_func.h:818
const char * func_name() const override
Definition: item_json_func.h:823
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:825
Item_func_json_merge_preserve(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:820
Represents the JSON function JSON_MERGE.
Definition: item_json_func.h:838
bool is_deprecated() const override
Definition: item_json_func.h:842
Definition: item_json_func.h:1046
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_json_func.h:1052
enum Functype functype() const override
Definition: item_json_func.h:1051
const char * func_name() const override
Definition: item_json_func.h:1050
Item_func_json_overlaps(const POS &pos, Item *a, Item *b)
Definition: item_json_func.h:1048
optimize_type select_optimize(const THD *) override
Definition: item_json_func.h:1053
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:1056
Represents the JSON_PRETTY function.
Definition: item_json_func.h:922
const char * func_name() const override
Definition: item_json_func.h:926
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:928
Item_func_json_pretty(const POS &pos, Item *a)
Definition: item_json_func.h:924
Represents the JSON function JSON_QUOTE()
Definition: item_json_func.h:867
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:876
String m_value
Definition: item_json_func.h:868
Item_func_json_quote(const POS &pos, PT_item_list *a)
Definition: item_json_func.h:871
const char * func_name() const override
Definition: item_json_func.h:874
Represents the JSON function JSON_REMOVE()
Definition: item_json_func.h:794
const char * func_name() const override
Definition: item_json_func.h:803
bool can_use_in_partial_update() const override
Can this function type be used in partial update?
Definition: item_json_func.h:796
String m_doc_value
Definition: item_json_func.h:795
Item_func_json_remove(Args &&... parent_args)
Definition: item_json_func.h:800
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:805
Represents the JSON function JSON_REPLACE()
Definition: item_json_func.h:691
const char * func_name() const override
Definition: item_json_func.h:697
Item_func_json_replace(Args &&... parent_args)
Definition: item_json_func.h:694
Represents the JSON function JSON_OBJECT()
Definition: item_json_func.h:727
String tmp_key_value
Definition: item_json_func.h:728
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:741
Item_func_json_row_object(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:731
const char * func_name() const override
Definition: item_json_func.h:739
Represents the JSON function JSON_SCHEMA_VALID( <json schema>, <json doc> )
Definition: item_json_func.h:332
unique_ptr_destroy_only< const Json_schema_validator > m_cached_schema_validator
Definition: item_json_func.h:351
Item_func_json_schema_valid(const POS &pos, Item *a, Item *b)
Definition: item_json_func.cc:588
bool val_bool() override
Definition: item_json_func.cc:648
bool fix_fields(THD *, Item **) override
Definition: item_json_func.cc:575
longlong val_int() override
Definition: item_json_func.h:341
const char * func_name() const override
Definition: item_json_func.h:337
~Item_func_json_schema_valid() override
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_json_func.cc:586
Represents the JSON function JSON_SCHEMA_VALIDATION_REPORT( <json schema>, <json doc> )
Definition: item_json_func.h:358
const char * func_name() const override
Definition: item_json_func.h:364
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:370
unique_ptr_destroy_only< const Json_schema_validator > m_cached_schema_validator
Definition: item_json_func.h:384
void cleanup() override
JSON_*() support methods.
Definition: item_json_func.cc:687
~Item_func_json_schema_validation_report() override
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_json_func.cc:699
bool fix_fields(THD *, Item **) override
Definition: item_json_func.cc:676
Item_func_json_schema_validation_report(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.cc:692
Represents the JSON function JSON_SEARCH()
Definition: item_json_func.h:753
String m_doc_value
Definition: item_json_func.h:754
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:781
enum_one_or_all_type m_cached_ooa
Definition: item_json_func.h:755
Item_func_like * m_like_node
Definition: item_json_func.h:759
Item_func_json_search(Args &&... parent_args)
Construct a JSON_SEARCH() node.
Definition: item_json_func.h:768
const char * func_name() const override
Definition: item_json_func.h:772
Item_string * m_source_string_item
Definition: item_json_func.h:758
Common base class for JSON_SET() and JSON_REPLACE().
Definition: item_json_func.h:659
Item_func_json_set_replace(bool json_set, Args &&... parent_args)
Definition: item_json_func.h:667
const bool m_json_set
True if this is JSON_SET, false if it is JSON_REPLACE.
Definition: item_json_func.h:661
Json_path_clone m_path
Definition: item_json_func.h:662
bool can_use_in_partial_update() const override
Can this function type be used in partial update?
Definition: item_json_func.h:663
Represents the JSON function JSON_SET()
Definition: item_json_func.h:679
Item_func_json_set(Args &&... parent_args)
Definition: item_json_func.h:682
const char * func_name() const override
Definition: item_json_func.h:685
Class that represents the function JSON_STORAGE_FREE.
Definition: item_json_func.h:959
Item_func_json_storage_free(const POS &pos, Item *a)
Definition: item_json_func.h:961
const char * func_name() const override
Definition: item_json_func.h:963
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:965
Class that represents the function JSON_STORAGE_SIZE.
Definition: item_json_func.h:940
Item_func_json_storage_size(const POS &pos, Item *a)
Definition: item_json_func.h:942
const char * func_name() const override
Definition: item_json_func.h:944
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:946
Represents the JSON function JSON_TYPE.
Definition: item_json_func.h:462
const char * func_name() const override
Definition: item_json_func.h:468
String * val_str(String *) override
Definition: item_json_func.cc:1231
String m_value
Definition: item_json_func.h:463
Item_func_json_type(const POS &pos, Item *a)
Definition: item_json_func.h:466
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.cc:1180
Represents the JSON function JSON_UNQUOTE()
Definition: item_json_func.h:895
String m_value
Definition: item_json_func.h:896
const char * func_name() const override
Definition: item_json_func.h:905
Item_func_json_unquote(const POS &pos, Item *a)
Definition: item_json_func.h:903
Item_func_json_unquote(const POS &pos, PT_item_list *a)
Definition: item_json_func.h:900
enum Functype functype() const override
Definition: item_json_func.h:907
String m_conversion_buffer
Definition: item_json_func.h:897
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:909
Represents the JSON function JSON_VALID( <value> )
Definition: item_json_func.h:310
const char * func_name() const override
Definition: item_json_func.h:316
Item_func_json_valid(const POS &pos, Item *a)
Definition: item_json_func.h:314
longlong val_int() override
Definition: item_json_func.cc:527
bool is_bool_func() const override
Definition: item_json_func.h:318
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:322
String m_value
Definition: item_json_func.h:311
Class implementing the JSON_VALUE function.
Definition: item_json_func.h:1091
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:1129
~Item_func_json_value() override
Json_on_response_type m_on_error
Type of the ON ERROR clause.
Definition: item_json_func.h:1125
Cast_target m_cast_target
The target data type.
Definition: item_json_func.h:1131
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:1127
const char * func_name() const override
Definition: item_json_func.h:1100
Json_on_response_type m_on_empty
Type of the ON EMPTY clause.
Definition: item_json_func.h:1123
Json_path m_path_json
Parsed path.
Definition: item_json_func.h:1118
Definition: item_cmpfunc.h:2349
Definition: item_json_func.h:1061
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:1078
Item_func_member_of(const POS &pos, Item *a, Item *b)
Definition: item_json_func.h:1063
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:1067
enum Functype functype() const override
Definition: item_json_func.h:1066
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_json_func.h:1072
Item * key_item() const override
Definition: item_json_func.h:1077
optimize_type select_optimize(const THD *) override
Definition: item_json_func.h:1073
const char * func_name() const override
Definition: item_json_func.h:1065
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:593
void update_used_tables() final
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_json_func.cc:1918
String m_doc_value
Definition: item_json_func.h:605
table_map calculate_not_null_tables() const
Calculates the set of tables to return from not_used_tables().
Definition: item_json_func.cc:1923
Item_func_modify_json_in_path(Args &&... parent_args)
Definition: item_json_func.h:596
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:1906
Definition: item_func.h:100
Item ** args
Array of pointers to arguments.
Definition: item_func.h:107
Functype
Definition: item_func.h:183
@ JSON_CONTAINS
Definition: item_func.h:300
@ JSON_UNQUOTE_FUNC
Definition: item_func.h:302
@ MEMBER_OF_FUNC
Definition: item_func.h:303
@ TYPECAST_FUNC
Definition: item_func.h:231
@ JSON_OVERLAPS
Definition: item_func.h:301
optimize_type
Definition: item_func.h:315
@ OPTIMIZE_KEY
Definition: item_func.h:317
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:639
enum Type type() const override
Definition: item_func.h:322
virtual Item * key_item() const
Definition: item_func.h:489
bool param_type_is_default(THD *thd, uint start, uint end, uint step, enum_field_types def)
For arguments of this Item_func ("args" array), in range [start, start+step, start+2*step,...
Definition: item_func.cc:526
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:732
bool fix_fields(THD *, Item **ref) override
Definition: item_func.cc:404
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:779
bool eq(const Item *item, bool binary_cmp) const override
Definition: item_func.cc:762
bool null_on_null
Affects how to determine that NULL argument implies a NULL function return.
Definition: item_func.h:162
Definition: item_func.h:942
Base class for all item functions that a return JSON value.
Definition: item_json_func.h:150
void mark_for_partial_update(const Field_json *field)
Mark this expression as used in partial update.
Definition: item_json_func.cc:2307
String m_conversion_buffer
String used for converting JSON text values to utf8mb4 charset.
Definition: item_json_func.h:158
longlong val_int() override
Definition: item_json_func.cc:1311
Item_result cast_to_int_type() const override
Definition: item_json_func.h:198
String m_value
String used when reading JSON binary values or JSON text values.
Definition: item_json_func.h:156
virtual bool can_use_in_partial_update() const
Can this function type be used in partial update?
Definition: item_json_func.h:152
bool get_date(MYSQL_TIME *ltime, my_time_flags_t fuzzydate) override
Definition: item_json_func.cc:1289
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:184
bool get_time(MYSQL_TIME *ltime) override
Definition: item_json_func.cc:1300
String * val_str(String *arg) override
Definition: item_json_func.cc:1276
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_json_func.cc:1333
enum Item_result result_type() const override
Definition: item_json_func.h:188
String m_string_buffer
String used for converting a JSON value to text in val_str().
Definition: item_json_func.h:160
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:2324
Json_path_cache m_path_cache
Definition: item_json_func.h:163
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:169
double val_real() override
Definition: item_json_func.cc:1320
Item_json_func(THD *thd, Args &&... parent_args)
Construct an Item_json_func instance.
Definition: item_json_func.h:178
void cleanup() override
JSON_*() support methods.
Definition: item_json_func.cc:521
virtual const char * func_name() const =0
Definition: item_strfunc.h:75
Represents a "CAST( <value> AS JSON )" coercion.
Definition: item_json_func.h:478
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_json_func.cc:1653
const char * cast_type() const
Definition: item_json_func.h:493
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:1700
Item_json_func super
Definition: item_json_func.h:479
const char * func_name() const override
Definition: item_json_func.h:492
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:485
Item_typecast_json(THD *thd, const POS &pos, Item *a)
Definition: item_json_func.h:482
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:932
uint32 max_char_length() const
Definition: item.h:3300
void set_nullable(bool nullable)
Definition: item.h:3605
virtual bool propagate_type(THD *thd, const Type_properties &type)
Propagate data type specifications into parameters and user variables.
Definition: item.h:1318
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:6822
virtual bool val_json(Json_wrapper *result)
Get a JSON value from an Item.
Definition: item.h:2066
enum_const_item_cache
How to cache constant JSON data.
Definition: item.h:1005
@ CACHE_NONE
Don't cache.
Definition: item.h:1007
@ CACHE_JSON_VALUE
Source data is a JSON string, parse and cache result.
Definition: item.h:1009
@ CACHE_JSON_ATOM
Source data is SQL scalar, convert and cache result.
Definition: item.h:1011
void set_data_type_json()
Set the data type of the Item to be JSON.
Definition: item.h:1737
void set_data_type_string(uint32 max_l)
Set the Item to be variable length string.
Definition: item.h:1586
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:1360
Represents a JSON array container, i.e.
Definition: json_dom.h:521
JSON DOM abstract base class.
Definition: json_dom.h:174
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:374
Path cache for JSON functions.
Definition: item_json_func.h:83
Json_path_cache(THD *thd, uint size)
Json_path_cache.
Definition: item_json_func.cc:457
const Json_path * get_path(uint arg_idx) const
Return an already parsed path expression.
Definition: item_json_func.cc:502
void reset_cache()
Reset the cache for re-use when a statement is re-executed.
Definition: item_json_func.cc:512
enum_path_status
Enum that tells the status of a cell in m_paths.
Definition: item_json_func.h:92
Prealloced_array< Json_path, 8 > m_paths
List of paths.
Definition: item_json_func.h:89
Mem_root_array< Path_cell > m_arg_idx_to_vector_idx
Map argument indexes to indexes into m_paths.
Definition: item_json_func.h:105
String m_path_value
Holder for path strings.
Definition: item_json_func.h:86
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:464
A lightweight path expression.
Definition: json_path.h:450
A JSON path expression.
Definition: json_path.h:356
A class that is capable of holding objects of any sub-type of Json_scalar.
Definition: json_dom.h:1911
Json_schema_validator is an object that contains a JSON Schema that can be re-used multiple times.
Definition: json_schema.h:126
Abstraction for accessing JSON values irrespective of whether they are (started out as) binary JSON v...
Definition: json_dom.h:1168
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:425
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:104
virtual void add_json_info(Json_object *json_obj)
Add all the node-specific json fields.
Definition: parse_tree_node_base.h:301
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:70
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:94
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:30
@ MYSQL_TYPE_JSON
Definition: field_types.h:78
Cast_target
Definition: item_create.h:55
static int flags[50]
Definition: hp_test1.cc:39
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:1060
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:2330
bool sort_and_remove_dups(const Json_wrapper &orig, Sorted_index_array *v)
Sort the elements of a JSON array and remove duplicates.
Definition: item_json_func.cc:753
Prealloced_array< size_t, 16 > Sorted_index_array
Definition: item_json_func.h:1251
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:81
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:4054
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:1582
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:1080
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:219
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:132
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:1388
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:1639
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:68
@ ooa_null
Definition: item_json_func.h:71
@ ooa_one
Definition: item_json_func.h:69
@ ooa_all
Definition: item_json_func.h:70
@ ooa_uninitialized
Definition: item_json_func.h:73
@ ooa_error
Definition: item_json_func.h:72
std::unique_ptr< Json_dom > Json_dom_ptr
Definition: json_dom.h:66
std::function< void()> JsonErrorHandler
Definition: json_error_handler.h:31
std::function< void(const char *parse_err, size_t err_offset)> JsonParseErrorHandler
Definition: json_error_handler.h:30
This file contains interface support for the JSON path abstraction.
A better implementation of the UNIX ctype(3) library.
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb4_bin
Definition: ctype-utf8.cc:7822
std::unique_ptr< T, Destroy_only< T > > unique_ptr_destroy_only
std::unique_ptr, but only destroying.
Definition: my_alloc.h:488
Some integer typedefs for easier portability.
uint8_t uint8
Definition: my_inttypes.h:62
unsigned char uchar
Definition: my_inttypes.h:51
long long int longlong
Definition: my_inttypes.h:54
uint16_t uint16
Definition: my_inttypes.h:64
uint32_t uint32
Definition: my_inttypes.h:66
uint64_t table_map
Definition: my_table_map.h:29
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:93
Common definition between mysql server & client.
#define MAX_BLOB_WIDTH
Default width for blob in bytes.
Definition: mysql_com.h:909
Time declarations shared between the server and client API: you should not add anything to this heade...
static char * path
Definition: mysqldump.cc:148
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1085
static PFS_engine_table_share_proxy table
Definition: pfs.cc:60
Definition: buf0block_hint.cc:29
PT & ref(PT *tp)
Definition: tablespace_impl.cc:358
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:417
Definition: varlen_sort.h:183
PSI_memory_key key_memory_JSON
Definition: psi_memory_key.cc:52
type_conversion_status
Status when storing a value in a field or converting from one datatype to another.
Definition: field.h:203
Our own string classes, used pervasively throughout the executor.
Definition: m_ctype.h:422
Definition: parser_yystype.h:180
Definition: item_json_func.cc:4172
Struct that points to a cell in m_paths and tells its status.
Definition: item_json_func.h:99
size_t m_index
Definition: item_json_func.h:101
enum_path_status m_status
Definition: item_json_func.h:100
Definition: mysql_time.h:81
Bison "location" class.
Definition: parse_location.h:42
Json_on_response_type
Types of ON EMPTY/ON ERROR clauses for JSON_TABLE and JSON_VALUE.
Definition: table_function.h:191
Item_result
Type of the user defined function return slot and arguments.
Definition: udf_registration_types.h:38
@ STRING_RESULT
not valid for UDFs
Definition: udf_registration_types.h:40
@ INT_RESULT
double
Definition: udf_registration_types.h:42