diff options
author | unknown <bar@bar.mysql.r18.ru> | 2003-02-28 20:56:18 +0400 |
---|---|---|
committer | unknown <bar@bar.mysql.r18.ru> | 2003-02-28 20:56:18 +0400 |
commit | da29142e847d79c2887953b1945dec217e364200 (patch) | |
tree | 92de41ce2a07ccf0ed3865bfb06977982ad2ff12 /sql | |
parent | 26231c236378dfeb09a39fe18feaa1d248a06c8c (diff) | |
download | mariadb-git-da29142e847d79c2887953b1945dec217e364200.tar.gz |
item_func.cc:
Fix for coercibility of function
sql/item_func.cc:
Fix for coercibility of function
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_func.cc | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index f228b04e0d0..1382766c205 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -122,10 +122,29 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) Set return character set to first argument if we are returning a string. */ - if (args == arg) - set_charset(args[0]->charset()); - else if ((*arg)->binary() || (charset() != (*arg)->charset()) ) - set_charset(&my_charset_bin); + if ((*arg)->binary()) + { + set_charset(&my_charset_bin); + coercibility= COER_NOCOLL; + } + else if (coercibility== COER_NOCOLL) + { + coercibility= (*arg)->coercibility; + set_charset((*arg)->charset()); + } + else if ((*arg)->coercibility > coercibility) + { + if (strcmp(charset()->csname,(*arg)->charset()->csname)) + { + set_charset(&my_charset_bin); + coercibility= COER_NOCOLL; + } + else + { + coercibility= (*arg)->coercibility; + set_charset((*arg)->charset()); + } + } } with_sum_func= with_sum_func || (*arg)->with_sum_func; used_tables_cache|=(*arg)->used_tables(); |