MySQL 8.4.3
Source Code Documentation
|
Implementation of server functions to handle date and time. More...
#include "sql/sql_time.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "decimal.h"
#include "my_compiler.h"
#include "my_macros.h"
#include "mysql/strings/m_ctype.h"
#include "mysql_com.h"
#include "mysqld_error.h"
#include "nulls.h"
#include "sql-common/my_decimal.h"
#include "sql/current_thd.h"
#include "sql/derror.h"
#include "sql/field.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/system_variables.h"
#include "sql/tztime.h"
#include "string_with_len.h"
Functions | |
my_time_flags_t | DatetimeConversionFlags (const THD *thd) |
Generate flags to use when converting a string to a date or datetime value. More... | |
static uint | to_ascii (const CHARSET_INFO *cs, const char *src, size_t src_length, char *dst, size_t dst_length) |
Convert a string to 8-bit representation, for use in str_to_time/str_to_date/str_to_date. More... | |
bool | str_to_time (const CHARSET_INFO *cs, const char *str, size_t length, MYSQL_TIME *l_time, my_time_flags_t flags, MYSQL_TIME_STATUS *status) |
Character set-aware version of str_to_time(). More... | |
bool | str_to_datetime (const CHARSET_INFO *cs, const char *str, size_t length, MYSQL_TIME *l_time, my_time_flags_t flags, MYSQL_TIME_STATUS *status) |
Character set-aware version of str_to_datetime(). More... | |
bool | str_to_datetime_with_warn (String *str, MYSQL_TIME *l_time, my_time_flags_t flags) |
Convert a timestamp string to a MYSQL_TIME value and produce a warning if string was truncated during conversion. More... | |
static bool | lldiv_t_to_datetime (lldiv_t lld, MYSQL_TIME *ltime, my_time_flags_t flags, int *warnings) |
Convert lldiv_t to datetime. More... | |
bool | decimal_to_datetime (const my_decimal *decimal, MYSQL_TIME *ltime, my_time_flags_t flags) |
Convert decimal value to datetime. More... | |
bool | my_decimal_to_datetime_with_warn (const my_decimal *decimal, MYSQL_TIME *ltime, my_time_flags_t flags) |
Convert decimal value to datetime value with a warning. More... | |
bool | double_to_datetime (double nr, MYSQL_TIME *ltime, my_time_flags_t flags) |
Convert double value to datetime. More... | |
bool | my_double_to_datetime_with_warn (double nr, MYSQL_TIME *ltime, my_time_flags_t flags) |
Convert double value to datetime value with a warning. More... | |
bool | my_longlong_to_datetime_with_warn (longlong nr, MYSQL_TIME *ltime, my_time_flags_t flags) |
Convert longlong value to datetime value with a warning. More... | |
static bool | lldiv_t_to_time (lldiv_t lld, MYSQL_TIME *ltime, int *warnings) |
Convert lldiv_t value to time with nanosecond rounding. More... | |
bool | decimal_to_time (const my_decimal *decimal, MYSQL_TIME *ltime) |
Convert decimal number to TIME. More... | |
bool | my_decimal_to_time_with_warn (const my_decimal *decimal, MYSQL_TIME *ltime) |
Convert decimal number to TIME. More... | |
bool | double_to_time (double nr, MYSQL_TIME *ltime) |
Convert double number to TIME. More... | |
bool | my_double_to_time_with_warn (double nr, MYSQL_TIME *ltime) |
Convert double number to TIME. More... | |
bool | my_longlong_to_time_with_warn (longlong nr, MYSQL_TIME *ltime) |
Convert longlong number to TIME. More... | |
bool | datetime_with_no_zero_in_date_to_timeval (const MYSQL_TIME *ltime, const Time_zone &tz, my_timeval *tm, int *warnings) |
Converts a datetime in MYSQL_TIME representation to corresponding struct timeval value. More... | |
bool | datetime_to_timeval (const MYSQL_TIME *ltime, const Time_zone &tz, my_timeval *tm, int *warnings) |
Convert a datetime MYSQL_TIME representation to corresponding "struct timeval" value. More... | |
bool | str_to_time_with_warn (String *str, MYSQL_TIME *l_time) |
Convert a time string to a MYSQL_TIME struct and produce a warning if string was cut during conversion. More... | |
void | time_to_datetime (THD *thd, const MYSQL_TIME *ltime, MYSQL_TIME *ltime2) |
Convert time to datetime. More... | |
const char * | get_date_time_format_str (const Known_date_time_format *format, enum_mysql_timestamp_type type) |
Return format string according format name. More... | |
void | make_time (const Date_time_format *format, const MYSQL_TIME *l_time, String *str, uint dec) |
Convert TIME value to String. More... | |
void | make_date (const Date_time_format *format, const MYSQL_TIME *l_time, String *str) |
Convert DATE value to String. More... | |
void | make_datetime (const Date_time_format *format, const MYSQL_TIME *l_time, String *str, uint dec) |
Convert DATETIME value to String. More... | |
bool | my_TIME_to_str (const MYSQL_TIME *ltime, String *str, uint dec) |
Convert TIME/DATE/DATETIME value to String. More... | |
bool | make_truncated_value_warning (THD *thd, Sql_condition::enum_severity_level level, const ErrConvString &val, enum_mysql_timestamp_type time_type, const char *field_name) |
Create and add a truncated value warning to the THD. More... | |
bool | date_add_interval_with_warn (THD *thd, MYSQL_TIME *ltime, interval_type int_type, Interval interval) |
Uses propagate_datetime_overflow() to handle and propagate any warnings from date_add_interval() to the THD. More... | |
void | propagate_datetime_overflow_helper (THD *thd, int *warnings) |
Propagates a DATETIME_OVERFLOW warning from warnings bitfield to DA in thd. More... | |
my_decimal * | my_decimal_from_datetime_packed (my_decimal *dec, enum enum_field_types type, longlong packed_value) |
Unpack packed numeric temporal value to date/time value and then convert to decimal representation. More... | |
ulonglong | gmt_time_to_local_time (ulonglong gmt_time) |
This function gets GMT time and adds value of time_zone to get the local time. More... | |
MYSQL_TIME | my_time_set (uint y, uint m, uint d, uint h, uint mi, uint s, unsigned long ms, bool negative, enum_mysql_timestamp_type type) |
In lieu of a proper constructor for the C struct MYSQL_TIME, this method initializes the struct. More... | |
uint | actual_decimals (const MYSQL_TIME *ts) |
Return the number of significant second fraction decimals in ts, e.g. More... | |
size_t | max_fraction (uint decimals) |
For a time fraction with a given number of decimals, return maximum fraction, if any, can be are present in a time value. More... | |
Variables | |
const LEX_CSTRING | interval_type_to_name [INTERVAL_LAST] |
Name description of interval names used in statements. More... | |
Implementation of server functions to handle date and time.