summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.cc
diff options
context:
space:
mode:
authorunknown <kroki/tomash@moonlight.intranet>2006-11-16 14:06:51 +0300
committerunknown <kroki/tomash@moonlight.intranet>2006-11-16 14:06:51 +0300
commitaf22eb35e577ef17226faf662f2cffc4705bde26 (patch)
tree303e9770338b9265e9dbc2e90e84c5a0e668c15d /sql/item_strfunc.cc
parentec845335ac32a81d8d88245a1df4c74965b76f42 (diff)
downloadmariadb-git-af22eb35e577ef17226faf662f2cffc4705bde26.tar.gz
Add 5.0 part of fix for bug 17047.
mysql-test/r/func_str.result: Add result for bug#17047: CHAR() and IN() can return NULL without signaling NULL result. mysql-test/t/func_str.test: Add test case for bug#17047: CHAR() and IN() can return NULL without signaling NULL result. sql/item_strfunc.cc: Add Item_str_func::fix_fields() implementation, and set maybe_null to TRUE if we are in the SQL mode that requires some functions to return null even if they normally do not. sql/item_strfunc.h: Add declaration of Item_str_func::fix_fields(). Do not reset maybe_null in Item_func_char::fix_length_and_dec().
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r--sql/item_strfunc.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 31c2f44fc3e..b54f8fef90c 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -80,6 +80,20 @@ String *Item_str_func::check_well_formed_result(String *str)
}
+bool Item_str_func::fix_fields(THD *thd, Item **ref)
+{
+ bool res= Item_func::fix_fields(thd, ref);
+ /*
+ In Item_str_func::check_well_formed_result() we may set null_value
+ flag on the same condition as in test() below.
+ */
+ maybe_null= (maybe_null ||
+ test(thd->variables.sql_mode &
+ (MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)));
+ return res;
+}
+
+
my_decimal *Item_str_func::val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);