MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Field_num Class Reference
Inheritance diagram for Field_num:
Collaboration diagram for Field_num:

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_INFOcharset (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 Member Functions inherited from Field
bool has_insert_default_function () const
bool has_update_default_function () const
 Field (uchar *ptr_arg, uint32 length_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg)
 This is used as a table name when the table structure is not set up.
virtual type_conversion_status store (const char *to, uint length, const CHARSET_INFO *cs)=0
virtual type_conversion_status store (double nr)=0
virtual type_conversion_status store (longlong nr, bool unsigned_val)=0
virtual type_conversion_status store_packed (longlong nr)
type_conversion_status store_time (MYSQL_TIME *ltime)
type_conversion_status store (const char *to, uint length, const CHARSET_INFO *cs, enum_check_fields check_level)
virtual double val_real (void)=0
virtual longlong val_int (void)=0
virtual longlong val_time_temporal ()
virtual longlong val_date_temporal ()
longlong val_temporal_by_field_type ()
Stringval_str (String *str)
virtual Stringval_str (String *, String *)=0
Stringval_int_as_str (String *val_buffer, my_bool unsigned_flag)
virtual bool str_needs_quotes ()
virtual Item_result numeric_context_result_type () const
virtual Item_result cmp_type () const
virtual Item_result cast_to_int_type () const
virtual bool eq (Field *field)
virtual uint32 pack_length () const
virtual uint32 pack_length_in_rec () const
virtual bool compatible_field_size (uint metadata, Relay_log_info *rli, uint16 mflags, int *order)
virtual int save_field_metadata (uchar *first_byte)
virtual uint32 data_length ()
virtual uint32 sort_length () const
virtual uint32 max_data_length () const
virtual type_conversion_status reset (void)
virtual void reset_fields ()
virtual bool get_timestamp (struct timeval *tm, int *warnings)
virtual void store_timestamp (const timeval *tm)
void store_timestamp (my_time_t sec)
virtual void set_default ()
void evaluate_insert_default_function ()
void evaluate_update_default_function ()
virtual bool binary () const
virtual bool zero_pack () const
virtual enum ha_base_keytype key_type () const
virtual uint32 key_length () const
virtual enum_field_types type () const =0
virtual enum_field_types real_type () const
virtual enum_field_types binlog_type () const
int cmp (const uchar *str)
virtual int cmp_max (const uchar *a, const uchar *b, uint max_len)
virtual int cmp (const uchar *, const uchar *)=0
virtual int cmp_binary (const uchar *a, const uchar *b, uint32 max_length=~0L)
virtual int cmp_offset (uint row_offset)
virtual int cmp_binary_offset (uint row_offset)
virtual int key_cmp (const uchar *a, const uchar *b)
virtual int key_cmp (const uchar *str, uint length)
virtual void sql_type (String &str) const =0
bool is_temporal () const
bool is_temporal_with_date () const
bool is_temporal_with_time () const
bool is_temporal_with_date_and_time () const
bool is_null (my_ptrdiff_t row_offset=0) const
bool is_real_null (my_ptrdiff_t row_offset=0) const
bool is_null_in_record (const uchar *record) const
void set_null (my_ptrdiff_t row_offset=0)
void set_notnull (my_ptrdiff_t row_offset=0)
bool maybe_null (void) const
bool real_maybe_null (void) const
uint null_offset (const uchar *record) const
uint null_offset () const
void set_null_ptr (uchar *p_null_ptr, uint p_null_bit)
size_t last_null_byte () const
virtual void make_field (Send_field *)
virtual void make_sort_key (uchar *buff, uint length)=0
virtual bool optimize_range (uint idx, uint part)
virtual bool can_be_compared_as_longlong () const
virtual void free ()
virtual Fieldnew_field (MEM_ROOT *root, TABLE *new_table, bool keep_type)
virtual Fieldnew_key_field (MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit)
Fieldnew_key_field (MEM_ROOT *root, TABLE *new_table, uchar *new_ptr)
virtual Fieldclone () const =0
virtual Fieldclone (MEM_ROOT *mem_root) const =0
void move_field (uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg)
void move_field (uchar *ptr_arg)
virtual void move_field_offset (my_ptrdiff_t ptr_diff)
virtual void get_image (uchar *buff, uint length, const CHARSET_INFO *cs)
virtual void set_image (const uchar *buff, uint length, const CHARSET_INFO *cs)
virtual uint get_key_image (uchar *buff, uint length, imagetype type)
virtual void set_key_image (const uchar *buff, uint length)
longlong val_int_offset (uint row_offset)
longlong val_int (const uchar *new_ptr)
Stringval_str (String *str, const uchar *new_ptr)
virtual bool send_binary (Protocol *protocol)
virtual uchar * pack (uchar *to, const uchar *from, uint max_length, bool low_byte_first)
uchar * pack (uchar *to, const uchar *from)
virtual const uchar * unpack (uchar *to, const uchar *from, uint param_data, bool low_byte_first)
const uchar * unpack (uchar *to, const uchar *from)
virtual uint packed_col_length (const uchar *to, uint length)
virtual uint max_packed_col_length (uint max_length)
uint offset (uchar *record)
void copy_from_tmp (int offset)
uint fill_cache_field (struct st_cache_field *copy)
virtual const CHARSET_INFOcharset_for_protocol (void) const
virtual const CHARSET_INFOsort_charset (void) const
virtual bool has_charset (void) const
virtual bool match_collation_to_optimize_range () const
virtual void set_derivation (enum Derivation derivation_arg)
bool set_warning (Sql_condition::enum_warning_level, unsigned int code, int cuted_increment) const
bool check_overflow (int op_result)
bool check_truncated (int op_result)
bool warn_if_overflow (int op_result)
void init (TABLE *table_arg)
virtual uint32 max_display_length ()=0
longlong convert_decimal2longlong (const my_decimal *val, bool unsigned_flag, bool *has_overflow)
virtual uint32 char_length ()
virtual geometry_type get_geometry_type ()
void dbug_print ()
ha_storage_media field_storage_type () const
void set_storage_type (ha_storage_media storage_type_arg)
column_format_type column_format () const
void set_column_format (column_format_type column_format_arg)
virtual type_conversion_status validate_stored_val (THD *thd)
virtual void hash (ulong *nr, ulong *nr2)

Public Attributes

const uint8 dec
bool zerofill
bool unsigned_flag
- Public Attributes inherited from Field
uchar * ptr
TABLEtable
TABLEorig_table
const char ** table_name
const char * field_name
LEX_STRING comment
key_map key_start
key_map part_of_key
key_map part_of_key_not_clustered
key_map part_of_sortkey
utype unireg_check
uint32 field_length
uint32 flags
uint16 field_index
uchar null_bit
bool is_created_from_null_item

Friends

class Create_field

Additional Inherited Members

- Public Types inherited from Field
enum  utype {
  NONE, DATE, SHIELD, NOEMPTY,
  CASEUP, PNR, BGNR, PGNR,
  YES, NO, REL, CHECK,
  EMPTY, UNKNOWN_FIELD, CASEDN, NEXT_NUMBER,
  INTERVAL_FIELD, BIT_FIELD, TIMESTAMP_OLD_FIELD, CAPITALIZE,
  BLOB_FIELD, TIMESTAMP_DN_FIELD, TIMESTAMP_UN_FIELD, TIMESTAMP_DNUN_FIELD
}
enum  geometry_type {
  GEOM_GEOMETRY = 0, GEOM_POINT = 1, GEOM_LINESTRING = 2, GEOM_POLYGON = 3,
  GEOM_MULTIPOINT = 4, GEOM_MULTILINESTRING = 5, GEOM_MULTIPOLYGON = 6, GEOM_GEOMETRYCOLLECTION = 7
}
enum  imagetype { itRAW, itMBR }
enum  { LAST_NULL_BYTE_UNDEF = 0 }
- Static Public Member Functions inherited from Field
static void * operator new (size_t size) throw ()
static void * operator new (size_t size, MEM_ROOT *mem_root) throw ()
static void operator delete (void *ptr, MEM_ROOT *mem_root)
static void operator delete (void *ptr_arg, size_t size) throw ()
static bool type_can_have_key_part (enum_field_types)
static enum_field_types field_type_merge (enum_field_types, enum_field_types)
static Item_result result_merge_type (enum_field_types)
- Protected Member Functions inherited from Field
uchar * pack_int16 (uchar *to, const uchar *from, bool low_byte_first_to)
const uchar * unpack_int16 (uchar *to, const uchar *from, bool low_byte_first_from)
uchar * pack_int24 (uchar *to, const uchar *from, bool low_byte_first_to)
const uchar * unpack_int24 (uchar *to, const uchar *from, bool low_byte_first_from)
uchar * pack_int32 (uchar *to, const uchar *from, bool low_byte_first_to)
const uchar * unpack_int32 (uchar *to, const uchar *from, bool low_byte_first_from)
uchar * pack_int64 (uchar *to, const uchar *from, bool low_byte_first_to)
const uchar * unpack_int64 (uchar *to, const uchar *from, bool low_byte_first_from)
bool field_flags_are_binary ()
- Static Protected Member Functions inherited from Field
static void handle_int16 (uchar *to, const uchar *from, bool low_byte_first_from, bool low_byte_first_to)
static void handle_int24 (uchar *to, const uchar *from, bool low_byte_first_from, bool low_byte_first_to)
static void handle_int32 (uchar *to, const uchar *from, bool low_byte_first_from, bool low_byte_first_to)
static void handle_int64 (uchar *to, const uchar *from, bool low_byte_first_from, bool low_byte_first_to)
- Protected Attributes inherited from Field
uchar * null_ptr

Detailed Description

Definition at line 1428 of file field.h.

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.

Definition at line 1147 of file field.cc.

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.

Todo:
Make this multi-byte-character safe
Parameters
strString to test
lengthLength of 'str'
int_endPointer to char after last used digit
csCharacter set
Note
This is called after one has called strntoull10rnd() function.
Returns
TYPE_OK, TYPE_ERR_BAD_VALUE or TYPE_WARN_TRUNCATED

Definition at line 1194 of file field.cc.

Here is the call graph for this function:

bool Field_num::eq_def ( Field field)
virtual
Returns
returns 1 if the fields are equally defined

Reimplemented from Field.

Definition at line 8903 of file field.cc.

Here is the call graph for this function:

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.

Definition at line 8923 of file field.cc.

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

Implements Field.

Reimplemented in Field_new_decimal, and Field_real.

Definition at line 1676 of file field.cc.

Here is the call graph for this function:

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.

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.

Reimplemented in Field_year, Field_new_decimal, and Field_real.

Definition at line 1292 of file field.cc.

my_decimal * Field_num::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

Implements Field.

Reimplemented in Field_new_decimal, and Field_real.

Definition at line 1700 of file field.cc.


The documentation for this class was generated from the following files: