Commit e259d461 authored by unknown's avatar unknown

Merge polly.(none):/home/kaa/src/opt/bug28550/my50-bug28550

into  polly.(none):/home/kaa/src/opt/bug28550/my51-bug28550


mysql-test/t/func_str.test:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_strfunc.h:
  Auto merged
mysql-test/r/func_str.result:
  Manual merge.
parents 666efa1c 04311fab
......@@ -726,7 +726,7 @@ t1 CREATE TABLE `t1` (
`oct(130)` varchar(64) NOT NULL DEFAULT '',
`conv(130,16,10)` varchar(64) NOT NULL DEFAULT '',
`hex(130)` varchar(6) NOT NULL DEFAULT '',
`char(130)` varbinary(1) NOT NULL DEFAULT '',
`char(130)` varbinary(4) NOT NULL DEFAULT '',
`format(130,10)` varchar(4) NOT NULL DEFAULT '',
`left(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
`right(_latin2'a',1)` varchar(1) CHARACTER SET latin2 NOT NULL DEFAULT '',
......@@ -2486,4 +2486,14 @@ SUBSTR(a,1,len)
ba
DROP TABLE t1;
CREATE TABLE t1 AS SELECT CHAR(0x414243) as c1;
SELECT HEX(c1) from t1;
HEX(c1)
414243
DROP TABLE t1;
CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1;
SELECT HEX(c1) from v1;
HEX(c1)
414243
DROP VIEW v1;
End of 5.0 tests
......@@ -1231,4 +1231,16 @@ SELECT SUBSTR(a,1,len) FROM t1;
DROP TABLE t1;
#
# Bug #28850: Potential bugs related to the return type of the CHAR function
#
CREATE TABLE t1 AS SELECT CHAR(0x414243) as c1;
SELECT HEX(c1) from t1;
DROP TABLE t1;
CREATE VIEW v1 AS SELECT CHAR(0x414243) as c1;
SELECT HEX(c1) from v1;
DROP VIEW v1;
--echo End of 5.0 tests
......@@ -4903,6 +4903,19 @@ int Item_hex_string::save_in_field(Field *field, bool no_conversions)
}
void Item_hex_string::print(String *str)
{
char *end= (char*) str_value.ptr() + str_value.length(),
*ptr= end - min(str_value.length(), sizeof(longlong));
str->append("0x");
for (; ptr != end ; ptr++)
{
str->append(_dig_vec_lower[((uchar) *ptr) >> 4]);
str->append(_dig_vec_lower[((uchar) *ptr) & 0x0F]);
}
}
bool Item_hex_string::eq(const Item *arg, bool binary_cmp) const
{
if (arg->basic_const_item() && arg->type() == type())
......
......@@ -2024,6 +2024,7 @@ class Item_hex_string: public Item
enum_field_types field_type() const { return MYSQL_TYPE_VARCHAR; }
// to prevent drop fixed flag (no need parent cleanup call)
void cleanup() {}
void print(String *str);
bool eq(const Item *item, bool binary_cmp) const;
virtual Item *safe_charset_converter(CHARSET_INFO *tocs);
bool check_partition_func_processor(uchar *int_arg) {return FALSE;}
......
......@@ -508,7 +508,7 @@ class Item_func_char :public Item_str_func
String *val_str(String *);
void fix_length_and_dec()
{
max_length= arg_count * collation.collation->mbmaxlen;
max_length= arg_count * 4;
}
const char *func_name() const { return "char"; }
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment