1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

Fix makedate() and year() functions

* The year() function did not handle float/double input correctly
* Makedate() did not handle year < 100 conversion
* 0 date was converted to NULL for some functions

In addition makedate did
This commit is contained in:
Andrew Hutchings
2016-09-27 16:11:31 +01:00
parent 03ce5a4936
commit 55844a0f0b
3 changed files with 27 additions and 4 deletions

View File

@ -1900,6 +1900,20 @@ int64_t DataConvert::intToDatetime(int64_t data, bool* date)
{
bool isDate = false;
char buf[21] = {0};
DateTime adaytime;
if (data == 0)
{
adaytime.year = 0;
adaytime.month = 0;
adaytime.day = 0;
adaytime.hour = 0;
adaytime.minute = 0;
adaytime.second = 0;
adaytime.msecond = 0;
if (date)
*date = true;
return *(reinterpret_cast<uint64_t*>(&adaytime));
}
snprintf( buf, 15, "%llu", (long long unsigned int)data);
//string date = buf;
string year, month, day, hour, min, sec, msec;
@ -1964,7 +1978,7 @@ int64_t DataConvert::intToDatetime(int64_t data, bool* date)
default:
return -1;
}
DateTime adaytime;
if (year.empty())
{
// MMDD format. assume current year