summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2005-03-04 14:20:49 +0400
committerunknown <bar@mysql.com>2005-03-04 14:20:49 +0400
commitc56d0283ddde723bb8c8052b963d1f54b26bed3b (patch)
tree2441bab602265c2b1dba098f2faeade8b9cc33df /sql/item_strfunc.cc
parente54b545a966a92677242d6e6f904a10eb73cb707 (diff)
downloadmariadb-git-c56d0283ddde723bb8c8052b963d1f54b26bed3b.tar.gz
type_blob.result, func_system.result, func_str.result, ctype_collate.result:
fixing test results accordingly. func_system.test: New test that illegal mix of collations does not happen anymore. item_strfunc.h: safe_charset_converter() was added for system constants. item_strfunc.cc: safe_charset_converter() was added for system constants. item_func.cc, item.h, item.cc: Bug#8291: Illegal collation mix with USER() function. After discussion with PeterG and Serge, a new coercibility level for "system constants" was introduced, between COERRIBLE and IMPLICIT. Thus: SELECT col1 = USER() FROM t1; - is done according to col1 collation. SELECT 'string' = USER(); - is done according to USER() collation. At the same time, "nagg" and "strong" members were removed as unused. item_create.cc: Version is a system constant too. sql/item.cc: Bug#8291: Illegal collation mix with USER() function. After discussion with PeterG and Serge, a new coercibility level for "system constants" was introduced, between COERRIBLE and IMPLICIT. Thus: SELECT col1 = USER() FROM t1; - is done according to col1 collation. SELECT 'string' = USER(); - is done according to USER() collation. At the same time, "nagg" and "strong" members were removed as unused. sql/item.h: Bug#8291: Illegal collation mix with USER() function. After discussion with PeterG and Serge, a new coercibility level for "system constants" was introduced, between COERRIBLE and IMPLICIT. Thus: SELECT col1 = USER() FROM t1; - is done according to col1 collation. SELECT 'string' = USER(); - is done according to USER() collation. At the same time, "nagg" and "strong" members were removed as unused. sql/item_create.cc: Version is a system constant too. sql/item_func.cc: Bug#8291: Illegal collation mix with USER() function. After discussion with PeterG and Serge, a new coercibility level for "system constants" was introduced, between COERRIBLE and IMPLICIT. Thus: SELECT col1 = USER() FROM t1; - is done according to col1 collation. SELECT 'string' = USER(); - is done according to USER() collation. At the same time, "nagg" and "strong" members were removed as unused. sql/item_strfunc.cc: safe_charset_converter() was added for system constants. sql/item_strfunc.h: safe_charset_converter() was added for system constants. mysql-test/t/func_system.test: New test that illegal mix of collations does not happen anymore. mysql-test/r/ctype_collate.result: fixing test results accordingly. mysql-test/r/func_str.result: fixing test results accordingly. mysql-test/r/func_system.result: fixing test results accordingly. mysql-test/r/type_blob.result: fixing test results accordingly.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 0023d7b1f20..2f8d6dd822d 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1509,6 +1509,23 @@ String *Item_func_decode::val_str(String *str)
}
+Item *Item_func_sysconst::safe_charset_converter(CHARSET_INFO *tocs)
+{
+ Item_string *conv;
+ uint conv_errors;
+ String tmp, cstr, *ostr= val_str(&tmp);
+ cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors);
+ if (conv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(),
+ cstr.charset(),
+ collation.derivation)))
+ {
+ return NULL;
+ }
+ conv->str_value.copy();
+ return conv;
+}
+
+
String *Item_func_database::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);