summaryrefslogtreecommitdiff
path: root/sql/item_timefunc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r--sql/item_timefunc.cc22
1 files changed, 8 insertions, 14 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 02a7b8511af..f43a4e79431 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -709,8 +709,8 @@ static bool get_interval_info(const char *str,uint length,CHARSET_INFO *cs,
{
longlong value;
const char *start= str;
- for (value=0; str != end && my_isdigit(cs,*str) ; str++)
- value= value*LL(10) + (longlong) (*str - '0');
+ for (value=0; str != end && my_isdigit(cs, *str) ; str++)
+ value= value*10 + *str - '0';
msec_length= 6 - (str - start);
values[i]= value;
while (str != end && !my_isdigit(cs,*str))
@@ -923,16 +923,14 @@ longlong Item_func_dayofmonth::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
- return (longlong) ltime.day;
+ return get_arg0_date(&ltime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.day;
}
longlong Item_func_month::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
- return (longlong) ltime.month;
+ return get_arg0_date(&ltime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.month;
}
@@ -983,16 +981,14 @@ longlong Item_func_hour::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_time(&ltime);
- return ltime.hour;
+ return get_arg0_time(&ltime) ? 0 : ltime.hour;
}
longlong Item_func_minute::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_time(&ltime);
- return ltime.minute;
+ return get_arg0_time(&ltime) ? 0 : ltime.minute;
}
/**
@@ -1002,8 +998,7 @@ longlong Item_func_second::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_time(&ltime);
- return ltime.second;
+ return get_arg0_time(&ltime) ? 0 : ltime.second;
}
@@ -1120,8 +1115,7 @@ longlong Item_func_year::val_int()
{
DBUG_ASSERT(fixed == 1);
MYSQL_TIME ltime;
- (void) get_arg0_date(&ltime, TIME_FUZZY_DATE);
- return (longlong) ltime.year;
+ return get_arg0_date(&ltime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.year;
}