Commit 2d8c5755 authored by unknown's avatar unknown

Fixing crashing bugs as reported in bugs database

#195

parent 691d4b31
...@@ -40,3 +40,6 @@ cast("1:2:3" as TIME) = "1:02:03" ...@@ -40,3 +40,6 @@ cast("1:2:3" as TIME) = "1:02:03"
select cast(NULL as DATE); select cast(NULL as DATE);
cast(NULL as DATE) cast(NULL as DATE)
NULL NULL
select cast(NULL as BINARY);
cast(NULL as BINARY)
NULL
...@@ -21,3 +21,4 @@ select cast("2001-1-1" as date) = "2001-01-01"; ...@@ -21,3 +21,4 @@ select cast("2001-1-1" as date) = "2001-01-01";
select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00"; select cast("2001-1-1" as datetime) = "2001-01-01 00:00:00";
select cast("1:2:3" as TIME) = "1:02:03"; select cast("1:2:3" as TIME) = "1:02:03";
select cast(NULL as DATE); select cast(NULL as DATE);
select cast(NULL as BINARY);
...@@ -769,6 +769,7 @@ Item_func_if::val_str(String *str) ...@@ -769,6 +769,7 @@ Item_func_if::val_str(String *str)
{ {
Item *arg= args[0]->val_int() ? args[1] : args[2]; Item *arg= args[0]->val_int() ? args[1] : args[2];
String *res=arg->val_str(str); String *res=arg->val_str(str);
if (res)
res->set_charset(charset()); res->set_charset(charset());
null_value=arg->null_value; null_value=arg->null_value;
return res; return res;
......
...@@ -512,6 +512,7 @@ public: ...@@ -512,6 +512,7 @@ public:
{ {
String *tmp=args[0]->val_str(a); String *tmp=args[0]->val_str(a);
null_value=args[0]->null_value; null_value=args[0]->null_value;
if (tmp)
tmp->set_charset(&my_charset_bin); tmp->set_charset(&my_charset_bin);
return tmp; return tmp;
} }
......
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