summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <bar@myoffice.izhnet.ru>2006-07-07 17:06:30 +0500
committerunknown <bar@myoffice.izhnet.ru>2006-07-07 17:06:30 +0500
commit613cbb621e0e09094b71dafe5ff613dcb1df4bbf (patch)
treee06aaf4879d334f421488c1d815ad9b32b7cbc18 /sql/item_strfunc.cc
parent0b399f1d3f7b25cf16c868650edb99d9eb0a1ac7 (diff)
downloadmariadb-git-613cbb621e0e09094b71dafe5ff613dcb1df4bbf.tar.gz
func_str.result, func_str.test:
Adding test case. item_strfunc.cc: bug#11728 string function LEFT, strange undocumented behaviour Fixing LEFT and RIGHT return NULL if the second argument is NULL. sql/item_strfunc.cc: bug#11728 string function LEFT, strange undocumented behaviour Fixing LEFT and RIGHT return NULL if the second argument is NULL. mysql-test/t/func_str.test: Adding test case. mysql-test/r/func_str.result: Adding test case.
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 9e3a9b64288..5aef789074f 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1038,7 +1038,7 @@ String *Item_func_left::val_str(String *str)
long length =(long) args[1]->val_int();
uint char_pos;
- if ((null_value=args[0]->null_value))
+ if ((null_value=(args[0]->null_value || args[1]->null_value)))
return 0;
if (length <= 0)
return &my_empty_string;
@@ -1078,7 +1078,7 @@ String *Item_func_right::val_str(String *str)
String *res =args[0]->val_str(str);
long length =(long) args[1]->val_int();
- if ((null_value=args[0]->null_value))
+ if ((null_value=(args[0]->null_value || args[1]->null_value)))
return 0; /* purecov: inspected */
if (length <= 0)
return &my_empty_string; /* purecov: inspected */