summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/item.cc b/sql/item.cc
index 9ef1593b0bf..1d8e466b2fd 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1277,11 +1277,15 @@ bool Item::get_date(MYSQL_TIME *ltime,ulonglong fuzzydate)
DBUG_ASSERT(0);
}
- return 0;
+ return null_value= 0;
err:
+ /*
+ if the item was not null and convertion failed, we return a zero date
+ if allowed, otherwise - null.
+ */
bzero((char*) ltime,sizeof(*ltime));
- return 1;
+ return null_value|= (fuzzydate & (TIME_NO_ZERO_DATE|TIME_NO_ZERO_IN_DATE));
}
bool Item::get_seconds(ulonglong *sec, ulong *sec_part)
@@ -8655,7 +8659,7 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item)
Item_cache* Item_cache::get_cache(const Item *item)
{
- return get_cache(item, item->result_type());
+ return get_cache(item, item->cmp_type());
}