 |
MySQL
8.0.23
Source Code Documentation
|
Go to the documentation of this file.
23 #ifndef SQL_TIME_INCLUDED
24 #define SQL_TIME_INCLUDED
38 #ifdef HAVE_SYS_TIME_H
41 #include <sys/types.h>
82 struct timeval *tm,
int *warnings);
103 const char *field_name);
145 template <
class CLOS>
228 unsigned long ms,
bool negative,
void make_time(const Date_time_format *format, const MYSQL_TIME *l_time, String *str, uint dec)
Convert TIME value to String.
Definition: sql_time.cc:601
uint actual_decimals(const MYSQL_TIME *ts)
Return the number of significant second fraction decimals in ts, e.g.
Definition: sql_time.cc:791
bool my_longlong_to_time_with_warn(longlong nr, MYSQL_TIME *ltime)
Convert longlong number to TIME.
Definition: sql_time.cc:398
Definition: mysql_lex_string.h:39
@ MYSQL_TIMESTAMP_TIME
Stores hour, minute, second and microsecond.
Definition: mysql_time.h:59
const char * ptr() const
Definition: sql_string.h:246
Definition: sql_class.h:807
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.
Definition: sql_time.cc:653
const CHARSET_INFO * charset() const
Definition: sql_string.h:237
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().
Definition: sql_time.cc:125
This file contains the field type.
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.
Definition: sql_time.cc:234
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.
Definition: sql_time.cc:785
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().
Definition: sql_time.cc:146
Definition: m_ctype.h:354
@ MYSQL_TYPE_DATETIME
Definition: field_types.h:69
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:164
bool datetime_to_timeval(const MYSQL_TIME *t, const Time_zone &tz, struct timeval *tm, int *warnings)
Convert a datetime MYSQL_TIME representation to corresponding "struct timeval" value.
Definition: sql_time.cc:503
[] long int my_time_t
Portable time_t replacement.
long long int longlong
Definition: my_inttypes.h:54
@ MYSQL_TIMESTAMP_DATETIME
Stores all date and time components.
Definition: mysql_time.h:56
bool my_decimal_to_time_with_warn(const my_decimal *decimal, MYSQL_TIME *ltime)
Convert decimal number to TIME.
Definition: sql_time.cc:340
size_t max_fraction(uint decimals)
For a time fraction with a given number of decimals, return maximum fraction, if any,...
Definition: sql_time.cc:800
enum_severity_level
Enumeration value describing the severity of the condition.
Definition: sql_error.h:58
@ MYSQL_TIMESTAMP_DATE
Stores year, month and day components.
Definition: mysql_time.h:49
T propagate_datetime_overflow(THD *thd, int *warnings, T t)
Wrapper function which will propagate any DATETIME_OVERFLOW warnings to the THD.
Definition: sql_time.h:129
bool date_add_interval_with_warn(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 t...
Definition: sql_time.cc:701
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...
Definition: sql_time.cc:171
bool my_TIME_to_str(const MYSQL_TIME *ltime, String *str, uint dec)
Convert TIME/DATE/DATETIME value to String.
Definition: sql_time.cc:641
static STATUS status
Definition: mysql.cc:200
bool my_double_to_time_with_warn(double nr, MYSQL_TIME *ltime)
Convert double number to TIME.
Definition: sql_time.cc:370
void propagate_datetime_overflow_helper(THD *thd, int *warnings)
Propagates a DATETIME_OVERFLOW warning from warnings bitfield to DA in thd.
Definition: sql_time.cc:714
@ MYSQL_TIMESTAMP_NONE
Definition: mysql_time.h:45
@ MYSQL_TYPE_TIME
Definition: field_types.h:68
Definition: commit_order_queue.h:33
const LEX_CSTRING interval_type_to_name[]
Name description of interval names used in statements.
Definition: sql_time.cc:67
@ MYSQL_TYPE_DATE
Definition: field_types.h:67
enum_field_types
Column types for MySQL.
Definition: field_types.h:57
unsigned int uint
Definition: uca-dump.cc:29
void time_to_datetime(THD *thd, const MYSQL_TIME *tm, const Time_zone &tz, MYSQL_TIME *dt)
interval_type
Available interval types used in any statement.
Definition: my_time.h:403
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 conversio...
Definition: sql_time.cc:518
static const std::string dec("DECRYPTION")
void make_date(const Date_time_format *format, const MYSQL_TIME *l_time, String *str)
Convert DATE value to String.
Definition: sql_time.cc:614
unsigned char uchar
Definition: my_inttypes.h:51
@ MYSQL_TYPE_TIMESTAMP
Definition: field_types.h:64
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.
Definition: sql_time.cc:733
ulonglong gmt_time_to_local_time(ulonglong time)
This function gets GMT time and adds value of time_zone to get the local time.
Definition: sql_time.cc:764
unsigned int my_time_flags_t
Flags to str_to_datetime and number_to_datetime.
Definition: my_time.h:82
my_decimal class limits 'decimal_t' type to what we need in MySQL.
Definition: my_decimal.h:91
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.
Definition: sql_time.cc:266
Struct representing a duration.
Definition: my_time.h:168
This class represents abstract time zone and provides basic interface for MYSQL_TIME <-> my_time_t co...
Definition: tztime.h:48
Definition: mysql_time.h:81
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.
Definition: sql_time.cc:297
void make_datetime(const Date_time_format *format, const MYSQL_TIME *l_time, String *str, uint dec)
Convert DATETIME value to String.
Definition: sql_time.cc:628
size_t length() const
Definition: sql_string.h:238
enum_mysql_timestamp_type
Definition: mysql_time.h:44
const char * get_date_time_format_str(const Known_date_time_format *format, enum_mysql_timestamp_type type)
Return format string according format name.
Definition: sql_time.cc:563
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
unsigned long long int ulonglong
Definition: my_inttypes.h:55
enum_mysql_timestamp_type field_type_to_timestamp_type(enum enum_field_types type)
Return the timstamp value corresponding the field type passed as argument.
Definition: sql_time.h:198
my_time_t TIME_to_timestamp(const MYSQL_TIME *t, const Time_zone &tz, bool *not_exist)
Structure to return status from str_to_datetime(), str_to_time(), number_to_datetime(),...
Definition: my_time.h:158
type
Definition: base.h:36
static int interval
Definition: mysqladmin.cc:64
Definition: sql_error.h:220
static int flags[50]
Definition: hp_test1.cc:39
bool datetime_with_no_zero_in_date_to_timeval(const MYSQL_TIME *t, const Time_zone &tz, struct timeval *tm, int *warnings)
Converts a datetime in MYSQL_TIME representation to corresponding struct timeval value.
Definition: sql_time.cc:437