diff options
author | Eric Herman <eric@freesa.org> | 2021-07-02 08:20:37 +0200 |
---|---|---|
committer | Eric Herman <eric@freesa.org> | 2021-07-19 18:44:37 +0200 |
commit | 6681ee68d1c7321f8b770ed738e09486c74bf930 (patch) | |
tree | c6c14aeb6642755e9e9527368853a95d68f6c388 /sql/item_jsonfunc.h | |
parent | 8c55a903a274145a2400989966bfd86f3ac10e4b (diff) | |
download | mariadb-git-bb-10.7-mdev23143.tar.gz |
MDEV-23143 Add JSON_EQUALS functionbb-10.7-mdev23143
This patch implements JSON_EQUALS SQL function. The function takes
advantage of the json_normalize functionality and does the following:
norm_a = json_normalize(a)
norm_b = json_normalize(b)
return strcmp(norm_a, norm_b)
Co-authored-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
Diffstat (limited to 'sql/item_jsonfunc.h')
-rw-r--r-- | sql/item_jsonfunc.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/item_jsonfunc.h b/sql/item_jsonfunc.h index 04d06a0ebf7..518a98d95df 100644 --- a/sql/item_jsonfunc.h +++ b/sql/item_jsonfunc.h @@ -107,6 +107,23 @@ public: }; +class Item_func_json_equals: public Item_bool_func +{ +public: + Item_func_json_equals(THD *thd, Item *a, Item *b): + Item_bool_func(thd, a, b) {} + LEX_CSTRING func_name_cstring() const override + { + static LEX_CSTRING name= {STRING_WITH_LEN("json_equals") }; + return name; + } + bool fix_length_and_dec() override; + Item *get_copy(THD *thd) override + { return get_item_copy<Item_func_json_equals>(thd, this); } + longlong val_int() override; +}; + + class Item_func_json_exists: public Item_bool_func { protected: |