summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2013-03-14 19:07:20 +0200
committerunknown <sanja@askmonty.org>2013-03-14 19:07:20 +0200
commitecd4bf62d439b300facb4d5758c4670e6c96b7c5 (patch)
tree38a90b75bb728965cc7a60a0f631a7fd7449ef53 /sql/item_strfunc.h
parentde5d2550af51593513e3770f109380dcf85979ef (diff)
downloadmariadb-git-ecd4bf62d439b300facb4d5758c4670e6c96b7c5.tar.gz
MDEV-4272 fix.
Incorrect NULL value handling in Item_func_conv_charset fixed.
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index 786f66e3aab..3f2de5fd6f1 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -859,25 +859,37 @@ public:
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::val_int();
- return args[0]->val_int();
+ longlong res= args[0]->val_int();
+ if ((null_value= args[0]->null_value))
+ return 0;
+ return res;
}
double val_real()
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::val_real();
- return args[0]->val_real();
+ double res= args[0]->val_real();
+ if ((null_value= args[0]->null_value))
+ return 0;
+ return res;
}
my_decimal *val_decimal(my_decimal *d)
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::val_decimal(d);
- return args[0]->val_decimal(d);
+ my_decimal *res= args[0]->val_decimal(d);
+ if ((null_value= args[0]->null_value))
+ return NULL;
+ return res;
}
bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate)
{
if (args[0]->result_type() == STRING_RESULT)
return Item_str_func::get_date(ltime, fuzzydate);
- return args[0]->get_date(ltime, fuzzydate);
+ bool res= args[0]->get_date(ltime, fuzzydate);
+ if ((null_value= args[0]->null_value))
+ return 1;
+ return res;
}
void fix_length_and_dec();
const char *func_name() const { return "convert"; }