diff options
author | unknown <bar@bar.mysql.r18.ru> | 2003-02-26 12:29:17 +0400 |
---|---|---|
committer | unknown <bar@bar.mysql.r18.ru> | 2003-02-26 12:29:17 +0400 |
commit | 12749eaf8701a437bfb47925c1d06624b258644c (patch) | |
tree | 34f0b3c957fc57c2ec5b676a015141ea676a3c6d /sql | |
parent | 99effd31fa2f6be726d105c56c4599c6e2349c8e (diff) | |
download | mariadb-git-12749eaf8701a437bfb47925c1d06624b258644c.tar.gz |
item_func.cc:
Some reoganization
Fixed that binary arguments do not affect result charset
anymore
For example, the second argument doesn't affect charset of result in LEFT(string,10)
sql_string.h:
Strings are binary by default now
sql/sql_string.h:
Strings are binary by default now
sql/item_func.cc:
Some reoganization
Fixed that binary arguments do not affect result charset
anymore
For example, the second argument doesn't affect charset of result in LEFT(string,10)
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_func.cc | 27 | ||||
-rw-r--r-- | sql/sql_string.h | 4 |
2 files changed, 14 insertions, 17 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 3954b53c063..67ff3bb92af 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -105,11 +105,6 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) return 0; // Fatal error if flag is set! if (arg_count) { // Print purify happy - CHARSET_INFO *charset= 0; - /* - Set return character set to first argument if we are returning a - string. - */ for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++) { if ((*arg)->fix_fields(thd, tables, arg) || @@ -117,20 +112,22 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) return 1; /* purecov: inspected */ if ((*arg)->maybe_null) maybe_null=1; - if ((*arg)->binary()) - charset= &my_charset_bin; - else if (!charset && (*arg)->result_type() == STRING_RESULT) - charset= (*arg)->charset(); + + if ((*arg)->result_type() == STRING_RESULT) + { + /* + 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); + } with_sum_func= with_sum_func || (*arg)->with_sum_func; used_tables_cache|=(*arg)->used_tables(); const_item_cache&= (*arg)->const_item(); } - /* - We must set charset here as fix_length_and_dec() may want to change - charset - */ - if (charset && result_type() == STRING_RESULT) - set_charset(charset); } fix_length_and_dec(); fixed= 1; diff --git a/sql/sql_string.h b/sql/sql_string.h index 6d54373f642..047faf3e3db 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -39,12 +39,12 @@ public: String() { Ptr=0; str_length=Alloced_length=0; alloced=0; - str_charset=default_charset_info; + str_charset= &my_charset_bin; } String(uint32 length_arg) { alloced=0; Alloced_length=0; (void) real_alloc(length_arg); - str_charset=default_charset_info; + str_charset= &my_charset_bin; } String(const char *str, CHARSET_INFO *cs) { |