My Project
|
Public Member Functions | |
Field_temporal (uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint32 len_arg, uint8 dec_arg) | |
Field_temporal (bool maybe_null_arg, const char *field_name_arg, uint32 len_arg, uint8 dec_arg) | |
virtual Item_result | result_type () const |
virtual uint32 | max_display_length () |
virtual bool | str_needs_quotes () |
virtual uint | is_equal (Create_field *new_field) |
Item_result | numeric_context_result_type () const |
enum Item_result | cmp_type () const |
enum Derivation | derivation () const |
uint | repertoire () const |
const CHARSET_INFO * | charset () const |
bool | can_be_compared_as_longlong () const |
bool | binary () const |
type_conversion_status | store (const char *str, uint len, const CHARSET_INFO *cs) |
type_conversion_status | store_decimal (const my_decimal *decimal) |
type_conversion_status | store (longlong nr, bool unsigned_val) |
type_conversion_status | store (double nr) |
double | val_real () |
my_decimal * | val_decimal (my_decimal *decimal_value) |
Protected Member Functions | |
uint8 | normalize_dec (uint8 dec_arg) |
virtual type_conversion_status | store_internal (const MYSQL_TIME *ltime, int *error)=0 |
virtual type_conversion_status | store_internal_with_round (MYSQL_TIME *ltime, int *warnings)=0 |
type_conversion_status | store_lldiv_t (const lldiv_t *lld, int *warning) |
virtual bool | convert_str_to_TIME (const char *str, uint len, const CHARSET_INFO *cs, MYSQL_TIME *ltime, MYSQL_TIME_STATUS *status)=0 |
virtual type_conversion_status | convert_number_to_TIME (longlong nr, bool unsigned_val, int nanoseconds, MYSQL_TIME *ltime, int *warning)=0 |
longlong | convert_number_to_datetime (longlong nr, bool unsigned_val, MYSQL_TIME *ltime, int *warning) |
void | set_warnings (ErrConvString str, int warnings) |
virtual ulonglong | date_flags (const THD *thd) |
ulonglong | date_flags () |
void | set_datetime_warning (Sql_condition::enum_warning_level level, uint code, ErrConvString str, timestamp_type ts_type, int cuted_increment) |
Protected Attributes | |
uint8 | dec |
Field_temporal::Field_temporal | ( | uchar * | ptr_arg, |
uchar * | null_ptr_arg, | ||
uchar | null_bit_arg, | ||
enum utype | unireg_check_arg, | ||
const char * | field_name_arg, | ||
uint32 | len_arg, | ||
uint8 | dec_arg | ||
) | [inline] |
Constructor for Field_temporal
Field_temporal::Field_temporal | ( | bool | maybe_null_arg, |
const char * | field_name_arg, | ||
uint32 | len_arg, | ||
uint8 | dec_arg | ||
) | [inline] |
Constructor for Field_temporal
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.
IN | nr Number |
IN | unsigned_val SIGNED/UNSIGNED flag |
OUT | ltime The value is stored here |
false | On success |
true | On error |
-1 | Timestamp with wrong values |
anything | else DATETIME as integer in YYYYMMDDHHMMSS format |
virtual type_conversion_status Field_temporal::convert_number_to_TIME | ( | longlong | nr, |
bool | unsigned_val, | ||
int | nanoseconds, | ||
MYSQL_TIME * | ltime, | ||
int * | warning | ||
) | [protected, pure 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.
IN | nr Number |
IN | unsigned_val SIGNED/UNSIGNED flag |
IN | nanoseconds Fractional part in nanoseconds |
OUT | ltime The value is stored here |
OUT | status Conversion status |
false | On success |
true | On error |
Implemented in Field_time_common, and Field_temporal_with_date.
virtual bool Field_temporal::convert_str_to_TIME | ( | const char * | str, |
uint | len, | ||
const CHARSET_INFO * | cs, | ||
MYSQL_TIME * | ltime, | ||
MYSQL_TIME_STATUS * | status | ||
) | [protected, pure virtual] |
Convert a string to MYSQL_TIME, according to the field type.
IN | str String |
IN | len String length |
IN | cs String character set |
OUT | ltime The value is stored here |
OUT | status Conversion status |
false | Conversion went fine, ltime contains a valid time |
true | Conversion failed, ltime was reset and contains nothing |
Implemented in Field_time_common, and Field_temporal_with_date.
virtual ulonglong Field_temporal::date_flags | ( | const THD * | thd | ) | [inline, protected, virtual] |
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.
thd | THD |
sql_mode | flags mixed with the field type flags. |
Reimplemented in Field_datetimef, Field_datetime, Field_newdate, Field_timestampf, and Field_timestamp.
ulonglong Field_temporal::date_flags | ( | ) | [inline, 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.
uint Field_temporal::is_equal | ( | Create_field * | new_field | ) | [virtual] |
uint8 Field_temporal::normalize_dec | ( | uint8 | dec_arg | ) | [inline, protected] |
Adjust number of decimal digits from NOT_FIXED_DEC to DATETIME_MAX_DECIMALS
Item_result Field_temporal::numeric_context_result_type | ( | ) | const [inline, virtual] |
Returns Item_result type of a field when it appears in numeric context such as: SELECT time_column + 1; SELECT SUM(time_column); Examples:
Reimplemented from Field.
void Field_temporal::set_datetime_warning | ( | Sql_condition::enum_warning_level | level, |
uint | code, | ||
ErrConvString | val, | ||
timestamp_type | ts_type, | ||
int | cut_increment | ||
) | [protected] |
Set a single warning using make_truncated_value_warning().
IN | level Warning level (error, warning, note) |
IN | code Warning code |
IN | str Warning parameter |
IN | ts_type Timestamp type (time, date, datetime, none) |
IN | cuted_inctement Incrementing of cut field counter |
Produce warning or note about double datetime data saved into field.
level | level of message (Note/Warning/Error) |
code | error code of message to be produced |
val | error parameter (the value) |
ts_type | type of datetime value (datetime/date/time) |
cut_increment | whenever we should increase cut fields count |
void Field_temporal::set_warnings | ( | ErrConvString | str, |
int | warnings | ||
) | [protected] |
Set a warning according to warning bit flag vector. Multiple warnings are possible at the same time. Every warning in the bit vector is set by an individual set_datetime_warning() call.
str | Warning parameter |
warnings | Warning bit flag |
Set warnings from a warning vector. Note, multiple warnings can be set at the same time.
str | Value. |
warnings | Warning vector. |
type_conversion_status Field_temporal::store | ( | const char * | str, |
uint | len, | ||
const CHARSET_INFO * | cs | ||
) | [virtual] |
Store string into a date/time/datetime field.
from | Date/time string |
len | Length of the string |
cs | Character set of the string |
TYPE_OK | Storage of value went fine without warnings or errors |
!TYPE_OK | Warning/error as indicated by type_conversion_status enum value |
Implements Field.
virtual type_conversion_status Field_temporal::store_internal | ( | const MYSQL_TIME * | ltime, |
int * | error | ||
) | [protected, pure 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.
IN | ltime MYSQL_TIME value. |
OUT | error Error flag vector, set in case of error. |
false | In case of success. |
true | In case of error. |
Implemented in Field_datetimef, Field_datetime, Field_timef, Field_time, Field_time_common, Field_newdate, Field_timestampf, and Field_timestamp.
virtual type_conversion_status Field_temporal::store_internal_with_round | ( | MYSQL_TIME * | ltime, |
int * | warnings | ||
) | [protected, pure virtual] |
Low level routine to store a MYSQL_TIME value into a field with rounding according to the field decimals() value.
IN | ltime MYSQL_TIME value. |
OUT | error Error flag vector, set in case of error. |
false | In case of success. |
true | In case of error. |
Implemented in Field_time_common, and Field_temporal_with_date.
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.
IN | lld Temporal value. |
OUT | warning Warning flag vector. |
false | In case of success. |
true | In case of error. |