diff options
author | unknown <bar@mysql.com> | 2005-11-21 17:26:31 +0400 |
---|---|---|
committer | unknown <bar@mysql.com> | 2005-11-21 17:26:31 +0400 |
commit | 72d19611d198164e1fcd2e16b270a11824d860bf (patch) | |
tree | 05c91bc3d02c0f22aab0913b8e7228667bb5ff38 /sql/item.cc | |
parent | 83bbd30c480d97f57203b999cff4517f5e04bf13 (diff) | |
download | mariadb-git-72d19611d198164e1fcd2e16b270a11824d860bf.tar.gz |
Bug#10446 Illegal mix of collations:
item_strfunc.h, item_strfunc.cc, item.cc:
Try to convert a const item into destination
character set. If conversion happens without
data loss, then cache the converted value
and return it during val_str().
Otherwise, if conversion loses data, return
Illeral mix of collations error, as it happened
previously.
ctype_recoding.result, ctype_recoding.test:
Fixing tests accordingly.
sql/item.cc:
Bug#10446 Illegal mix of collations
Try to convert a const item into destination
character set. If conversion happens without
data loss, then cache the converted value
and return it during val_str().
Otherwise, if conversion loses data, return
Illeral mix of collations error, as it happened
previously.
sql/item_strfunc.cc:
Return cached value when it's possible.
mysql-test/t/ctype_recoding.test:
Fixing tests accordingly.
mysql-test/r/ctype_recoding.result:
Fixing tests accordingly.
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/sql/item.cc b/sql/item.cc index 642a0ccf1b4..5acde7c082d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -211,16 +211,8 @@ bool Item::eq(const Item *item, bool binary_cmp) const Item *Item::safe_charset_converter(CHARSET_INFO *tocs) { - /* - Allow conversion from and to "binary". - Don't allow automatic conversion to non-Unicode charsets, - as it potentially loses data. - */ - if (collation.collation != &my_charset_bin && - tocs != &my_charset_bin && - !(tocs->state & MY_CS_UNICODE)) - return NULL; // safe conversion is not possible - return new Item_func_conv_charset(this, tocs); + Item_func_conv_charset *conv= new Item_func_conv_charset(this, tocs, 1); + return conv->safe ? conv : NULL; } |