Loading mysql-test/r/func_str.result +6 −0 Original line number Diff line number Diff line Loading @@ -733,3 +733,9 @@ WHERE a = CONV('e251273eb74a8ee3', 16, 10); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 DROP TABLE t1; SELECT CHAR(NULL,121,83,81,'76') as my_column; my_column ySQL SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column; my_column 4 mysql-test/t/func_str.test +6 −0 Original line number Diff line number Diff line Loading @@ -476,3 +476,9 @@ EXPLAIN WHERE a = CONV('e251273eb74a8ee3', 16, 10); DROP TABLE t1; # # Bug #6317: string function CHAR, parameter is NULL, wrong result # SELECT CHAR(NULL,121,83,81,'76') as my_column; SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column; sql/item_strfunc.cc +2 −0 Original line number Diff line number Diff line Loading @@ -1868,6 +1868,7 @@ String *Item_func_char::val_str(String *str) { int32 num=(int32) args[i]->val_int(); if (!args[i]->null_value) { #ifdef USE_MB if (use_mb(collation.collation)) { Loading @@ -1884,6 +1885,7 @@ b1: str->append((char)(num>>8)); #endif str->append((char)num); } } str->set_charset(collation.collation); str->realloc(str->length()); // Add end 0 (for Purify) return str; Loading Loading
mysql-test/r/func_str.result +6 −0 Original line number Diff line number Diff line Loading @@ -733,3 +733,9 @@ WHERE a = CONV('e251273eb74a8ee3', 16, 10); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 DROP TABLE t1; SELECT CHAR(NULL,121,83,81,'76') as my_column; my_column ySQL SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column; my_column 4
mysql-test/t/func_str.test +6 −0 Original line number Diff line number Diff line Loading @@ -476,3 +476,9 @@ EXPLAIN WHERE a = CONV('e251273eb74a8ee3', 16, 10); DROP TABLE t1; # # Bug #6317: string function CHAR, parameter is NULL, wrong result # SELECT CHAR(NULL,121,83,81,'76') as my_column; SELECT CHAR_LENGTH(CHAR(NULL,121,83,81,'76')) as my_column;
sql/item_strfunc.cc +2 −0 Original line number Diff line number Diff line Loading @@ -1868,6 +1868,7 @@ String *Item_func_char::val_str(String *str) { int32 num=(int32) args[i]->val_int(); if (!args[i]->null_value) { #ifdef USE_MB if (use_mb(collation.collation)) { Loading @@ -1884,6 +1885,7 @@ b1: str->append((char)(num>>8)); #endif str->append((char)num); } } str->set_charset(collation.collation); str->realloc(str->length()); // Add end 0 (for Purify) return str; Loading