1#ifndef ITEM_JSON_FUNC_INCLUDED
2#define ITEM_JSON_FUNC_INCLUDED
139 bool forbid_wildcards);
188 template <
typename... Args>
318 size_t *reslength,
bool require_string);
329 const char *
func_name()
const override {
return "json_valid"; }
352 const char *
func_name()
const override {
return "json_schema_valid"; }
378 return "json_schema_validation_report";
413 const char *
func_name()
const override {
return "json_contains"; }
454 const char *
func_name()
const override {
return "json_contains_path"; }
486 const char *
func_name()
const override {
return "json_type"; }
512 const char *
func_name()
const override {
return "cast_as_json"; }
534 const char *
func_name()
const override {
return "json_length"; }
549 const char *
func_name()
const override {
return "json_depth"; }
575 const char *
func_name()
const override {
return "json_keys"; }
601 const char *
func_name()
const override {
return "json_extract"; }
614 bool eq(
const Item *item)
const override;
622 template <
typename... Args>
652 const char *
func_name()
const override {
return "json_array_append"; }
665 const char *
func_name()
const override {
return "json_insert"; }
678 const char *
func_name()
const override {
return "json_array_insert"; }
693 template <
typename... Args>
696 m_json_set(json_set),
708 template <
typename... Args>
712 const char *
func_name()
const override {
return "json_set"; }
720 template <
typename... Args>
724 const char *
func_name()
const override {
return "json_replace"; }
732 template <
typename... Args>
740 const char *
func_name()
const override {
return "json_array"; }
775 const char *
func_name()
const override {
return "json_object"; }
795 bool m_inject_object_hash{
false};
803 const char *
func_name()
const override {
return "json_duality_object"; }
812 bool set_json_arrayagg_keys(
THD *thd);
819 return m_json_arrayagg_keys;
840 template <
typename... Args>
845 const char *
func_name()
const override {
return "json_search"; }
874 template <
typename... Args>
878 const char *
func_name()
const override {
return "json_remove"; }
898 const char *
func_name()
const override {
return "json_merge_preserve"; }
928 const char *
func_name()
const override {
return "json_merge_patch"; }
949 const char *
func_name()
const override {
return "json_quote"; }
983 const char *
func_name()
const override {
return "json_unquote"; }
1005 const char *
func_name()
const override {
return "json_pretty"; }
1026 const char *
func_name()
const override {
return "json_storage_size"; }
1047 const char *
func_name()
const override {
return "json_storage_free"; }
1073 bool m_is_allowed{
false};
1089 const char *
func_name()
const override {
return "cast_as_array"; }
1102 bool no_conversions)
override;
1140 const char *
func_name()
const override {
return "json_overlaps"; }
1155 const char *
func_name()
const override {
return "member of"; }
1187 Item *on_empty_default,
1189 Item *on_error_default);
1191 const char *
func_name()
const override {
return "json_value"; }
1213 struct Default_value;
1253 int64_t extract_integer_value();
1255 int64_t extract_year_value();
1257 bool extract_date_value(
Date_val *date);
1259 bool extract_time_value(
Time_val *time);
1267 double extract_real_value();
1287 const char *calling_function,
int max_decimal_digits,
1288 bool add_bounding_box,
bool add_short_crs_urn,
1289 bool add_long_crs_urn,
uint32 *geometry_srid);
1338 String *utf8_res,
const char **safep,
1339 size_t *safe_length);
Definition: my_temporal.h:395
Definition: my_temporal.h:339
A field that stores a JSON value.
Definition: field.h:3835
Definition: item_cmpfunc.h:304
Class that represents CAST(<expr> AS <type> ARRAY)
Definition: item_json_func.h:1063
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:1080
bool val_time(Time_val *) override
Evaluate the item and return result as a time value.
Definition: item_json_func.h:1125
void allow_array_cast() override
A helper function to ensure proper usage of CAST(.
Definition: item_json_func.h:1100
const char * func_name() const override
Definition: item_json_func.h:1089
longlong val_int() override
Definition: item_json_func.h:1105
bool returns_array() const override
Whether the item returns array of its data type.
Definition: item_json_func.h:1091
my_decimal * val_decimal(my_decimal *) override
Definition: item_json_func.h:1113
enum Functype functype() const override
Definition: item_json_func.h:1090
double val_real() override
Definition: item_json_func.h:1117
bool val_date(Date_val *, my_time_flags_t) override
Evaluate the item and return result as a date value.
Definition: item_json_func.h:1121
~Item_func_array_cast() override
Cast_target cast_type
Type to cast to.
Definition: item_json_func.h:1065
bool val_datetime(Datetime_val *, my_time_flags_t) override
Evaluate the item and return result as a datetime value.
Definition: item_json_func.h:1129
String * val_str(String *) override
Definition: item_json_func.h:1109
Represents the JSON function JSON_ARRAY_APPEND()
Definition: item_json_func.h:647
Item_func_json_array_append(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:649
const char * func_name() const override
Definition: item_json_func.h:652
Represents the JSON function JSON_ARRAY_INSERT()
Definition: item_json_func.h:673
Item_func_json_array_insert(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:675
const char * func_name() const override
Definition: item_json_func.h:678
Represents the JSON function JSON_ARRAY()
Definition: item_json_func.h:730
enum Functype functype() const override
Definition: item_json_func.h:741
Item_func_json_array(Args &&...parent_args)
Definition: item_json_func.h:733
const char * func_name() const override
Definition: item_json_func.h:740
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:743
Represents the JSON function JSON_CONTAINS_PATH()
Definition: item_json_func.h:441
void cleanup() override
Cleanup between executions of the statement.
Definition: item_json_func.cc:911
bool is_bool_func() const override
Definition: item_json_func.h:457
longlong val_int() override
Definition: item_json_func.cc:918
Json_path_cache m_path_cache
Definition: item_json_func.h:446
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:461
enum Functype functype() const override
Definition: item_json_func.h:455
String m_doc_value
Definition: item_json_func.h:442
Item_func_json_contains_path(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:449
const char * func_name() const override
Definition: item_json_func.h:454
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:472
enum_one_or_all_type m_cached_ooa
Definition: item_json_func.h:443
Represents the JSON function JSON_CONTAINS()
Definition: item_json_func.h:405
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_json_func.h:416
optimize_type select_optimize(const THD *) override
Definition: item_json_func.h:415
Item_func_json_contains(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:410
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:422
longlong val_int() override
Definition: item_json_func.cc:853
String m_doc_value
Definition: item_json_func.h:406
enum Functype functype() const override
Definition: item_json_func.h:414
Json_path_cache m_path_cache
Definition: item_json_func.h:407
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:433
void cleanup() override
Cleanup between executions of the statement.
Definition: item_json_func.cc:847
const char * func_name() const override
Definition: item_json_func.h:413
bool is_bool_func() const override
Definition: item_json_func.h:418
Represents the JSON function JSON_DEPTH()
Definition: item_json_func.h:543
enum Functype functype() const override
Definition: item_json_func.h:550
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:552
longlong val_int() override
Definition: item_json_func.cc:1578
String m_doc_value
Definition: item_json_func.h:544
const char * func_name() const override
Definition: item_json_func.h:549
Item_func_json_depth(const POS &pos, Item *a)
Definition: item_json_func.h:547
Represents the JSON function JSON_DUALITY_OBJECT()
Definition: item_json_func.h:790
jdv::Duality_view_tags table_tags() const
Definition: item_json_func.h:814
enum Functype functype() const override
Definition: item_json_func.h:804
bool get_inject_object_hash() const
Definition: item_json_func.h:797
std::unordered_set< std::string > get_json_arrayagg_keys()
Definition: item_json_func.h:818
Item_func_json_row_object super
Definition: item_json_func.h:791
const char * func_name() const override
Definition: item_json_func.h:803
std::unordered_set< std::string > m_json_arrayagg_keys
Definition: item_json_func.h:796
Represents the JSON function JSON_INSERT()
Definition: item_json_func.h:660
Item_func_json_insert(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:662
const char * func_name() const override
Definition: item_json_func.h:665
Represents the JSON function JSON_KEYS()
Definition: item_json_func.h:565
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_json_func.cc:1599
String m_doc_value
Definition: item_json_func.h:566
Item_func_json_keys(THD *thd, const POS &pos, Item *a, Item *b)
Definition: item_json_func.h:572
Item_func_json_keys(THD *thd, const POS &pos, Item *a)
Definition: item_json_func.h:569
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:577
const char * func_name() const override
Definition: item_json_func.h:575
Represents the JSON function JSON_LENGTH()
Definition: item_json_func.h:520
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:526
Item_func_json_length(const POS &pos, Item *doc)
Definition: item_json_func.h:524
longlong val_int() override
Definition: item_json_func.cc:1554
String m_doc_value
Definition: item_json_func.h:521
enum Functype functype() const override
Definition: item_json_func.h:535
const char * func_name() const override
Definition: item_json_func.h:534
Represents the JSON function JSON_MERGE_PATCH.
Definition: item_json_func.h:923
Item_func_json_merge_patch(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:925
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:930
const char * func_name() const override
Definition: item_json_func.h:928
Represents the JSON function JSON_MERGE_PRESERVE.
Definition: item_json_func.h:893
const char * func_name() 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
Item_func_json_merge_preserve(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:895
Represents the JSON function JSON_MERGE.
Definition: item_json_func.h:913
bool is_deprecated() const override
Definition: item_json_func.h:917
Definition: item_json_func.h:1136
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_json_func.h:1142
enum Functype functype() const override
Definition: item_json_func.h:1141
const char * func_name() const override
Definition: item_json_func.h:1140
Item_func_json_overlaps(const POS &pos, Item *a, Item *b)
Definition: item_json_func.h:1138
optimize_type select_optimize(const THD *) override
Definition: item_json_func.h:1143
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:1146
Represents the JSON_PRETTY function.
Definition: item_json_func.h:1001
const char * func_name() const override
Definition: item_json_func.h:1005
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:1009
enum Functype functype() const override
Definition: item_json_func.h:1007
Item_func_json_pretty(const POS &pos, Item *a)
Definition: item_json_func.h:1003
Represents the JSON function JSON_QUOTE()
Definition: item_json_func.h:942
enum Functype functype() const override
Definition: item_json_func.h:951
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:953
String m_value
Definition: item_json_func.h:943
Item_func_json_quote(const POS &pos, PT_item_list *a)
Definition: item_json_func.h:946
const char * func_name() const override
Definition: item_json_func.h:949
Represents the JSON function JSON_REMOVE()
Definition: item_json_func.h:869
Item_func_json_remove(Args &&...parent_args)
Definition: item_json_func.h:875
const char * func_name() const override
Definition: item_json_func.h:878
bool can_use_in_partial_update() const override
Can this function type be used in partial update?
Definition: item_json_func.h:871
String m_doc_value
Definition: item_json_func.h:870
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:880
Represents the JSON function JSON_REPLACE()
Definition: item_json_func.h:718
Item_func_json_replace(Args &&...parent_args)
Definition: item_json_func.h:721
const char * func_name() const override
Definition: item_json_func.h:724
Represents the JSON function JSON_OBJECT()
Definition: item_json_func.h:755
String tmp_key_value
Definition: item_json_func.h:756
Item_func_json_row_object(THD *thd, mem_root_deque< Item * > *list)
Definition: item_json_func.h:767
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:778
enum Functype functype() const override
Definition: item_json_func.h:776
Item_func_json_row_object(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.h:759
const char * func_name() const override
Definition: item_json_func.h:775
Represents the JSON function JSON_SCHEMA_VALID( <json schema>, <json doc> )
Definition: item_json_func.h:347
Item_func_json_schema_valid(const POS &pos, Item *a, Item *b)
Definition: item_json_func.cc:687
bool val_bool() override
Definition: item_json_func.cc:750
bool fix_fields(THD *, Item **) override
Definition: item_json_func.cc:674
longlong val_int() override
Definition: item_json_func.h:357
Json_schema_validator m_cached_schema_validator
Definition: item_json_func.h:364
enum Functype functype() const override
Definition: item_json_func.h:353
const char * func_name() const override
Definition: item_json_func.h:352
~Item_func_json_schema_valid() override
void cleanup() override
Called for every Item after use (preparation and execution).
Definition: item_json_func.cc:685
Represents the JSON function JSON_SCHEMA_VALIDATION_REPORT( <json schema>, <json doc> )
Definition: item_json_func.h:371
const char * func_name() const override
Definition: item_json_func.h:377
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:387
Json_schema_validator m_cached_schema_validator
Definition: item_json_func.h:399
void cleanup() override
JSON_*() support methods.
Definition: item_json_func.cc:789
~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:801
bool fix_fields(THD *, Item **) override
Definition: item_json_func.cc:778
Item_func_json_schema_validation_report(THD *thd, const POS &pos, PT_item_list *a)
Definition: item_json_func.cc:794
enum Functype functype() const override
Definition: item_json_func.h:381
Represents the JSON function JSON_SEARCH()
Definition: item_json_func.h:826
String m_doc_value
Definition: item_json_func.h:827
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:856
enum_one_or_all_type m_cached_ooa
Definition: item_json_func.h:828
Item_func_like * m_like_node
Definition: item_json_func.h:832
Item_func_json_search(Args &&...parent_args)
Construct a JSON_SEARCH() node.
Definition: item_json_func.h:841
enum Functype functype() const override
Definition: item_json_func.h:847
const char * func_name() const override
Definition: item_json_func.h:845
Item_string * m_source_string_item
Definition: item_json_func.h:831
Common base class for JSON_SET() and JSON_REPLACE().
Definition: item_json_func.h:686
Item_func_json_set_replace(bool json_set, Args &&...parent_args)
Definition: item_json_func.h:694
const bool m_json_set
True if this is JSON_SET, false if it is JSON_REPLACE.
Definition: item_json_func.h:688
Json_path_clone m_path
Definition: item_json_func.h:689
bool can_use_in_partial_update() const override
Can this function type be used in partial update?
Definition: item_json_func.h:690
Represents the JSON function JSON_SET()
Definition: item_json_func.h:706
Item_func_json_set(Args &&...parent_args)
Definition: item_json_func.h:709
const char * func_name() const override
Definition: item_json_func.h:712
Class that represents the function JSON_STORAGE_FREE.
Definition: item_json_func.h:1043
enum Functype functype() const override
Definition: item_json_func.h:1048
Item_func_json_storage_free(const POS &pos, Item *a)
Definition: item_json_func.h:1045
const char * func_name() const override
Definition: item_json_func.h:1047
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:1050
Class that represents the function JSON_STORAGE_SIZE.
Definition: item_json_func.h:1022
Item_func_json_storage_size(const POS &pos, Item *a)
Definition: item_json_func.h:1024
const char * func_name() const override
Definition: item_json_func.h:1026
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:1029
enum Functype functype() const override
Definition: item_json_func.h:1027
Represents the JSON function JSON_TYPE.
Definition: item_json_func.h:480
const char * func_name() const override
Definition: item_json_func.h:486
String * val_str(String *) override
Definition: item_json_func.cc:1056
String m_value
Definition: item_json_func.h:481
Item_func_json_type(const POS &pos, Item *a)
Definition: item_json_func.h:484
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.cc:1047
enum Functype functype() const override
Definition: item_json_func.h:487
Represents the JSON function JSON_UNQUOTE()
Definition: item_json_func.h:973
String m_value
Definition: item_json_func.h:974
const char * func_name() const override
Definition: item_json_func.h:983
Item_func_json_unquote(const POS &pos, Item *a)
Definition: item_json_func.h:981
Item_func_json_unquote(const POS &pos, PT_item_list *a)
Definition: item_json_func.h:978
enum Functype functype() const override
Definition: item_json_func.h:985
String m_conversion_buffer
Definition: item_json_func.h:975
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:987
Represents the JSON function JSON_VALID( <value> )
Definition: item_json_func.h:323
const char * func_name() const override
Definition: item_json_func.h:329
Item_func_json_valid(const POS &pos, Item *a)
Definition: item_json_func.h:327
longlong val_int() override
Definition: item_json_func.cc:629
enum Functype functype() const override
Definition: item_json_func.h:330
bool is_bool_func() const override
Definition: item_json_func.h:332
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:336
String m_value
Definition: item_json_func.h:324
Class implementing the JSON_VALUE function.
Definition: item_json_func.h:1182
enum Functype functype() const override
Definition: item_json_func.h:1192
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:1224
~Item_func_json_value() override
Json_on_response_type m_on_error
Type of the ON ERROR clause.
Definition: item_json_func.h:1220
Cast_target m_cast_target
The target data type.
Definition: item_json_func.h:1226
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:1222
const char * func_name() const override
Definition: item_json_func.h:1191
Json_on_response_type m_on_empty
Type of the ON EMPTY clause.
Definition: item_json_func.h:1218
Json_path m_path_json
Parsed path.
Definition: item_json_func.h:1213
Definition: item_cmpfunc.h:2490
Definition: item_json_func.h:1151
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:1169
Item_func_member_of(const POS &pos, Item *a, Item *b)
Definition: item_json_func.h:1153
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:1157
enum Functype functype() const override
Definition: item_json_func.h:1156
bool gc_subst_analyzer(uchar **) override
Analyzer function for GC substitution.
Definition: item_json_func.h:1163
Item * key_item() const override
Definition: item_json_func.h:1168
optimize_type select_optimize(const THD *) override
Definition: item_json_func.h:1164
const char * func_name() const override
Definition: item_json_func.h:1155
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:620
void update_used_tables() final
Updates used tables, not null tables information and accumulates properties up the item tree,...
Definition: item_json_func.cc:1772
String m_doc_value
Definition: item_json_func.h:632
Item_func_modify_json_in_path(Args &&...parent_args)
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:1777
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:1759
Definition: item_func.h:101
Item ** args
Array of pointers to arguments.
Definition: item_func.h:108
bool reject_vector_args()
Definition: item_func.cc:1617
Functype
Definition: item_func.h:214
@ JSON_VALUE_FUNC
Definition: item_func.h:360
@ JSON_SCHEMA_VALIDATION_REPORT_FUNC
Definition: item_func.h:362
@ JSON_STORAGE_SIZE_FUNC
Definition: item_func.h:358
@ JSON_SEARCH_FUNC
Definition: item_func.h:361
@ JSON_STORAGE_FREE_FUNC
Definition: item_func.h:359
@ JSON_CONTAINS
Definition: item_func.h:333
@ JSON_VALID_FUNC
Definition: item_func.h:353
@ JSON_UNQUOTE_FUNC
Definition: item_func.h:335
@ JSON_CONTAINS_PATH_FUNC
Definition: item_func.h:357
@ JSON_ARRAY_FUNC
Definition: item_func.h:352
@ JSON_SCHEMA_VALID_FUNC
Definition: item_func.h:363
@ JSON_DEPTH_FUNC
Definition: item_func.h:348
@ JSON_QUOTE_FUNC
Definition: item_func.h:356
@ JSON_OBJECT_FUNC
Definition: item_func.h:350
@ JSON_TYPE_FUNC
Definition: item_func.h:354
@ JSON_PRETTY_FUNC
Definition: item_func.h:355
@ JSON_EXTRACT_FUNC
Definition: item_func.h:349
@ MEMBER_OF_FUNC
Definition: item_func.h:336
@ TYPECAST_FUNC
Definition: item_func.h:263
@ JSON_OVERLAPS
Definition: item_func.h:334
@ JSON_DUALITY_OBJECT_FUNC
Definition: item_func.h:351
@ JSON_LENGTH_FUNC
Definition: item_func.h:347
virtual bool eq_specific(const Item *) const
Provide a more specific equality check for a function.
Definition: item_func.h:542
optimize_type
Definition: item_func.h:366
@ OPTIMIZE_KEY
Definition: item_func.h:368
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_func.h:724
virtual const char * func_name() const =0
enum Type type() const override
Definition: item_func.h:373
virtual Item * key_item() const
Definition: item_func.h:545
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:530
void print(const THD *thd, String *str, enum_query_type query_type) const override
This method is used for to:
Definition: item_func.cc:750
bool fix_fields(THD *, Item **ref) override
Definition: item_func.cc:408
uint arg_count
How many arguments in 'args'.
Definition: item_func.h:131
Field * tmp_table_field(TABLE *t_arg) override
Definition: item_func.cc:814
bool null_on_null
Affects how to determine that NULL argument implies a NULL function return.
Definition: item_func.h:187
Definition: item_func.h:1044
Base class for all item functions that a return JSON value.
Definition: item_json_func.h:161
void mark_for_partial_update(const Field_json *field)
Mark this expression as used in partial update.
Definition: item_json_func.cc:2108
Item_json_func(THD *thd, Args &&...parent_args)
Construct an Item_json_func instance.
Definition: item_json_func.h:189
String m_conversion_buffer
String used for converting JSON text values to utf8mb4 charset.
Definition: item_json_func.h:169
longlong val_int() override
Definition: item_json_func.cc:1147
Item_result cast_to_int_type() const override
Definition: item_json_func.h:211
String m_value
String used when reading JSON binary values or JSON text values.
Definition: item_json_func.h:167
virtual bool can_use_in_partial_update() const
Can this function type be used in partial update?
Definition: item_json_func.h:163
bool val_date(Date_val *date, my_time_flags_t flags) override
Evaluate the item and return result as a date value.
Definition: item_json_func.cc:1120
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_json_func.h:195
String * val_str(String *arg) override
Definition: item_json_func.cc:1095
my_decimal * val_decimal(my_decimal *decimal_value) override
Definition: item_json_func.cc:1169
bool val_time(Time_val *time) override
Evaluate the item and return result as a time value.
Definition: item_json_func.cc:1136
enum Item_result result_type() const override
Definition: item_json_func.h:200
String m_string_buffer
String used for converting a JSON value to text in val_str().
Definition: item_json_func.h:171
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:2125
Json_path_cache m_path_cache
Definition: item_json_func.h:174
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:180
bool val_datetime(Datetime_val *dt, my_time_flags_t flags) override
Evaluate the item and return result as a datetime value.
Definition: item_json_func.cc:1124
double val_real() override
Definition: item_json_func.cc:1156
void cleanup() override
JSON_*() support methods.
Definition: item_json_func.cc:623
Definition: item_strfunc.h:78
Represents a "CAST( <value> AS JSON )" coercion.
Definition: item_json_func.h:497
bool val_json(Json_wrapper *wr) override
Get a JSON value from an Item.
Definition: item_json_func.cc:1498
const char * cast_type() const
Definition: item_json_func.h:513
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:1545
Item_json_func super
Definition: item_json_func.h:498
const char * func_name() const override
Definition: item_json_func.h:512
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:504
Item_typecast_json(THD *thd, const POS &pos, Item *a)
Definition: item_json_func.h:501
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:928
uint32 max_char_length() const
Definition: item.h:3429
void set_nullable(bool nullable)
Definition: item.h:3748
virtual bool propagate_type(THD *thd, const Type_properties &type)
Propagate data type specifications into parameters and user variables.
Definition: item.h:1312
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:7098
virtual bool val_json(Json_wrapper *result)
Get a JSON value from an Item.
Definition: item.h:2082
enum_const_item_cache
How to cache constant JSON data.
Definition: item.h:996
@ CACHE_NONE
Don't cache.
Definition: item.h:998
@ CACHE_JSON_VALUE
Source data is a JSON string, parse and cache result.
Definition: item.h:1000
@ CACHE_JSON_ATOM
Source data is SQL scalar, convert and cache result.
Definition: item.h:1002
void set_data_type_json()
Set the data type of the Item to be JSON.
Definition: item.h:1762
void set_data_type_string(uint32 max_l)
Set the Item to be variable length string.
Definition: item.h:1598
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:1353
Represents a JSON array container, i.e.
Definition: json_dom.h:519
Vector of logical diffs describing changes to a JSON column.
Definition: json_diff.h:141
JSON DOM abstract base class.
Definition: json_dom.h:178
Represents a JSON container value of type "object" (ECMA), type J_OBJECT here.
Definition: json_dom.h:373
Path cache for JSON functions.
Definition: item_json_func.h:94
Json_path_cache(THD *thd, uint size)
Json_path_cache.
Definition: item_json_func.cc:559
const Json_path * get_path(uint arg_idx) const
Return an already parsed path expression.
Definition: item_json_func.cc:604
void reset_cache()
Reset the cache for re-use when a statement is re-executed.
Definition: item_json_func.cc:614
enum_path_status
Enum that tells the status of a cell in m_paths.
Definition: item_json_func.h:103
Prealloced_array< Json_path, 8 > m_paths
List of paths.
Definition: item_json_func.h:100
Mem_root_array< Path_cell > m_arg_idx_to_vector_idx
Map argument indexes to indexes into m_paths.
Definition: item_json_func.h:116
String m_path_value
Holder for path strings.
Definition: item_json_func.h:97
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:566
A lightweight path expression.
Definition: json_path.h:444
A JSON path expression.
Definition: json_path.h:350
A class that is capable of holding objects of any sub-type of Json_scalar.
Definition: json_dom.h:1984
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:1225
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:432
Wrapper class for an Item list head, used to allocate Item lists in the parser in a context-independe...
Definition: parse_tree_helpers.h:109
Definition: parse_tree_nodes.h:5853
virtual void add_json_info(Json_object *json_obj)
Add all the node-specific json fields.
Definition: parse_tree_node_base.h:304
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:169
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Time_val is a temporal type that represents only time.
Definition: my_temporal.h:55
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:97
enum_query_type
Query type constants (usable as bitmap flags).
Definition: enum_query_type.h:31
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:988
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:163
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:2356
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:87
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:4074
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:1427
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:1008
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:322
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:138
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:1224
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:1484
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:79
@ ooa_null
Definition: item_json_func.h:82
@ ooa_one
Definition: item_json_func.h:80
@ ooa_all
Definition: item_json_func.h:81
@ ooa_uninitialized
Definition: item_json_func.h:84
@ ooa_error
Definition: item_json_func.h:83
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:67
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:7813
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:480
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:85
Common definition between mysql server & client.
#define MAX_BLOB_WIDTH
Default width for blob in bytes.
Definition: mysql_com.h:907
static char * path
Definition: mysqldump.cc:150
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1078
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
Duality_view_tags
Definition: content_tree.h:33
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
bool has_value(const std::optional< ValueType > &v)
Definition: gtid.h:93
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
std::list< T, ut::allocator< T > > list
Specialization of list which uses ut_allocator.
Definition: ut0new.h:2884
PSI_memory_key key_memory_JSON
Definition: psi_memory_key.cc:53
type_conversion_status
Status when storing a value in a field or converting from one datatype to another.
Definition: field.h:197
Our own string classes, used pervasively throughout the executor.
Definition: m_ctype.h:421
Definition: parser_yystype.h:189
Definition: item_json_func.cc:4201
Struct that points to a cell in m_paths and tells its status.
Definition: item_json_func.h:110
size_t m_index
Definition: item_json_func.h:112
enum_path_status m_status
Definition: item_json_func.h:111
Bison "location" class.
Definition: parse_location.h:43
Json_on_response_type
Types of ON EMPTY/ON ERROR clauses for JSON_TABLE and JSON_VALUE.
Definition: table_function.h:205
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