My Project
Public Member Functions | Protected Member Functions
Field_temporal_with_date Class Reference

#include <field.h>

Inheritance diagram for Field_temporal_with_date:
Field_temporal Field Field_newdate Field_temporal_with_date_and_time Field_datetime Field_temporal_with_date_and_timef Field_timestamp Field_datetimef Field_timestampf

List of all members.

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)
Stringval_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)

Detailed Description

Abstract class for types with date with optional time, with or without fractional part: DATE, DATETIME, DATETIME(N), TIMESTAMP, TIMESTAMP(N).


Constructor & Destructor Documentation

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

Parameters:
ptr_argSee Field definition
null_ptr_argSee Field definition
null_bit_argSee Field definition
unireg_check_argSee Field definition
field_name_argSee Field definition
len_argNumber of characters in the integer part.
dec_argNumber of second fraction digits, 0..6.
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

Parameters:
maybe_null_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

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.

Parameters:
INnr Number
INunsigned_val SIGNED/UNSIGNED flag
INnanoseconds Fractional part in nanoseconds
OUTltime The value is stored here
OUTstatus Conversion status
Return values:
falseOn success
trueOn 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.

Parameters:
INstr String
INlen String length
INcs String character set
OUTltime The value is stored here
OUTstatus Conversion status
Return values:
falseConversion went fine, ltime contains a valid time
trueConversion 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.

Return values:
Trueon error: we get a zero value but flags disallow zero dates.
Falseon 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.

Parameters:
INltime MYSQL_TIME value.
OUTerror Error flag vector, set in case of error.
Return values:
falseIn case of success.
trueIn 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.

Parameters:
ltimeTime, date or datetime value.
decNumber of decimals in ltime.
Return values:
falseon success
trueon error

This is called when storing a date in a string.

Note:
Needs to be changed if/when we want to support different time formats.

Reimplemented from Field.

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.

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.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines