The world's most popular open source database
#include <field.h>
Inheritance diagram for Field:


Public Types | |
| 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 | |
| GEOM_GEOMETRY = 0 | |
| GEOM_POINT = 1 | |
| GEOM_LINESTRING = 2 | |
| GEOM_POLYGON = 3 | |
| GEOM_MULTIPOINT = 4 | |
| GEOM_MULTILINESTRING = 5 | |
| GEOM_MULTIPOLYGON = 6 | |
| GEOM_GEOMETRYCOLLECTION = 7 | |
| itRAW | |
| itMBR | |
| 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 } |
Public Member Functions | |
| Field (char *ptr_arg, uint32 length_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg) | |
| virtual | ~Field () |
| virtual int | store (const char *to, uint length, CHARSET_INFO *cs)=0 |
| virtual int | store (double nr)=0 |
| virtual int | store (longlong nr, bool unsigned_val)=0 |
| virtual int | store_decimal (const my_decimal *d)=0 |
| virtual int | store_time (TIME *ltime, timestamp_type t_type) |
| virtual double | val_real (void)=0 |
| virtual longlong | val_int (void)=0 |
| virtual my_decimal * | val_decimal (my_decimal *) |
| String * | val_str (String *str) |
| virtual String * | val_str (String *, String *)=0 |
| String * | val_int_as_str (String *val_buffer, my_bool unsigned_flag) |
| virtual bool | str_needs_quotes () |
| virtual Item_result | result_type () const =0 |
| virtual Item_result | cmp_type () const |
| virtual Item_result | cast_to_int_type () const |
| virtual bool | eq (Field *field) |
| virtual bool | eq_def (Field *field) |
| virtual uint32 | pack_length () const |
| virtual uint32 | pack_length_in_rec () const |
| virtual uint32 | data_length (const char *from) |
| virtual uint32 | sort_length () const |
| virtual void | reset (void) |
| virtual void | reset_fields () |
| virtual void | set_default () |
| 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 |
| int | cmp (const char *str) |
| virtual int | cmp_max (const char *a, const char *b, uint max_len) |
| virtual int | cmp (const char *, const char *)=0 |
| virtual int | cmp_binary (const char *a, const char *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 byte *a, const byte *b) |
| virtual int | key_cmp (const byte *str, uint length) |
| virtual uint | decimals () const |
| virtual void | sql_type (String &str) const =0 |
| virtual uint | size_of () const =0 |
| bool | is_null (uint row_offset=0) |
| bool | is_real_null (uint row_offset=0) |
| bool | is_null_in_record (const uchar *record) |
| bool | is_null_in_record_with_offset (my_ptrdiff_t offset) |
| void | set_null (int row_offset=0) |
| void | set_notnull (int row_offset=0) |
| bool | maybe_null (void) |
| bool | real_maybe_null (void) |
| virtual void | make_field (Send_field *) |
| virtual void | sort_string (char *buff, uint length)=0 |
| virtual bool | optimize_range (uint idx, uint part) |
| virtual bool | can_be_compared_as_longlong () const |
| virtual void | free () |
| virtual Field * | new_field (MEM_ROOT *root, struct st_table *new_table, bool keep_type) |
| virtual Field * | new_key_field (MEM_ROOT *root, struct st_table *new_table, char *new_ptr, uchar *new_null_ptr, uint new_null_bit) |
| Field * | clone (MEM_ROOT *mem_root, struct st_table *new_table) |
| void | move_field (char *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg) |
| void | move_field (char *ptr_arg) |
| virtual void | move_field_offset (my_ptrdiff_t ptr_diff) |
| void | get_image (char *buff, uint length, CHARSET_INFO *cs) |
| void | set_image (char *buff, uint length, CHARSET_INFO *cs) |
| virtual void | get_key_image (char *buff, uint length, imagetype type) |
| virtual void | set_key_image (char *buff, uint length) |
| longlong | val_int_offset (uint row_offset) |
| longlong | val_int (char *new_ptr) |
| String * | val_str (String *str, char *new_ptr) |
| virtual bool | send_binary (Protocol *protocol) |
| virtual char * | pack (char *to, const char *from, uint max_length=~(uint) 0) |
| virtual const char * | unpack (char *to, const char *from) |
| virtual char * | pack_key (char *to, const char *from, uint max_length) |
| virtual char * | pack_key_from_key_image (char *to, const char *from, uint max_length) |
| virtual const char * | unpack_key (char *to, const char *from, uint max_length) |
| virtual uint | packed_col_length (const char *to, uint length) |
| virtual uint | max_packed_col_length (uint max_length) |
| virtual int | pack_cmp (const char *a, const char *b, uint key_length_arg, my_bool insert_or_update) |
| virtual int | pack_cmp (const char *b, uint key_length_arg, my_bool insert_or_update) |
| uint | offset () |
| void | copy_from_tmp (int offset) |
| uint | fill_cache_field (struct st_cache_field *copy) |
| virtual bool | get_date (TIME *ltime, uint fuzzydate) |
| virtual bool | get_time (TIME *ltime) |
| virtual CHARSET_INFO * | charset (void) const |
| virtual CHARSET_INFO * | sort_charset (void) const |
| virtual bool | has_charset (void) const |
| virtual void | set_charset (CHARSET_INFO *charset) |
| bool | set_warning (MYSQL_ERROR::enum_warning_level, unsigned int code, int cuted_increment) |
| bool | check_int (const char *str, int length, const char *int_end, CHARSET_INFO *cs) |
| void | set_datetime_warning (MYSQL_ERROR::enum_warning_level, uint code, const char *str, uint str_len, timestamp_type ts_type, int cuted_increment) |
| void | set_datetime_warning (MYSQL_ERROR::enum_warning_level, uint code, longlong nr, timestamp_type ts_type, int cuted_increment) |
| void | set_datetime_warning (MYSQL_ERROR::enum_warning_level, const uint code, double nr, timestamp_type ts_type) |
| bool | check_overflow (int op_result) |
| int | warn_if_overflow (int op_result) |
| void | init (TABLE *table_arg) |
| virtual uint32 | max_length ()=0 |
| virtual uint | is_equal (create_field *new_field) |
| longlong | convert_decimal2longlong (const my_decimal *val, bool unsigned_flag, int *err) |
| uint32 | char_length () const |
| virtual void | hash (ulong *nr, ulong *nr2) |
Static Public Member Functions | |
| static void * | operator new (size_t size) |
| static void | operator delete (void *ptr_arg, size_t size) |
| 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) |
Public Attributes | |
| char * | ptr |
| uchar * | null_ptr |
| st_table * | table |
| st_table * | orig_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 |
Private Member Functions | |
| Field (const Item &) | |
| void | operator= (Field &) |
Friends | |
| class | Copy_field |
| class | Item_avg_field |
| class | Item_std_field |
| class | Item_sum_num |
| class | Item_sum_sum |
| class | Item_sum_str |
| class | Item_sum_count |
| class | Item_sum_avg |
| class | Item_sum_std |
| class | Item_sum_min |
| class | Item_sum_max |
| class | Item_func_group_concat |
| bool | reopen_table (THD *, struct st_table *, bool) |
| int | cre_myisam (my_string name, register TABLE *form, uint options, ulonglong auto_increment_value) |
Definition at line 47 of file field.h.
| enum Field::geometry_type |
| GEOM_GEOMETRY | |
| GEOM_POINT | |
| GEOM_LINESTRING | |
| GEOM_POLYGON | |
| GEOM_MULTIPOINT | |
| GEOM_MULTILINESTRING | |
| GEOM_MULTIPOLYGON | |
| GEOM_GEOMETRYCOLLECTION |
Definition at line 80 of file field.h.
00081 { 00082 GEOM_GEOMETRY = 0, GEOM_POINT = 1, GEOM_LINESTRING = 2, GEOM_POLYGON = 3, 00083 GEOM_MULTIPOINT = 4, GEOM_MULTILINESTRING = 5, GEOM_MULTIPOLYGON = 6, 00084 GEOM_GEOMETRYCOLLECTION = 7 00085 };
| enum Field::imagetype |
| enum Field::utype |
Definition at line 76 of file field.h.
00076 { NONE,DATE,SHIELD,NOEMPTY,CASEUP,PNR,BGNR,PGNR,YES,NO,REL, 00077 CHECK,EMPTY,UNKNOWN_FIELD,CASEDN,NEXT_NUMBER,INTERVAL_FIELD, 00078 BIT_FIELD, TIMESTAMP_OLD_FIELD, CAPITALIZE, BLOB_FIELD, 00079 TIMESTAMP_DN_FIELD, TIMESTAMP_UN_FIELD, TIMESTAMP_DNUN_FIELD};
| Field::Field | ( | const Item & | ) | [private] |
| Field::Field | ( | char * | ptr_arg, | |
| uint32 | length_arg, | |||
| uchar * | null_ptr_arg, | |||
| uchar | null_bit_arg, | |||
| utype | unireg_check_arg, | |||
| const char * | field_name_arg | |||
| ) |
Definition at line 1223 of file field.cc.
References comment, field_index, flags, LEX_STRING::length, NOT_NULL_FLAG, null_ptr, and LEX_STRING::str.
01226 :ptr(ptr_arg), null_ptr(null_ptr_arg), 01227 table(0), orig_table(0), table_name(0), 01228 field_name(field_name_arg), 01229 key_start(0), part_of_key(0), part_of_key_not_clustered(0), 01230 part_of_sortkey(0), unireg_check(unireg_check_arg), 01231 field_length(length_arg), null_bit(null_bit_arg) 01232 { 01233 flags=null_ptr ? 0: NOT_NULL_FLAG; 01234 comment.str= (char*) ""; 01235 comment.length=0; 01236 field_index= 0; 01237 }
| virtual bool Field::binary | ( | ) | const [inline, virtual] |
Reimplemented in Field_str.
Definition at line 169 of file field.h.
Referenced by add_key_field(), and test_if_ref().
Here is the caller graph for this function:

| virtual bool Field::can_be_compared_as_longlong | ( | ) | const [inline, virtual] |
Reimplemented in Field_timestamp, Field_year, Field_date, Field_newdate, Field_time, and Field_datetime.
Definition at line 230 of file field.h.
References FALSE.
Referenced by Item_field::result_as_longlong().
00230 { return FALSE; }
Here is the caller graph for this function:

| virtual Item_result Field::cast_to_int_type | ( | ) | const [inline, virtual] |
Reimplemented in Field_enum.
Definition at line 128 of file field.h.
References result_type().
Referenced by Item_field::cast_to_int_type().
00128 { return result_type(); }
Here is the call graph for this function:

Here is the caller graph for this function:

| uint32 Field::char_length | ( | ) | const [inline] |
Definition at line 358 of file field.h.
References charset(), field_length, and charset_info_st::mbmaxlen.
Referenced by db_create_routine(), Field_blob::Field_blob(), Field_blob::get_key_image(), Field_varstring::get_key_image(), Field_blob::key_cmp(), Field_varstring::key_cmp(), Field_string::pack(), Field_varstring::pack_cmp(), Field_blob::pack_key(), Field_varstring::pack_key(), and Field_str::store().
00359 { 00360 return field_length / charset()->mbmaxlen; 00361 }
Here is the call graph for this function:

Here is the caller graph for this function:

| virtual CHARSET_INFO* Field::charset | ( | void | ) | const [inline, virtual] |
Reimplemented in Field_str.
Definition at line 323 of file field.h.
References my_charset_bin.
Referenced by char_length(), Cached_item_field::cmp(), create_field::create_field(), create_tmp_field_from_field(), eq_def(), Item_func_sp::fix_length_and_dec(), get_mm_leaf(), get_schema_column_record(), hash(), Field_varstring::is_equal(), Field_str::is_equal(), key_cmp_if_same(), Item_ident_for_show::make_field(), make_field(), mysql_alter_table(), Item_sum_hybrid::reset_field(), send_binary(), Item_field::set_field(), Item_field::set_no_const_sub(), sort_charset(), sp_returns_type(), Field_new_decimal::store(), store_create_info(), store_key::store_key(), and table_check_intact().
00323 { return &my_charset_bin; }
Here is the caller graph for this function:

| bool Field::check_int | ( | const char * | str, | |
| int | length, | |||
| const char * | int_end, | |||
| CHARSET_INFO * | cs | |||
| ) |
Definition at line 1076 of file field.cc.
References String::c_ptr(), String::copy(), ER, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, field_name, st_table::in_use, my_isspace, push_warning_printf(), set_warning(), system_charset_info, table, WARN_DATA_TRUNCATED, and MYSQL_ERROR::WARN_LEVEL_WARN.
Referenced by Field_year::store(), Field_long::store(), Field_medium::store(), Field_short::store(), and Field_tiny::store().
01078 { 01079 const char *end; 01080 if (str == int_end) 01081 { 01082 char buff[128]; 01083 String tmp(buff,(uint32) sizeof(buff), system_charset_info); 01084 tmp.copy(str, length, system_charset_info); 01085 push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN, 01086 ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, 01087 ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), 01088 "integer", tmp.c_ptr(), field_name, 01089 (ulong) table->in_use->row_count); 01090 return 1; // Empty string 01091 } 01092 end= str+length; 01093 if ((str= int_end) == end) 01094 return 0; // OK; All digits was used 01095 01096 /* Allow end .0000 */ 01097 if (*str == '.') 01098 { 01099 for (str++ ; str != end && *str == '0'; str++) 01100 ; 01101 } 01102 /* Allow end space */ 01103 for ( ; str != end ; str++) 01104 { 01105 if (!my_isspace(cs,*str)) 01106 { 01107 set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); 01108 return 1; 01109 } 01110 } 01111 return 0; 01112 }
Here is the call graph for this function:

Here is the caller graph for this function:

| bool Field::check_overflow | ( | int | op_result | ) | [inline] |
Definition at line 339 of file field.h.
References E_DEC_OVERFLOW.
Referenced by Field_new_decimal::store().
00340 { 00341 return (op_result == E_DEC_OVERFLOW); 00342 }
Here is the caller graph for this function:

Definition at line 1577 of file field.cc.
References st_table_share::default_values, init(), memdup_root(), move_field_offset(), st_table::record, st_table::s, and size_of().
Referenced by open_table_from_share().
01578 { 01579 Field *tmp; 01580 if ((tmp= (Field*) memdup_root(root,(char*) this,size_of()))) 01581 { 01582 tmp->init(new_table); 01583 tmp->move_field_offset((my_ptrdiff_t) (new_table->record[0] - 01584 new_table->s->default_values)); 01585 } 01586 return tmp; 01587 }
Here is the call graph for this function:

Here is the caller graph for this function:

| virtual int Field::cmp | ( | const char * | , | |
| const char * | ||||
| ) | [pure virtual] |
Implemented in Field_decimal, Field_new_decimal, Field_tiny, Field_short, Field_medium, Field_long, Field_float, Field_double, Field_null, Field_timestamp, Field_date, Field_newdate, Field_time, Field_datetime, Field_string, Field_varstring, Field_blob, Field_enum, and Field_bit.

