My Project
|
#include <field.h>
Public Member Functions | |
Field_temporal_with_date (uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint8 int_length_arg, uint8 dec_arg) | |
Field_temporal_with_date (bool maybe_null_arg, const char *field_name_arg, uint int_length_arg, uint8 dec_arg) | |
bool | send_binary (Protocol *protocol) |
type_conversion_status | store_time (MYSQL_TIME *ltime, uint8 dec) |
String * | val_str (String *, String *) |
longlong | val_time_temporal () |
longlong | val_date_temporal () |
bool | get_time (MYSQL_TIME *ltime) |
virtual type_conversion_status | validate_stored_val (THD *thd) |
Protected Member Functions | |
virtual bool | get_date_internal (MYSQL_TIME *ltime)=0 |
bool | get_internal_check_zero (MYSQL_TIME *ltime, uint fuzzydate) |
type_conversion_status | convert_number_to_TIME (longlong nr, bool unsigned_val, int nanoseconds, MYSQL_TIME *ltime, int *warning) |
bool | convert_str_to_TIME (const char *str, uint len, const CHARSET_INFO *cs, MYSQL_TIME *ltime, MYSQL_TIME_STATUS *status) |
type_conversion_status | store_internal_with_round (MYSQL_TIME *ltime, int *warnings) |
Abstract class for types with date with optional time, with or without fractional part: DATE, DATETIME, DATETIME(N), TIMESTAMP, TIMESTAMP(N).
Field_temporal_with_date::Field_temporal_with_date | ( | uchar * | ptr_arg, |
uchar * | null_ptr_arg, | ||
uchar | null_bit_arg, | ||
enum utype | unireg_check_arg, | ||
const char * | field_name_arg, | ||
uint8 | int_length_arg, | ||
uint8 | dec_arg | ||
) | [inline] |
Constructor for Field_temporal
Field_temporal_with_date::Field_temporal_with_date | ( | bool | maybe_null_arg, |
const char * | field_name_arg, | ||
uint | int_length_arg, | ||
uint8 | dec_arg | ||
) | [inline] |
Constructor for Field_temporal
type_conversion_status Field_temporal_with_date::convert_number_to_TIME | ( | longlong | nr, |
bool | unsigned_val, | ||
int | nanoseconds, | ||
MYSQL_TIME * | ltime, | ||
int * | warning | ||
) | [protected, 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 |
Implements Field_temporal.
bool Field_temporal_with_date::convert_str_to_TIME | ( | const char * | str, |
uint | len, | ||
const CHARSET_INFO * | cs, | ||
MYSQL_TIME * | ltime, | ||
MYSQL_TIME_STATUS * | status | ||
) | [protected, 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 |
Implements Field_temporal.
virtual bool Field_temporal_with_date::get_date_internal | ( | MYSQL_TIME * | ltime | ) | [protected, pure virtual] |
Low level function to get value into MYSQL_TIME, without checking for being valid.
Implemented in Field_datetimef, Field_datetime, Field_newdate, Field_timestampf, and Field_timestamp.
bool Field_temporal_with_date::get_internal_check_zero | ( | MYSQL_TIME * | ltime, |
uint | fuzzydate | ||
) | [protected] |
Get value into MYSQL_TIME and check TIME_NO_ZERO_DATE flag.
True | on error: we get a zero value but flags disallow zero dates. |
False | on success. |
type_conversion_status Field_temporal_with_date::store_internal_with_round | ( | MYSQL_TIME * | ltime, |
int * | warnings | ||
) | [protected, 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. |
Implements Field_temporal.
type_conversion_status Field_temporal_with_date::store_time | ( | MYSQL_TIME * | ltime, |
uint8 | dec_arg | ||
) | [virtual] |
Store MYSQL_TIME value with the given amount of decimal digits into a field.
Note, the "dec" parameter represents number of digits of the Item that previously created the MYSQL_TIME value. It's needed when we store the value into a CHAR/VARCHAR/TEXT field to display the proper amount of fractional digits. For other field types the "dec" value does not matter and is ignored.
ltime | Time, date or datetime value. |
dec | Number of decimals in ltime. |
false | on success |
true | on error |
This is called when storing a date in a string.
Reimplemented from Field.
longlong Field_temporal_with_date::val_date_temporal | ( | ) | [virtual] |
Returns DATE/DATETIME value in packed longlong format. This method should not be called for non-temporal types. Temporal field types override the default method.
Reimplemented from Field.
Reimplemented in Field_datetimef, and Field_newdate.
longlong Field_temporal_with_date::val_time_temporal | ( | ) | [virtual] |
Returns TIME value in packed longlong format. This method should not be called for non-temporal types. Temporal field types override the default method.
Reimplemented from Field.
Reimplemented in Field_newdate.
type_conversion_status Field_temporal_with_date::validate_stored_val | ( | THD * | thd | ) | [virtual] |
Validate date value stored in the field.
Now we check whether date value is zero or has zero in date or not and set warning/error message appropriately(depending on the sql_mode).
Reimplemented from Field.
Reimplemented in Field_timestampf, and Field_timestamp.