diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-09-21 08:12:19 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-09-21 08:12:19 +0300 |
commit | e3d44f5d62672478c40294d6e46d9f066e418cac (patch) | |
tree | 44b4d1b9d94ced780d4f369f84eddc36791470be /sql/item_timefunc.cc | |
parent | d176be8aeaecdb20a963fbd126929ddcd5bd98f3 (diff) | |
parent | f70865bc9e540767d8afc3cc2cbe0e1c92a8c0be (diff) | |
download | mariadb-git-e3d44f5d62672478c40294d6e46d9f066e418cac.tar.gz |
Merge bb-10.2-ext into 10.3
Diffstat (limited to 'sql/item_timefunc.cc')
-rw-r--r-- | sql/item_timefunc.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index c05f3f5c7be..0657d483408 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -477,14 +477,14 @@ static bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, { switch (*++ptr) { case 'M': - if (!l_time->month) + if (type == MYSQL_TIMESTAMP_TIME || !l_time->month) return 1; str->append(locale->month_names->type_names[l_time->month-1], (uint) strlen(locale->month_names->type_names[l_time->month-1]), system_charset_info); break; case 'b': - if (!l_time->month) + if (type == MYSQL_TIMESTAMP_TIME || !l_time->month) return 1; str->append(locale->ab_month_names->type_names[l_time->month-1], (uint) strlen(locale->ab_month_names->type_names[l_time->month-1]), @@ -534,26 +534,38 @@ static bool make_date_time(DATE_TIME_FORMAT *format, MYSQL_TIME *l_time, } break; case 'Y': + if (type == MYSQL_TIMESTAMP_TIME) + return 1; length= (uint) (int10_to_str(l_time->year, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 4, '0'); break; case 'y': + if (type == MYSQL_TIMESTAMP_TIME) + return 1; length= (uint) (int10_to_str(l_time->year%100, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'm': + if (type == MYSQL_TIMESTAMP_TIME) + return 1; length= (uint) (int10_to_str(l_time->month, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'c': + if (type == MYSQL_TIMESTAMP_TIME) + return 1; length= (uint) (int10_to_str(l_time->month, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; case 'd': + if (type == MYSQL_TIMESTAMP_TIME) + return 1; length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 2, '0'); break; case 'e': + if (type == MYSQL_TIMESTAMP_TIME) + return 1; length= (uint) (int10_to_str(l_time->day, intbuff, 10) - intbuff); str->append_with_prefill(intbuff, length, 1, '0'); break; |