21 #include <drizzled/function/str/set_collation.h>
22 #include <drizzled/error.h>
23 #include <drizzled/charset.h>
27 static const char *binary_keyword=
"BINARY";
35 str->set_charset(collation.collation);
39 void Item_func_set_collation::fix_length_and_dec()
44 colname= str->c_ptr();
45 if (colname == binary_keyword)
46 set_collation= get_charset_by_csname(args[0]->collation.collation->csname, MY_CS_BINSORT);
49 if (!(set_collation= get_charset_by_name(colname)))
51 my_error(ER_UNKNOWN_COLLATION, MYF(0), colname);
57 !my_charset_same(args[0]->collation.collation,set_collation))
59 my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
60 colname, args[0]->collation.collation->csname);
63 collation.set(set_collation, DERIVATION_EXPLICIT);
64 max_length= args[0]->max_length;
72 if (item->type() != FUNC_ITEM)
75 if (arg_count != item_func->arg_count ||
76 functype() != item_func->functype())
79 if (collation.collation != item_func_sc->collation.collation)
81 for (uint32_t i=0; i < arg_count ; i++)
82 if (!args[i]->
eq(item_func_sc->args[i], binary_cmp))
91 str->append(STRING_WITH_LEN(
" collate "));
virtual bool basic_const_item() const
String * val_str(String *)
virtual void print(String *str)
virtual String * val_str(String *str)=0
virtual void print(String *str)
bool eq(const Item *item, bool binary_cmp) const