summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-09-02 08:20:49 +0400
committerAlexander Barkov <bar@mariadb.org>2015-09-02 08:20:49 +0400
commitaa1002a35cefcc1851cbfb6b6b60463bda6f9aa3 (patch)
treef2de8922bd073aef3d8c4f6e72328837db680a60 /sql/item_strfunc.h
parent68810129a0c185f22eaa35f2d917f052ea78748b (diff)
downloadmariadb-git-aa1002a35cefcc1851cbfb6b6b60463bda6f9aa3.tar.gz
MDEV-8723 Wrong result for SELECT..WHERE COLLATION(a)='binary' AND a='a'
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h36
1 files changed, 23 insertions, 13 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index cba91bb9f00..e7d509206f2 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -1049,12 +1049,11 @@ public:
}
};
-class Item_func_charset :public Item_str_func
+
+class Item_func_expr_str_metadata :public Item_str_func
{
public:
- Item_func_charset(THD *thd, Item *a): Item_str_func(thd, a) {}
- String *val_str(String *);
- const char *func_name() const { return "charset"; }
+ Item_func_expr_str_metadata(THD *thd, Item *a): Item_str_func(thd, a) { }
void fix_length_and_dec()
{
collation.set(system_charset_info);
@@ -1062,23 +1061,32 @@ public:
maybe_null= 0;
};
table_map not_null_tables() const { return 0; }
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ { return this; }
+ bool const_item() const { return true; }
};
-class Item_func_collation :public Item_str_func
+
+class Item_func_charset :public Item_func_expr_str_metadata
{
public:
- Item_func_collation(THD *thd, Item *a): Item_str_func(thd, a) {}
+ Item_func_charset(THD *thd, Item *a)
+ :Item_func_expr_str_metadata(thd, a) { }
+ String *val_str(String *);
+ const char *func_name() const { return "charset"; }
+};
+
+
+class Item_func_collation :public Item_func_expr_str_metadata
+{
+public:
+ Item_func_collation(THD *thd, Item *a)
+ :Item_func_expr_str_metadata(thd, a) {}
String *val_str(String *);
const char *func_name() const { return "collation"; }
- void fix_length_and_dec()
- {
- collation.set(system_charset_info);
- max_length= 64 * collation.collation->mbmaxlen; // should be enough
- maybe_null= 0;
- };
- table_map not_null_tables() const { return 0; }
};
+
class Item_func_weight_string :public Item_str_func
{
String tmp_value;
@@ -1106,6 +1114,8 @@ public:
this->nweights == that->nweights &&
this->result_length == that->result_length;
}
+ Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond)
+ { return this; }
};
class Item_func_crc32 :public Item_int_func