diff options
author | Alexander Barkov <bar@mysql.com> | 2009-10-05 20:06:04 +0500 |
---|---|---|
committer | Alexander Barkov <bar@mysql.com> | 2009-10-05 20:06:04 +0500 |
commit | 636ea6a1c464b247a3665bebac7bf28495ac087a (patch) | |
tree | 7ea09d9be115743b02431c299c6f2a442eeb8009 /sql/item_create.cc | |
parent | 80f6940f07978bff7de4433a9bc3626b974698f0 (diff) | |
download | mariadb-git-636ea6a1c464b247a3665bebac7bf28495ac087a.tar.gz |
WL#4584 Internationalized number format
@ mysql-test/r/func_str.result
Adding tests
@ mysql-test/t/func_str.test
Adding tests
@ mysql-test/t/variables.test
Fixing error number
@ sql/item_create.cc
Allowing 2 and 3 arguments to format()
@ sql/item_strfunc.cc
Adding new formatting code.
@ sql/item_strfunc.h
Adding new contructors and "locale" member
@ sql/mysql_priv.h
Adding number formatting members into MY_LOCALE
@ sql/sql_locale.cc
Adding number formatting data into locale constants
@ sql/set_var.cc
Using new error message
@ sql/share/errmgs.txt
Adding new error message
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r-- | sql/item_create.cc | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc index 7991d9adf82..2f80d16b928 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -927,10 +927,10 @@ protected: }; -class Create_func_format : public Create_func_arg2 +class Create_func_format : public Create_native_func { public: - virtual Item *create(THD *thd, Item *arg1, Item *arg2); + virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list); static Create_func_format s_singleton; @@ -3352,9 +3352,34 @@ Create_func_floor::create(THD *thd, Item *arg1) Create_func_format Create_func_format::s_singleton; Item* -Create_func_format::create(THD *thd, Item *arg1, Item *arg2) +Create_func_format::create_native(THD *thd, LEX_STRING name, + List<Item> *item_list) { - return new (thd->mem_root) Item_func_format(arg1, arg2); + Item *func= NULL; + int arg_count= item_list ? item_list->elements : 0; + + switch (arg_count) { + case 2: + { + Item *param_1= item_list->pop(); + Item *param_2= item_list->pop(); + func= new (thd->mem_root) Item_func_format(param_1, param_2); + break; + } + case 3: + { + Item *param_1= item_list->pop(); + Item *param_2= item_list->pop(); + Item *param_3= item_list->pop(); + func= new (thd->mem_root) Item_func_format(param_1, param_2, param_3); + break; + } + default: + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); + break; + } + + return func; } |