My Project
Public Member Functions | Static Public Member Functions | Public Attributes
Field_new_decimal Class Reference
Inheritance diagram for Field_new_decimal:
Field_num Field

List of all members.

Public Member Functions

 Field_new_decimal (uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg)
 Field_new_decimal (uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, uint8 dec_arg, bool unsigned_arg)
enum_field_types type () const
enum ha_base_keytype key_type () const
Item_result result_type () const
type_conversion_status reset (void)
type_conversion_status store_value (const my_decimal *decimal_value)
void set_value_on_overflow (my_decimal *decimal_value, bool sign)
type_conversion_status store (const char *to, uint length, const CHARSET_INFO *charset)
type_conversion_status store (double nr)
type_conversion_status store (longlong nr, bool unsigned_val)
type_conversion_status store_time (MYSQL_TIME *ltime, uint8 dec)
type_conversion_status store_decimal (const my_decimal *)
double val_real (void)
longlong val_int (void)
my_decimalval_decimal (my_decimal *)
bool get_date (MYSQL_TIME *ltime, uint fuzzydate)
bool get_time (MYSQL_TIME *ltime)
Stringval_str (String *, String *)
int cmp (const uchar *, const uchar *)
void make_sort_key (uchar *buff, uint length)
bool zero_pack () const
void sql_type (String &str) const
uint32 max_display_length ()
uint32 pack_length () const
uint pack_length_from_metadata (uint field_metadata)
uint row_pack_length () const
bool compatible_field_size (uint field_metadata, Relay_log_info *rli, uint16 mflags, int *order_var)
uint is_equal (Create_field *new_field)
Field_new_decimalclone (MEM_ROOT *mem_root) const
Field_new_decimalclone () const
virtual const uchar * unpack (uchar *to, const uchar *from, uint param_data, bool low_byte_first)

Static Public Member Functions

static Fieldcreate_from_item (Item *)

Public Attributes

uint precision
uint bin_size

Member Function Documentation

Field_new_decimal* Field_new_decimal::clone ( MEM_ROOT *  mem_root) const [inline, virtual]

Makes a shallow copy of the Field object.

Note:
This member function must be overridden in all concrete subclasses. Several of the Field subclasses are concrete even though they are not leaf classes, so the compiler will not always catch this.
Parameters:
mem_rootMEM_ROOT to use for memory allocation.
Return values:
NULLIf memory allocation failed.

Implements Field.

Field_new_decimal* Field_new_decimal::clone ( ) const [inline, virtual]

Makes a shallow copy of the Field object.

Note:
This member function must be overridden in all concrete subclasses. Several of the Field subclasses are concrete even though they are not leaf classes, so the compiler will not always catch this.
Return values:
NULLIf memory allocation failed.

Implements Field.

bool Field_new_decimal::compatible_field_size ( uint  field_metadata,
Relay_log_info rli,
uint16  mflags,
int *  order_var 
) [virtual]

Check to see if field size is compatible with destination.

This method is used in row-based replication to verify that the slave's field size is less than or equal to the master's field size. The encoded field metadata (from the master or source) is decoded and compared to the size of this field (the slave or destination).

Parameters:
field_metadataEncoded size in field metadata
order_varPointer to variable where the order between the source field and this field will be returned.
Returns:
true

Reimplemented from Field.

uint Field_new_decimal::is_equal ( Create_field new_field) [virtual]

Check whether two numeric fields can be considered 'equal' for table alteration purposes. Fields are equal if they are of the same type and retain the same pack length.

Reimplemented from Field_num.

void Field_new_decimal::make_sort_key ( uchar *  buff,
uint  length 
) [virtual]

Writes a copy of the current value in the record buffer, suitable for sorting using byte-by-byte comparison. Integers are always in big-endian regardless of hardware architecture. At most length bytes are written into the buffer.

Parameters:
buffThe buffer, assumed to be at least length bytes.
lengthNumber of bytes to write.

Implements Field.

uint Field_new_decimal::pack_length_from_metadata ( uint  field_metadata) [virtual]

Returns the number of bytes field uses in row-based replication row packed size.

This method is used in row-based replication to determine the number of bytes that the field consumes in the row record format. This is used to skip fields in the master that do not exist on the slave.

Parameters:
field_metadataEncoded size in field metadata
Returns:
The size of the field based on the field metadata.

Reimplemented from Field_num.

void Field_new_decimal::set_value_on_overflow ( my_decimal decimal_value,
bool  sign 
)

Generate max/min decimal value in case of overflow.

Parameters:
decimal_valuebuffer for value
signsign of value which caused overflow
type_conversion_status Field_new_decimal::store ( double  nr) [virtual]
Todo:
Fix following when double2my_decimal when double2decimal will return E_DEC_TRUNCATED always correctly

Implements Field.

type_conversion_status Field_new_decimal::store_decimal ( const my_decimal val) [virtual]

Storing decimal in integer fields.

Parameters:
valvalue for storing
Note:
This method is used by all integer fields, real/decimal redefine it
Return values:
TYPE_OKStorage of value went fine without warnings or errors
!TYPE_OKWarning/error as indicated by type_conversion_status enum value

Reimplemented from Field_num.

type_conversion_status Field_new_decimal::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_num.

type_conversion_status Field_new_decimal::store_value ( const my_decimal decimal_value)

Store decimal value in the binary buffer.

Checks if decimal_value fits into field size. If it does, stores the decimal in the buffer using binary format. Otherwise sets maximal number that can be stored in the field.

Parameters:
decimal_valuemy_decimal
Return values:
0ok
1error
const uchar * Field_new_decimal::unpack ( uchar *  to,
const uchar *  from,
uint  param_data,
bool  low_byte_first 
) [virtual]

Unpack a decimal field from row data.

This method is used to unpack a decimal or numeric field from a master whose size of the field is less than that of the slave.

Parameters:
toDestination of the data
fromSource of the data
param_dataPrecision (upper) and decimal (lower) values
Returns:
New pointer into memory based on from + length of the data

Reimplemented from Field.

my_decimal * Field_new_decimal::val_decimal ( my_decimal decimal_value) [virtual]

Return decimal value of integer field.

Parameters:
decimal_valuebuffer for storing decimal value
Note:
This method is used by all integer fields, real/decimal redefine it. All longlong values fit in our decimal buffer which cal store 8*9=72 digits of integer number
Returns:
pointer to decimal buffer with value of field

Reimplemented from Field_num.


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