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

#include <field.h>

Inheritance diagram for Field_time_common:
Field_temporal Field Field_time Field_timef

List of all members.

Public Member Functions

 Field_time_common (uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint8 dec_arg)
 Field_time_common (bool maybe_null_arg, const char *field_name_arg, uint8 dec_arg)
type_conversion_status store_time (MYSQL_TIME *ltime, uint8 dec)
Stringval_str (String *, String *)
bool get_date (MYSQL_TIME *ltime, uint fuzzydate)
longlong val_date_temporal ()
bool send_binary (Protocol *protocol)

Protected Member Functions

bool convert_str_to_TIME (const char *str, uint len, const CHARSET_INFO *cs, MYSQL_TIME *ltime, MYSQL_TIME_STATUS *status)
type_conversion_status convert_number_to_TIME (longlong nr, bool unsigned_val, int nanoseconds, MYSQL_TIME *ltime, int *warning)
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)

Detailed Description

Abstract class for TIME and TIME(N).

Constructor & Destructor Documentation

Field_time_common::Field_time_common ( uchar *  ptr_arg,
uchar *  null_ptr_arg,
uchar  null_bit_arg,
enum utype  unireg_check_arg,
const char *  field_name_arg,
uint8  dec_arg 
) [inline]

Constructor for Field_time_common

ptr_argSee Field definition
null_ptr_argSee Field definition
null_bit_argSee Field definition
unireg_check_argSee Field definition
field_name_argSee Field definition
dec_argNumber of second fraction digits, 0..6.
Field_time_common::Field_time_common ( bool  maybe_null_arg,
const char *  field_name_arg,
uint8  dec_arg 
) [inline]

Constructor for Field_time_common

maybe_null_argSee Field definition
field_name_argSee Field definition
dec_argNumber of second fraction digits, 0..6.

Member Function Documentation

type_conversion_status Field_time_common::convert_number_to_TIME ( longlong  nr,
bool  unsigned_val,
int  nanoseconds,
MYSQL_TIME *  ltime,
int *  warning 
) [protected, virtual]
: convert_number_to_TIME returns conversion status through two different interfaces: return value and warning. It should be refactored to only use return value.

Implements Field_temporal.

bool Field_time_common::convert_str_to_TIME ( const char *  str,
uint  len,
const CHARSET_INFO *  cs,
MYSQL_TIME *  ltime,
) [protected, virtual]

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

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.

bool Field_time_common::get_date ( MYSQL_TIME *  ltime,
uint  fuzzydate 
) [virtual]

For a column for TIME type, get_date() takes the time value of the field, adds current date to it and returns the result as a DATETIME value.

Reimplemented from Field.

virtual type_conversion_status Field_time_common::store_internal ( const MYSQL_TIME *  ltime,
int *  error 
) [protected, pure virtual]

Low-level function to store MYSQL_TIME value. The value must be rounded or truncated according to decimals().

Implements Field_temporal.

Implemented in Field_timef, and Field_time.

type_conversion_status Field_time_common::store_internal_with_round ( MYSQL_TIME *  ltime,
int *  warnings 
) [protected, virtual]

Function to store time value. The value is rounded according to decimals().

Implements Field_temporal.

type_conversion_status Field_time_common::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.

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.

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

Reimplemented from Field.

longlong Field_time_common::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.

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