[MDEV-17175] Change Time/Datetime constructors to return warnings in MYSQL_TIME_STATUS Created: 2018-09-12  Updated: 2018-09-12  Resolved: 2018-09-12

Status: Closed
Project: MariaDB Server
Component/s: Data types, Temporal Types
Fix Version/s: 10.4.0

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-16991 Rounding vs truncation for TIME, DATE... Closed

 Description   

This task is a self-sufficient part of MDEV-16991.

In order to take into account nanoseconds during string-to-temporal conversion, these constructors:

Time(int *warn, const char *str, size_t len, CHARSET_INFO *cs,
     const Options opt);
Datetime(int *warn, const char *str, size_t len, CHARSET_INFO *cs,
         sql_mode_t flags);

need to be changed to:

Time(MYSQL_TIME_STATUS *status, const char *str, size_t len, CHARSET_INFO *cs
     const Options opt);
Datetime(MYSQL_TIME_STATUS *status,
         const char *str, size_t len, CHARSET_INFO *cs,
          sql_mode_t flags);

i.e. the "int *warn" parameter needs to be changed to "MYSQL_TIME_STATUS *status".

Additionally, we'll move global character set aware functions:

/* Character set-aware version of str_to_time() */
bool str_to_time(CHARSET_INFO *cs, const char *str,size_t length,
                 MYSQL_TIME *l_time, ulonglong fuzzydate,
                 MYSQL_TIME_STATUS *status);
/* Character set-aware version of str_to_datetime() */
bool str_to_datetime(CHARSET_INFO *cs,
                     const char *str, size_t length,
                     MYSQL_TIME *l_time, ulonglong flags,
                     MYSQL_TIME_STATUS *status);

as methods to class Temporal.


Generated at Thu Feb 08 08:34:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.