summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2007-07-20 00:06:35 +0400
committerunknown <evgen@moonbone.local>2007-07-20 00:06:35 +0400
commita131428f041cd015662240bde255d159bcc53af7 (patch)
treec289f957a8353fed4b3b04d0291bdd114445733c /sql/item_timefunc.cc
parentd0020607b324cb9e5c3f930315a4fb0c4a65239b (diff)
downloadmariadb-git-a131428f041cd015662240bde255d159bcc53af7.tar.gz
Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag.
The Item_date_typecast::val_int function doesn't reset null_value flag. This makes all values that follows the first null value to be treated as nulls and led to a wrong result. Now the Item_date_typecast::val_int function correctly sets the null_value flag for both null and non-null values. mysql-test/t/cast.test: Added a test case for the bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag. mysql-test/r/cast.result: Added a test case for the bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag. sql/item_timefunc.cc: Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag. Now the Item_date_typecast::val_int function correctly sets the null_value flag for both null and non-null values.
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc5
1 files changed, 1 insertions, 4 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 9795ec5f413..873e2833a1e 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2662,11 +2662,8 @@ longlong Item_date_typecast::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- if (args[0]->get_date(&ltime, TIME_FUZZY_DATE))
- {
- null_value= 1;
+ if ((null_value= args[0]->get_date(&ltime, TIME_FUZZY_DATE)))
return 0;
- }
return (longlong) (ltime.year * 10000L + ltime.month * 100 + ltime.day);
}