Commit e0d3d405 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: add Item::convert_time_to_datetime() helper

will be used in following commits
parent 75ac5789
...@@ -151,13 +151,9 @@ bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate) ...@@ -151,13 +151,9 @@ bool Item::get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate)
if (get_date(ltime, fuzzydate | time_flag)) if (get_date(ltime, fuzzydate | time_flag))
return true; return true;
if (ltime->time_type == MYSQL_TIMESTAMP_TIME && if (ltime->time_type == MYSQL_TIMESTAMP_TIME &&
!(fuzzydate & TIME_TIME_ONLY)) !(fuzzydate & TIME_TIME_ONLY) &&
{ convert_time_to_datetime(thd, ltime, fuzzydate))
MYSQL_TIME tmp; return true;
if (time_to_datetime_with_warn(thd, ltime, &tmp, fuzzydate))
return null_value= true;
*ltime= tmp;
}
return false; return false;
} }
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "sql_const.h" /* RAND_TABLE_BIT, MAX_FIELD_NAME */ #include "sql_const.h" /* RAND_TABLE_BIT, MAX_FIELD_NAME */
#include "field.h" /* Derivation */ #include "field.h" /* Derivation */
#include "sql_type.h" #include "sql_type.h"
#include "sql_time.h"
C_MODE_START C_MODE_START
#include <ma_dyncol.h> #include <ma_dyncol.h>
...@@ -1361,6 +1362,14 @@ class Item: public Value_source, ...@@ -1361,6 +1362,14 @@ class Item: public Value_source,
bool get_time(MYSQL_TIME *ltime) bool get_time(MYSQL_TIME *ltime)
{ return get_date(ltime, TIME_TIME_ONLY | TIME_INVALID_DATES); } { return get_date(ltime, TIME_TIME_ONLY | TIME_INVALID_DATES); }
// Get date with automatic TIME->DATETIME conversion // Get date with automatic TIME->DATETIME conversion
bool convert_time_to_datetime(THD *thd, MYSQL_TIME *ltime, ulonglong fuzzydate)
{
MYSQL_TIME tmp;
if (time_to_datetime_with_warn(thd, ltime, &tmp, fuzzydate))
return null_value= true;
*ltime= tmp;
return false;
}
bool get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate); bool get_date_with_conversion(MYSQL_TIME *ltime, ulonglong fuzzydate);
/* /*
Get time with automatic DATE/DATETIME to TIME conversion. Get time with automatic DATE/DATETIME to TIME conversion.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment