MySQL 8.3.0
Source Code Documentation
Field_temporal Class Referenceabstract

#include <field.h>

Inheritance diagram for Field_temporal:
[legend]

Public Member Functions

 Field_temporal (uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, uchar auto_flags_arg, const char *field_name_arg, uint32 len_arg, uint8 dec_arg)
 Constructor for Field_temporal. More...
 
Item_result result_type () const final
 
uint32 max_display_length () const final
 
bool str_needs_quotes () const final
 
uint is_equal (const Create_field *new_field) const final
 Whether a field being created is type-compatible with an existing one. More...
 
Item_result numeric_context_result_type () const final
 Returns Item_result type of a field when it appears in numeric context such as: SELECT time_column + 1; SELECT SUM(time_column); Examples: More...
 
enum Item_result cmp_type () const final
 
enum Derivation derivation () const final
 
uint repertoire () const final
 
const CHARSET_INFOcharset () const final
 
bool can_be_compared_as_longlong () const final
 
bool binary () const final
 
type_conversion_status store (const char *str, size_t len, const CHARSET_INFO *cs) final
 Store string into a date/time/datetime field. More...
 
type_conversion_status store_decimal (const my_decimal *decimal) final
 
type_conversion_status store (longlong nr, bool unsigned_val) override
 
type_conversion_status store (double nr) final
 
double val_real () const override
 
uint8 get_dec () const
 
my_decimalval_decimal (my_decimal *decimal_value) const override
 
my_time_flags_t get_date_flags (const THD *thd) const
 
uint8 get_fractional_digits () const
 
- Public Member Functions inherited from Field
 Field (const Field &)=default
 
void operator= (Field &)=delete
 
bool has_insert_default_general_value_expression () const
 Checks if the field is marked as having a general expression to generate default values. More...
 
bool has_insert_default_datetime_value_expression () const
 Checks if the field is marked as having a datetime value expression to generate default values on inserts. More...
 
bool has_update_default_datetime_value_expression () const
 Checks if the field is marked as having a datetime value expression to generate default values on updates. More...
 
bool has_insert_default_constant_expression () const
 Checks if the field is marked as having a constant expression to generate default values. More...
 
ucharget_null_ptr ()
 
virtual void set_field_length (uint32 length)
 
virtual void add_to_cost (CostOfItem *cost) const
 Update '*cost' with the fact that this Field is accessed. More...
 
bool is_flag_set (unsigned flag) const
 
void set_flag (unsigned flag)
 
void clear_flag (unsigned flag)
 
uint32 all_flags () const
 
virtual bool is_unsigned () const
 Whether the field is signed or not. More...
 
bool is_gcol () const
 
bool is_virtual_gcol () const
 
void set_hidden (dd::Column::enum_hidden_type hidden)
 Sets the hidden type for this field. More...
 
dd::Column::enum_hidden_type hidden () const
 
bool is_hidden () const
 
bool is_hidden_by_system () const
 
bool is_hidden_by_user () const
 
bool is_field_for_functional_index () const
 
 Field (uchar *ptr_arg, uint32 length_arg, uchar *null_ptr_arg, uchar null_bit_arg, uchar auto_flags_arg, const char *field_name_arg)
 This is used as a table name when the table structure is not set up. More...
 
virtual ~Field ()=default
 
void reset_warnings ()
 
void set_tmp_nullable ()
 Turn on temporary nullability for the field. More...
 
void reset_tmp_nullable ()
 Turn off temporary nullability for the field. More...
 
void reset_tmp_null ()
 Reset temporary NULL value for field. More...
 
void set_tmp_null ()
 Set field to temporary value NULL. More...
 
bool is_tmp_nullable () const
 
bool is_tmp_null () const
 
virtual type_conversion_status store_packed (longlong nr)
 Store a temporal value in packed longlong format into a field. More...
 
virtual type_conversion_status store_time (MYSQL_TIME *ltime, uint8 dec_arg)
 Store MYSQL_TIME value with the given amount of decimal digits into a field. More...
 
type_conversion_status store_time (MYSQL_TIME *ltime)
 Store MYSQL_TYPE value into a field when the number of fractional digits is not important or is not know. More...
 
type_conversion_status store (const char *to, size_t length, const CHARSET_INFO *cs, enum_check_fields check_level)
 
virtual longlong val_int () const =0
 
virtual longlong val_time_temporal () const
 Returns TIME value in packed longlong format. More...
 
virtual longlong val_date_temporal () const
 Returns DATE/DATETIME value in packed longlong format. More...
 
virtual longlong val_time_temporal_at_utc () const
 
virtual longlong val_date_temporal_at_utc () const
 
longlong val_temporal_by_field_type () const
 Returns "native" packed longlong representation of a TIME or DATE/DATETIME field depending on field type. More...
 
Stringval_str (String *str) const
 
virtual Stringval_str (String *, String *) const =0
 
Stringval_int_as_str (String *val_buffer, bool unsigned_flag) const
 Interpret field value as an integer but return the result as a string. More...
 
virtual Item_result cast_to_int_type () const
 
bool gcol_expr_is_equal (const Create_field *field) const
 Check whether generated columns' expressions are the same. More...
 
virtual bool eq (const Field *field) const
 
virtual bool eq_def (const Field *field) const
 
virtual uint32 pack_length () const
 
virtual uint32 pack_length_in_rec () const
 
virtual bool compatible_field_size (uint metadata, Relay_log_info *, uint16, int *order) const
 Check to see if field size is compatible with destination. More...
 
virtual uint pack_length_from_metadata (uint field_metadata) const
 
virtual uint row_pack_length () const
 
int save_field_metadata (uchar *first_byte)
 
virtual uint32 data_length (ptrdiff_t row_offset=0) const
 
virtual uint32 max_data_length () const
 Get the maximum size of the data in packed format. More...
 
virtual type_conversion_status reset ()
 
virtual bool get_timestamp (my_timeval *tm, int *warnings) const
 Returns a UTC component in struct timeval format. More...
 
virtual void store_timestamp (const my_timeval *)
 Stores a timestamp value in timeval format in a field. More...
 
virtual void set_default ()
 
void evaluate_insert_default_function ()
 Evaluates the INSERT default function and stores the result in the field. More...
 
void evaluate_update_default_function ()
 Evaluates the UPDATE default function, if one exists, and stores the result in the record buffer. More...
 
virtual bool zero_pack () const
 
virtual enum ha_base_keytype key_type () const
 
virtual uint32 key_length () const
 
virtual enum_field_types type () const =0
 
virtual enum_field_types real_type () const
 
virtual enum_field_types binlog_type () const
 
int cmp (const uchar *str) const
 
virtual int cmp_max (const uchar *a, const uchar *b, uint max_len) const
 
virtual int cmp (const uchar *, const uchar *) const =0
 
virtual int cmp_binary (const uchar *a, const uchar *b, uint32 max_length=~0L) const
 
virtual int cmp_offset (ptrdiff_t row_offset) const
 
virtual int cmp_binary_offset (ptrdiff_t row_offset) const
 
virtual int key_cmp (const uchar *a, const uchar *b) const
 
virtual int key_cmp (const uchar *str, uint length) const
 
virtual uint decimals () const
 
virtual bool is_text_key_type () const
 
virtual void sql_type (String &str) const =0
 
bool is_null (ptrdiff_t row_offset=0) const
 Check whether the full table's row is NULL or the Field has value NULL. More...
 
bool is_real_null (ptrdiff_t row_offset=0) const
 Check whether the Field has value NULL (temporary or actual). More...
 
bool is_null_in_record (const uchar *record) const
 Check if the Field has value NULL or the record specified by argument has value NULL for this Field. More...
 
void set_null (ptrdiff_t row_offset=0)
 Set field to value NULL. More...
 
void set_notnull (ptrdiff_t row_offset=0)
 Set field to value NOT NULL. More...
 
type_conversion_status check_constraints (int mysql_errno)
 Check NOT NULL constraint on the field after temporary nullability is disabled. More...
 
void set_check_for_truncated_fields (enum_check_fields check_for_truncated_fields)
 Remember the value of THD::check_for_truncated_fields to handle possible NOT-NULL constraint errors after BEFORE-trigger execution is finished. More...
 
bool is_nullable () const
 
uint null_offset (const uchar *record) const
 
uint null_offset () const
 
void set_null_ptr (uchar *p_null_ptr, uint p_null_bit)
 
virtual void make_send_field (Send_field *send_field) const
 Populates a Send_field object with metadata about the column represented by this Field object. More...
 
virtual size_t make_sort_key (uchar *buff, size_t length) const =0
 Writes a copy of the current value in the record buffer, suitable for sorting using byte-by-byte comparison. More...
 
virtual size_t make_sort_key (uchar *buff, size_t length, size_t trunc_pos) const
 Writes a copy of the current value in the record buffer, suitable for sorting using byte-by-byte comparison. More...
 
virtual bool optimize_range (uint idx, uint part) const
 Whether this field can be used for index range scans when in the given keypart of the given index. More...
 
virtual void mem_free ()
 
virtual Fieldnew_field (MEM_ROOT *root, TABLE *new_table) const
 
Fieldnew_field (MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit) const
 
virtual Fieldnew_key_field (MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit) const
 
Fieldnew_key_field (MEM_ROOT *root, TABLE *new_table, uchar *new_ptr) const
 
virtual Fieldclone (MEM_ROOT *mem_root) const =0
 Makes a shallow copy of the Field object. More...
 
void move_field (uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg)
 
virtual void move_field_offset (ptrdiff_t ptr_diff)
 
virtual void get_image (uchar *buff, size_t length, const CHARSET_INFO *) const
 
virtual void set_image (const uchar *buff, size_t length, const CHARSET_INFO *)
 
virtual size_t get_key_image (uchar *buff, size_t length, imagetype type) const
 
virtual void set_key_image (const uchar *buff, size_t length)
 
longlong val_int_offset (ptrdiff_t row_offset)
 
longlong val_int (uchar *new_ptr)
 
Stringval_str (String *str, uchar *new_ptr)
 
virtual bool send_to_protocol (Protocol *protocol) const
 Send the value of this field over the protocol using the correct Protocol::store*() function which matches the type of the field. More...
 
virtual ucharpack (uchar *to, const uchar *from, size_t max_length) const
 Pack the field into a format suitable for storage and transfer. More...
 
ucharpack (uchar *to) const
 
virtual const ucharunpack (uchar *to, const uchar *from, uint param_data)
 Unpack a field from row data. More...
 
const ucharunpack (const uchar *from)
 
virtual ucharpack_with_metadata_bytes (uchar *to, const uchar *from, uint max_length) const
 This function does the same thing as pack(), except for the difference that max_length does not mean the number of bytes in the output, but the maximum field length from the input (which must be exactly field->max_field_length()). More...
 
virtual bool pack_diff (uchar **to, ulonglong value_options) const
 Write the field for the binary log in diff format. More...
 
virtual uint max_packed_col_length () const
 This is a wrapper around pack_length() used by filesort() to determine how many bytes we need for packing "addon fields". More...
 
uint offset (uchar *record) const
 
void copy_data (ptrdiff_t src_record_offset)
 
virtual bool get_date (MYSQL_TIME *ltime, my_time_flags_t fuzzydate) const
 
virtual bool get_time (MYSQL_TIME *ltime) const
 
const CHARSET_INFOcharset_for_protocol () const
 
virtual const CHARSET_INFOsort_charset () const
 
virtual bool has_charset () const
 
virtual bool match_collation_to_optimize_range () const
 
virtual void set_derivation (enum Derivation)
 
bool set_warning (Sql_condition::enum_severity_level level, unsigned int code, int cut_increment)
 Produce warning or note about data saved into field. More...
 
bool set_warning (Sql_condition::enum_severity_level level, uint code, int cut_increment, const char *view_db, const char *view_name)
 Produce warning or note about data saved into field. More...
 
bool warn_if_overflow (int op_result)
 Process decimal library return codes and issue warnings for overflow and truncation. More...
 
virtual void init (TABLE *table_arg)
 
longlong convert_decimal2longlong (const my_decimal *val, bool unsigned_flag, bool *has_overflow)
 Conversion from decimal to longlong. More...
 
virtual uint32 char_length () const
 
virtual geometry_type get_geometry_type () const
 
void dbug_print () const
 
ha_storage_media field_storage_type () const
 
void set_storage_type (ha_storage_media storage_type_arg)
 
column_format_type column_format () const
 
void set_column_format (column_format_type column_format_arg)
 
virtual type_conversion_status validate_stored_val (THD *thd)
 
virtual void hash (ulong *nr, ulong *nr2) const
 
virtual ulonglong get_max_int_value () const
 Get the upper limit of the MySQL integral and floating-point type. More...
 
virtual const uchardata_ptr () const
 Return a const pointer to the actual data in the record buffer. More...
 
const ucharfield_ptr () const
 Return a const pointer to where the field is stored in the record buffer. More...
 
ucharfield_ptr ()
 Return a pointer to where the field is stored in the record buffer. More...
 
void set_field_ptr (uchar *ptr_arg)
 
virtual bool is_updatable () const
 Checks whether a string field is part of write_set. More...
 
bool is_part_of_actual_key (THD *thd, uint cur_index, KEY *cur_index_info) const
 Check whether field is part of the index taking the index extensions flag into account. More...
 
Key_map get_covering_prefix_keys () const
 Get covering prefix keys. More...
 
virtual bool is_array () const
 Whether the field is a typed array. More...
 
virtual uint32 get_length_bytes () const
 Return number of bytes the field's length takes. More...
 
bool handle_old_value () const
 Whether field's old valued have to be handled. More...
 
virtual void set_field_index (uint16 field_index)
 Sets field index. More...
 
uint16 field_index () const
 Returns field index. More...
 

Protected Member Functions

virtual type_conversion_status store_internal (const MYSQL_TIME *ltime, int *error)=0
 Low level routine to store a MYSQL_TIME value into a field. More...
 
virtual type_conversion_status store_internal_adjust_frac (MYSQL_TIME *ltime, int *warnings)=0
 Low level routine to store a MYSQL_TIME value into a field with rounding/truncation according to the field decimals() value and sql_mode. More...
 
type_conversion_status store_lldiv_t (const lldiv_t *lld, int *warning)
 Store a temporal value in lldiv_t into a field, with rounding according to the field decimals() value. More...
 
virtual bool convert_str_to_TIME (const char *str, size_t len, const CHARSET_INFO *cs, MYSQL_TIME *ltime, MYSQL_TIME_STATUS *status)=0
 Convert a string to MYSQL_TIME, according to the field type. More...
 
virtual type_conversion_status convert_number_to_TIME (longlong nr, bool unsigned_val, int nanoseconds, MYSQL_TIME *ltime, int *warning)=0
 Convert a number with fractional part with nanosecond precision into MYSQL_TIME, according to the field type. More...
 
longlong convert_number_to_datetime (longlong nr, bool unsigned_val, MYSQL_TIME *ltime, int *warnings)
 Convert an integer number into MYSQL_TIME, according to the field type. More...
 
bool set_warnings (const ErrConvString &str, int warnings)
 Set warnings from a warning vector. More...
 
virtual my_time_flags_t date_flags (const THD *thd) const
 Flags that are passed as "flag" argument to check_date(), number_to_datetime(), str_to_datetime(). More...
 
my_time_flags_t date_flags () const
 Flags that are passed as "flag" argument to check_date(), number_to_datetime(), str_to_datetime(). More...
 
bool set_datetime_warning (Sql_condition::enum_severity_level level, uint code, const ErrConvString &val, enum_mysql_timestamp_type ts_type, int truncate_increment)
 Produce warning or note about double datetime data saved into field. More...
 
- Protected Member Functions inherited from Field
ucharpack_int16 (uchar *to, const uchar *from, size_t max_length) const
 
const ucharunpack_int16 (uchar *to, const uchar *from) const
 
ucharpack_int24 (uchar *to, const uchar *from, size_t max_length) const
 
const ucharunpack_int24 (uchar *to, const uchar *from) const
 
ucharpack_int32 (uchar *to, const uchar *from, size_t max_length) const
 
const ucharunpack_int32 (uchar *to, const uchar *from) const
 
ucharpack_int64 (uchar *to, const uchar *from, size_t max_length) const
 
const ucharunpack_int64 (uchar *to, const uchar *from) const
 

Static Protected Member Functions

static uint8 normalize_dec (uint8 dec_arg)
 Adjust number of decimal digits from DECIMAL_NOT_SPECIFIED to DATETIME_MAX_DECIMALS. More...
 

Protected Attributes

uint8 dec
 
- Protected Attributes inherited from Field
ucharptr
 Holds the position to the field in record. More...
 

Additional Inherited Members

- Public Types inherited from Field
enum  enum_auto_flags {
  NONE = 0 , NEXT_NUMBER = 1 , DEFAULT_NOW = 2 , ON_UPDATE_NOW = 4 ,
  GENERATED_FROM_EXPRESSION = 8
}
 Flags for Field::auto_flags / Create_field::auto_flags bitmaps. More...
 
enum  geometry_type {
  GEOM_GEOMETRY = 0 , GEOM_POINT = 1 , GEOM_LINESTRING = 2 , GEOM_POLYGON = 3 ,
  GEOM_MULTIPOINT = 4 , GEOM_MULTILINESTRING = 5 , GEOM_MULTIPOLYGON = 6 , GEOM_GEOMETRYCOLLECTION = 7
}
 
enum  imagetype { itRAW , itMBR }
 
- Static Public Member Functions inherited from Field
static bool type_can_have_key_part (enum_field_types)
 Check whether a field type can be partially indexed by a key. More...
 
static enum_field_types field_type_merge (enum_field_types, enum_field_types)
 Return type of which can carry value of both given types in UNION result. More...
 
static Item_result result_merge_type (enum_field_types)
 Detect Item_result by given field type of UNION merge result. More...
 
- Public Attributes inherited from Field
TABLEtable
 Pointer to TABLE object that owns this field. More...
 
const char * orig_db_name {nullptr}
 Pointer to original database name, only non-NULL for a temporary table. More...
 
const char * orig_table_name {nullptr}
 Pointer to original table name, only non-NULL for a temporary table. More...
 
const char ** table_name
 
const char * field_name
 
LEX_CSTRING comment
 
Key_map key_start
 
Key_map part_of_key
 Keys that includes this field except of prefix keys. More...
 
Key_map part_of_prefixkey
 Prefix keys. More...
 
Key_map part_of_sortkey
 
Key_map part_of_key_not_extended
 All keys that include this field, but not extended by the storage engine to include primary key columns. More...
 
uint32 field_length
 
uchar null_bit
 
uchar auto_flags
 Bitmap of flags indicating if field value is auto-generated by default and/or on update, and in which way. More...
 
bool is_created_from_null_item
 If true, this field was created in create_tmp_field_from_item from a NULL value. More...
 
bool m_indexed
 True if this field belongs to some index (unlike part_of_key, the index might have only a prefix). More...
 
LEX_CSTRING m_engine_attribute = EMPTY_CSTR
 
LEX_CSTRING m_secondary_engine_attribute = EMPTY_CSTR
 
Value_generatorgcol_info {nullptr}
 
bool stored_in_db
 Indication that the field is physically stored in tables rather than just generated on SQL queries. More...
 
Value_generatorm_default_val_expr {nullptr}
 Holds the expression to be used to generate default values. More...
 
- Static Public Attributes inherited from Field
static constexpr size_t MAX_VARCHAR_WIDTH {65535}
 
static constexpr size_t MAX_TINY_BLOB_WIDTH {255}
 
static constexpr size_t MAX_SHORT_BLOB_WIDTH {65535}
 
static constexpr size_t MAX_MEDIUM_BLOB_WIDTH {16777215}
 
static constexpr size_t MAX_LONG_BLOB_WIDTH {4294967295}
 
- Static Protected Attributes inherited from Field
static uchar dummy_null_buffer = ' '
 

Constructor & Destructor Documentation

◆ Field_temporal()

Field_temporal::Field_temporal ( uchar ptr_arg,
uchar null_ptr_arg,
uchar  null_bit_arg,
uchar  auto_flags_arg,
const char *  field_name_arg,
uint32  len_arg,
uint8  dec_arg 
)
inline

Constructor for Field_temporal.

Parameters
ptr_argSee Field definition
null_ptr_argSee Field definition
null_bit_argSee Field definition
auto_flags_argSee Field definition
field_name_argSee Field definition
len_argNumber of characters in the integer part.
dec_argNumber of second fraction digits, 0..6.

Member Function Documentation

◆ binary()

bool Field_temporal::binary ( ) const
inlinefinalvirtual

Reimplemented from Field.

◆ can_be_compared_as_longlong()

bool Field_temporal::can_be_compared_as_longlong ( ) const
inlinefinalvirtual

Reimplemented from Field.

◆ charset()

const CHARSET_INFO * Field_temporal::charset ( ) const
inlinefinalvirtual

Reimplemented from Field.

◆ cmp_type()

enum Item_result Field_temporal::cmp_type ( ) const
inlinefinalvirtual

Reimplemented from Field.

◆ convert_number_to_datetime()

longlong Field_temporal::convert_number_to_datetime ( longlong  nr,
bool  unsigned_val,
MYSQL_TIME ltime,
int *  warnings 
)
protected

Convert an integer number into MYSQL_TIME, according to the field type.

Parameters
[in]nrNumber
[in]unsigned_valSIGNED/UNSIGNED flag
[out]ltimeThe value is stored here
[in,out]warningsWarnings found during execution
Return values
falseOn success
trueOn error

◆ convert_number_to_TIME()

virtual type_conversion_status Field_temporal::convert_number_to_TIME ( longlong  nr,
bool  unsigned_val,
int  nanoseconds,
MYSQL_TIME ltime,
int *  warning 
)
protectedpure virtual

Convert a number with fractional part with nanosecond precision into MYSQL_TIME, according to the field type.

Nanoseconds are rounded to milliseconds and added to ltime->second_part.

Parameters
[in]nrNumber
[in]unsigned_valSIGNED/UNSIGNED flag
[in]nanosecondsFractional part in nanoseconds
[out]ltimeThe value is stored here
[in,out]warningWarnings found during execution
Returns
Conversion status
Return values
falseOn success
trueOn error

Implemented in Field_temporal_with_date, and Field_time_common.

◆ convert_str_to_TIME()

virtual bool Field_temporal::convert_str_to_TIME ( const char *  str,
size_t  len,
const CHARSET_INFO cs,
MYSQL_TIME ltime,
MYSQL_TIME_STATUS status 
)
protectedpure virtual

Convert a string to MYSQL_TIME, according to the field type.

Parameters
[in]strString
[in]lenString length
[in]csString character set
[out]ltimeThe value is stored here
[out]statusConversion status
Return values
falseConversion went fine, ltime contains a valid time
trueConversion failed, ltime was reset and contains nothing

Implemented in Field_temporal_with_date, and Field_time_common.

◆ date_flags() [1/2]

my_time_flags_t Field_temporal::date_flags ( ) const
protected

Flags that are passed as "flag" argument to check_date(), number_to_datetime(), str_to_datetime().

Similar to the above when we don't have a THD value.

◆ date_flags() [2/2]

virtual my_time_flags_t Field_temporal::date_flags ( const THD thd) const
inlineprotectedvirtual

Flags that are passed as "flag" argument to check_date(), number_to_datetime(), str_to_datetime().

Flags depend on the session sql_mode settings, such as MODE_NO_ZERO_DATE, MODE_NO_ZERO_IN_DATE. Also, Field_newdate, Field_datetime, Field_datetimef add TIME_FUZZY_DATE to the session sql_mode settings, to allow relaxed date format, while Field_timestamp, Field_timestampf do not.

Parameters
thdTHD
Return values
sql_modeflags mixed with the field type flags.

Reimplemented in Field_temporal_with_date, Field_time_common, Field_timestamp, Field_timestampf, Field_newdate, Field_time_common, Field_datetime, and Field_datetimef.

◆ derivation()

enum Derivation Field_temporal::derivation ( ) const
inlinefinalvirtual

Reimplemented from Field.

◆ get_date_flags()

my_time_flags_t Field_temporal::get_date_flags ( const THD thd) const
inline

◆ get_dec()

uint8 Field_temporal::get_dec ( ) const
inline

◆ get_fractional_digits()

uint8 Field_temporal::get_fractional_digits ( ) const
inline

◆ is_equal()

uint Field_temporal::is_equal ( const Create_field new_field) const
finalvirtual

Whether a field being created is type-compatible with an existing one.

Used by the ALTER TABLE code to evaluate whether the new definition of a table is compatible with the old definition so that it can determine if data needs to be copied over (table data change). Constraints and generation clause (default value, generation expression) are not checked by this function.

Parameters
new_fieldnew field definition from alter.
Return values
IS_EQUAL_YESif there is no change.
IS_EQUAL_PACK_LENGTHif the data are unchanged, but the length requirements have changed
IS_EQUAL_NOif there is an incompatible change requiring copy.

Reimplemented from Field.

◆ max_display_length()

uint32 Field_temporal::max_display_length ( ) const
inlinefinalvirtual

Implements Field.

◆ normalize_dec()

static uint8 Field_temporal::normalize_dec ( uint8  dec_arg)
inlinestaticprotected

Adjust number of decimal digits from DECIMAL_NOT_SPECIFIED to DATETIME_MAX_DECIMALS.

◆ numeric_context_result_type()

Item_result Field_temporal::numeric_context_result_type ( ) const
inlinefinalvirtual

Returns Item_result type of a field when it appears in numeric context such as: SELECT time_column + 1; SELECT SUM(time_column); Examples:

  • a column of type TIME, DATETIME, TIMESTAMP act as INT.
  • a column of type TIME(1), DATETIME(1), TIMESTAMP(1) act as DECIMAL with 1 fractional digits.

Reimplemented from Field.

◆ repertoire()

uint Field_temporal::repertoire ( ) const
inlinefinalvirtual

Reimplemented from Field.

◆ result_type()

Item_result Field_temporal::result_type ( ) const
inlinefinalvirtual

Implements Field.

◆ set_datetime_warning()

bool Field_temporal::set_datetime_warning ( Sql_condition::enum_severity_level  level,
uint  code,
const ErrConvString val,
enum_mysql_timestamp_type  ts_type,
int  truncate_increment 
)
protected

Produce warning or note about double datetime data saved into field.

Parameters
levellevel of message (Note/Warning/Error)
codeerror code of message to be produced
valerror parameter (the value)
ts_typetype of datetime value (datetime/date/time)
truncate_incrementwhether we should increase truncated fields count
Return values
falseFunction reported warning
trueFunction reported error
Note
This function will always produce some warning but won't increase truncated fields counter if check_for_truncated_fields == FIELD_CHECK_IGNORE for current thread.

◆ set_warnings()

bool Field_temporal::set_warnings ( const ErrConvString str,
int  warnings 
)
protected

Set warnings from a warning vector.

Note, multiple warnings can be set at the same time. Every warning in the bit vector is set by an individual set_datetime_warning() call.

Parameters
strValue.
warningsWarning vector.
Return values
falseFunction reported warning
trueFunction reported error
Note
STRICT mode can convert warnings to error.

◆ store() [1/3]

type_conversion_status Field_temporal::store ( const char *  str,
size_t  len,
const CHARSET_INFO cs 
)
finalvirtual

Store string into a date/time/datetime field.

Parameters
strDate/time string
lenLength of the string
csCharacter set of the string
Return values
TYPE_OKStorage of value went fine without warnings or errors
!TYPE_OKWarning/error as indicated by type_conversion_status enum value

Implements Field.

◆ store() [2/3]

type_conversion_status Field_temporal::store ( double  nr)
finalvirtual

Implements Field.

◆ store() [3/3]

type_conversion_status Field_temporal::store ( longlong  nr,
bool  unsigned_val 
)
overridevirtual

Implements Field.

Reimplemented in Field_datetime.

◆ store_decimal()

type_conversion_status Field_temporal::store_decimal ( const my_decimal decimal)
finalvirtual

Implements Field.

◆ store_internal()

virtual type_conversion_status Field_temporal::store_internal ( const MYSQL_TIME ltime,
int *  error 
)
protectedpure virtual

Low level routine to store a MYSQL_TIME value into a field.

The value must be already properly rounded or truncated and checked for being a valid TIME/DATE/DATETIME value.

Parameters
[in]ltimeMYSQL_TIME value.
[out]errorError flag vector, set in case of error.
Return values
falseIn case of success.
trueIn case of error.

Implemented in Field_timestamp, Field_timestampf, Field_newdate, Field_time, Field_timef, Field_datetime, Field_datetimef, and Field_time_common.

◆ store_internal_adjust_frac()

virtual type_conversion_status Field_temporal::store_internal_adjust_frac ( MYSQL_TIME ltime,
int *  warnings 
)
protectedpure virtual

Low level routine to store a MYSQL_TIME value into a field with rounding/truncation according to the field decimals() value and sql_mode.

Parameters
[in]ltimeMYSQL_TIME value.
[out]warningsError flag vector, set in case of error.
Return values
falseIn case of success.
trueIn case of error.

Implemented in Field_temporal_with_date, and Field_time_common.

◆ store_lldiv_t()

type_conversion_status Field_temporal::store_lldiv_t ( const lldiv_t *  lld,
int *  warning 
)
protected

Store a temporal value in lldiv_t into a field, with rounding according to the field decimals() value.

Parameters
[in]lldTemporal value.
[out]warningWarning flag vector.
Return values
falseIn case of success.
trueIn case of error.

◆ str_needs_quotes()

bool Field_temporal::str_needs_quotes ( ) const
inlinefinalvirtual

Reimplemented from Field.

◆ val_decimal()

my_decimal * Field_temporal::val_decimal ( my_decimal decimal_value) const
overridevirtual

Implements Field.

Reimplemented in Field_timef, and Field_temporal_with_date_and_timef.

◆ val_real()

double Field_temporal::val_real ( void  ) const
inlineoverridevirtual

Implements Field.

Reimplemented in Field_temporal_with_date_and_timef, and Field_timef.

Member Data Documentation

◆ dec

uint8 Field_temporal::dec
protected

The documentation for this class was generated from the following files: