diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2017-02-14 17:51:03 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2017-02-14 17:51:03 +0400 |
commit | f76d5fefb818760f41488c1793fca27d97c9c2a0 (patch) | |
tree | 29cea084ed332b568fe98c4a2140a131d652158c /sql/item_create.cc | |
parent | 2bf07556e8ba35ea166b1f603706851faa01d9c5 (diff) | |
download | mariadb-git-f76d5fefb818760f41488c1793fca27d97c9c2a0.tar.gz |
MDEV-11439 No data type JSON, but CAST(something AS JSON) pretends to
work.
json_detailed() fixed
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r-- | sql/item_create.cc | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc index d2be36e105f..dee1db1ee2e 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -1788,10 +1788,10 @@ protected: }; -class Create_func_json_detailed : public Create_func_arg2 +class Create_func_json_detailed: public Create_native_func { public: - virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2); + virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list); static Create_func_json_detailed s_singleton; @@ -1801,7 +1801,6 @@ protected: }; - class Create_func_json_type : public Create_func_arg1 { public: @@ -5046,9 +5045,25 @@ Create_func_json_exists::create_2_arg(THD *thd, Item *arg1, Item *arg2) Create_func_json_detailed Create_func_json_detailed::s_singleton; Item* -Create_func_json_detailed::create_2_arg(THD *thd, Item *arg1, Item *arg2) +Create_func_json_detailed::create_native(THD *thd, LEX_STRING name, + List<Item> *item_list) { - return new (thd->mem_root) Item_func_json_format(thd, arg1, arg2); + Item *func= NULL; + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 1 || arg_count > 2 /* json_doc, [path]...*/) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + } + else + { + func= new (thd->mem_root) Item_func_json_format(thd, *item_list); + } + + return func; } |