My Project
Public Member Functions | Public Attributes | Friends
Field_num Class Reference
Inheritance diagram for Field_num:
Field Field_long Field_medium Field_new_decimal Field_real Field_short Field_tiny Field_decimal Field_double Field_float Field_year

List of all members.

Public Member Functions

 Field_num (uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, uint8 dec_arg, bool zero_arg, bool unsigned_arg)
Item_result result_type () const
enum Derivation derivation (void) const
uint repertoire (void) const
const CHARSET_INFO * charset (void) const
void prepend_zeros (String *value)
void add_zerofill_and_unsigned (String &res) const
uint decimals () const
bool eq_def (Field *field)
type_conversion_status store_decimal (const my_decimal *)
type_conversion_status store_time (MYSQL_TIME *ltime, uint8 dec)
my_decimalval_decimal (my_decimal *)
bool get_date (MYSQL_TIME *ltime, uint fuzzydate)
bool get_time (MYSQL_TIME *ltime)
uint is_equal (Create_field *new_field)
uint row_pack_length () const
uint32 pack_length_from_metadata (uint field_metadata)
type_conversion_status check_int (const CHARSET_INFO *cs, const char *str, int length, const char *int_end, int error)
type_conversion_status get_int (const CHARSET_INFO *cs, const char *from, uint len, longlong *rnd, ulonglong unsigned_max, longlong signed_min, longlong signed_max)

Public Attributes

const uint8 dec
bool zerofill
bool unsigned_flag


class Create_field

Constructor & Destructor Documentation

Field_num::Field_num ( uchar *  ptr_arg,
uint32  len_arg,
uchar *  null_ptr_arg,
uchar  null_bit_arg,
utype  unireg_check_arg,
const char *  field_name_arg,
uint8  dec_arg,
bool  zero_arg,
bool  unsigned_arg 

Numeric fields base class constructor.

Member Function Documentation

type_conversion_status Field_num::check_int ( const CHARSET_INFO *  cs,
const char *  str,
int  length,
const char *  int_end,
int  error 

Test if given number is a int.

Make this multi-byte-character safe
strString to test
lengthLength of 'str'
int_endPointer to char after last used digit
csCharacter set
This is called after one has called strntoull10rnd() function.
bool Field_num::eq_def ( Field field) [virtual]
returns 1 if the fields are equally defined

Reimplemented from Field.

uint Field_num::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.

Reimplemented in Field_new_decimal.

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

Storing decimal in integer fields.

valvalue for storing
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

Implements Field.

Reimplemented in Field_new_decimal, and Field_real.

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

Reimplemented in Field_year, Field_new_decimal, and Field_real.

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

Return decimal value of integer field.

decimal_valuebuffer for storing decimal value
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
pointer to decimal buffer with value of field

Implements Field.

Reimplemented in Field_new_decimal, and Field_real.

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