Fixed that:

SELECT * FROM t WHERE (c COLLATE latin1) >'a'
might fail in some cases
This commit is contained in:
bar@bar.mysql.r18.ru 2002-09-13 14:11:06 +05:00
parent d5d10b0db5
commit ad91c3b77d
2 changed files with 6 additions and 7 deletions

View File

@ -1943,7 +1943,8 @@ void Item_func_conv_charset3::fix_length_and_dec()
String *Item_func_set_collation::val_str(String *str)
{
str=args[0]->val_str(str);
null_value=args[0]->null_value;
if ((null_value=args[0]->null_value))
return 0;
str->set_charset(set_collation);
return str;
}
@ -1961,8 +1962,10 @@ bool Item_func_set_collation::fix_fields(THD *thd,struct st_table_list *tables,
return 1;
maybe_null=args[0]->maybe_null;
binary=args[0]->binary;
const_item_cache=args[0]->const_item();
str_value.set_charset(set_collation);
with_sum_func= with_sum_func || args[0]->with_sum_func;
used_tables_cache=args[0]->used_tables();
const_item_cache=args[0]->const_item();
fix_length_and_dec();
return 0;
}
@ -1987,7 +1990,6 @@ bool Item_func_set_collation::eq(const Item *item, bool binary_cmp) const
return 1;
}
String *Item_func_charset::val_str(String *str)
{
String *res = args[0]->val_str(str);

View File

@ -504,10 +504,7 @@ public:
bool fix_fields(THD *thd,struct st_table_list *tables, Item **ref);
String *val_str(String *);
void fix_length_and_dec()
{
max_length = args[0]->max_length;
str_value.set_charset(set_collation);
}
{ max_length = args[0]->max_length; }
bool eq(const Item *item, bool binary_cmp) const;
const char *func_name() const { return "set_collation"; }
};