diff options
author | unknown <holyfoot/hf@hfmain.(none)> | 2007-05-11 18:14:04 +0500 |
---|---|---|
committer | unknown <holyfoot/hf@hfmain.(none)> | 2007-05-11 18:14:04 +0500 |
commit | f6a06aeba2c911a3179b38c3d877e7ebcd450041 (patch) | |
tree | 215d55af74b0566e627e0bca31749f8ed6ede660 /sql/item_create.cc | |
parent | bbd476300cece4cf67081a5c67038931c8cfa50e (diff) | |
parent | 7c0244ff0ce23a9eadb0ed12d25fd2d31a44843d (diff) | |
download | mariadb-git-f6a06aeba2c911a3179b38c3d877e7ebcd450041.tar.gz |
Merge mysql.com:/home/hf/work/27921/my51-27921
into mysql.com:/home/hf/work/27957/my51-27957
mysql-test/r/cast.result:
Auto merged
sql/item_create.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/my_decimal.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r-- | sql/item_create.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc index d11a2f84a0a..6534757113a 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -3916,6 +3916,7 @@ Create_func_master_pos_wait Create_func_master_pos_wait::s_singleton; Item* Create_func_master_pos_wait::create_native(THD *thd, LEX_STRING name, List<Item> *item_list) + { Item *func= NULL; int arg_count= 0; @@ -3946,7 +3947,6 @@ Create_func_master_pos_wait::create_native(THD *thd, LEX_STRING name, my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name.str); break; } - } return func; } @@ -4970,11 +4970,15 @@ find_qualified_function_builder(THD *thd) return & Create_sp_func::s_singleton; } -Item* -create_func_cast(THD *thd, Item *a, Cast_target cast_type, int len, int dec, + +Item * +create_func_cast(Item *a, Cast_target cast_type, + const char *c_len, const char *c_dec, CHARSET_INFO *cs) { Item *res; + ulong len; + uint dec; LINT_INIT(res); switch (cast_type) { @@ -4998,18 +5002,21 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, int len, int dec, break; case ITEM_CAST_DECIMAL: { - int tmp_len= (len>0) ? len : 10; - if (tmp_len < dec) + len= c_len ? atoi(c_len) : 0; + dec= c_dec ? atoi(c_dec) : 0; + my_decimal_trim(&len, &dec); + if (len < dec) { my_error(ER_M_BIGGER_THAN_D, MYF(0), ""); return 0; } - res= new (thd->mem_root) Item_decimal_typecast(a, tmp_len, dec); + res= new (thd->mem_root) Item_decimal_typecast(a, len, dec); break; } case ITEM_CAST_CHAR: { CHARSET_INFO *real_cs= (cs ? cs : thd->variables.collation_connection); + len= c_len ? atoi(c_len) : -1; res= new (thd->mem_root) Item_char_typecast(a, len, real_cs); break; } @@ -5022,4 +5029,3 @@ create_func_cast(THD *thd, Item *a, Cast_target cast_type, int len, int dec, } return res; } - |