summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2002-08-26 17:33:44 +0500
committerunknown <bar@bar.mysql.r18.ru>2002-08-26 17:33:44 +0500
commit1895448e66b39542d58a77e705449b92414ff3f7 (patch)
tree6343e78cbc76f11dcefea65fd7972f02ce13ac0b /sql
parent7f13b1bdd59e798af7477f4eda46ce249c4b5c4e (diff)
downloadmariadb-git-1895448e66b39542d58a77e705449b92414ff3f7.tar.gz
Fix that this didn't work as far as sorting for ORDER BY was removed by optimizer:
SELECT k FROM t1 GROUP BY k COLLATE latin1 ORDER BY k COLLATE latin1_de
Diffstat (limited to 'sql')
-rw-r--r--sql/item_strfunc.cc20
-rw-r--r--sql/item_strfunc.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 594049b3870..dc9d57b1d9d 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1967,6 +1967,26 @@ bool Item_func_set_collation::fix_fields(THD *thd,struct st_table_list *tables,
return 0;
}
+bool Item_func_set_collation::eq(const Item *item, bool binary_cmp) const
+{
+ /* Assume we don't have rtti */
+ if (this == item)
+ return 1;
+ if (item->type() != FUNC_ITEM)
+ return 0;
+ Item_func *item_func=(Item_func*) item;
+ if (arg_count != item_func->arg_count ||
+ func_name() != item_func->func_name())
+ return 0;
+ Item_func_set_collation *item_func_sc=(Item_func_set_collation*) item;
+ if (set_collation != item_func_sc->set_collation)
+ return 0;
+ for (uint i=0; i < arg_count ; i++)
+ if (!args[i]->eq(item_func_sc->args[i], binary_cmp))
+ return 0;
+ return 1;
+}
+
String *Item_func_charset::val_str(String *str)
{
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index becb7981acd..997d9c8d834 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -508,6 +508,7 @@ public:
max_length = args[0]->max_length;
str_value.set_charset(set_collation);
}
+ bool eq(const Item *item, bool binary_cmp) const;
const char *func_name() const { return "set_collation"; }
};