This commit is contained in:
Alexey Milovidov 2018-09-18 21:31:43 +03:00
parent ac73431451
commit b8cbedee27
2 changed files with 6 additions and 3 deletions

View File

@ -1570,6 +1570,7 @@ public:
}
};
/** formatDateTime(time, 'pattern')
* Performs formatting of time, according to provided pattern
*/
@ -1582,8 +1583,6 @@ private:
FormattingOperation(const char * source, size_t copy_source, size_t copy_length)
: source(source), source_position_to_copy(copy_source), source_length_to_copy(copy_length) {}
FormattingOperation(const char * source) : source(source) {}
void (*operation)(char *&, UInt32, const DateLUTImpl &) = nullptr;
private:
@ -1698,9 +1697,11 @@ private:
static void format_I(char *& target, UInt32 source, const DateLUTImpl & timezone)
{
auto x = ToHourImpl::execute(source, timezone);
writeNumber2(target, x > 12 ? x - 12 : x);
writeNumber2(target, x == 0 ? 12 : (x > 12 ? x - 12 : x));
}
/// TODO format_l
static void format_j(char *& target, UInt32 source, const DateLUTImpl & timezone)
{
writeNumberWidth(target, ToDayOfYearImpl::execute(source, timezone), 3);

View File

@ -1,3 +1,5 @@
SET send_logs_level = 'none';
SELECT formatDateTime(); -- { serverError 42 }
SELECT formatDateTime('not a datetime', 'IGNORED'); -- { serverError 43 }
SELECT formatDateTime(now(), now()); -- { serverError 43 }