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

Public Member Functions

 Field_blob (uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, TABLE_SHARE *share, uint blob_pack_length, const CHARSET_INFO *cs)
 Field_blob (uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, const CHARSET_INFO *cs)
 Field_blob (uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, const CHARSET_INFO *cs, bool set_packlength)
 Field_blob (uint32 packlength_arg)
enum_field_types type () const
bool match_collation_to_optimize_range () const
enum ha_base_keytype key_type () const
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)
double val_real (void)
longlong val_int (void)
Stringval_str (String *, String *)
my_decimalval_decimal (my_decimal *)
int cmp_max (const uchar *, const uchar *, uint max_length)
int cmp (const uchar *a, const uchar *b)
int cmp (const uchar *a, uint32 a_length, const uchar *b, uint32 b_length)
int cmp_binary (const uchar *a, const uchar *b, uint32 max_length=~0L)
int key_cmp (const uchar *, const uchar *)
int key_cmp (const uchar *str, uint length)
uint32 key_length () const
void make_sort_key (uchar *buff, uint length)
uint32 pack_length () const
uint32 pack_length_no_ptr () const
uint row_pack_length () const
uint32 sort_length () const
virtual uint32 max_data_length () const
type_conversion_status reset (void)
void reset_fields ()
uint32 get_field_buffer_size (void)
void store_length (uchar *i_ptr, uint i_packlength, uint32 i_number)
void store_length (uint32 number)
uint32 get_packed_size (const uchar *ptr_arg, bool low_byte_first)
uint32 get_length (uint row_offset=0)
uint32 get_length (const uchar *ptr, uint packlength, bool low_byte_first)
uint32 get_length (const uchar *ptr_arg)
void put_length (uchar *pos, uint32 length)
void get_ptr (uchar **str)
void get_ptr (uchar **str, uint row_offset)
void set_ptr (uchar *length, uchar *data)
void set_ptr_offset (my_ptrdiff_t ptr_diff, uint32 length, uchar *data)
void set_ptr (uint32 length, uchar *data)
uint get_key_image (uchar *buff, uint length, imagetype type)
void set_key_image (const uchar *buff, uint length)
void sql_type (String &str) const
bool copy ()
Field_blobclone (MEM_ROOT *mem_root) const
Field_blobclone () const
virtual uchar * pack (uchar *to, const uchar *from, uint max_length, bool low_byte_first)
virtual const uchar * unpack (uchar *to, const uchar *from, uint param_data, bool low_byte_first)
uint packed_col_length (const uchar *col_ptr, uint length)
uint max_packed_col_length (uint max_length)
void free ()
void clear_temporary ()
bool has_charset (void) const
uint32 max_display_length ()
uint32 char_length ()
uint is_equal (Create_field *new_field)
bool in_read_set ()
bool in_write_set ()
- Public Member Functions inherited from Field_longstr
 Field_longstr (uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, const CHARSET_INFO *charset_arg)
type_conversion_status store_decimal (const my_decimal *d)
- Public Member Functions inherited from Field_str
 Field_str (uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, const CHARSET_INFO *charset)
Item_result result_type () const
Item_result numeric_context_result_type () const
uint decimals () const
void make_field (Send_field *field)
uint repertoire (void) const
const CHARSET_INFOcharset (void) const
void set_charset (const CHARSET_INFO *charset_arg)
enum Derivation derivation (void) const
virtual void set_derivation (enum Derivation derivation_arg)
bool binary () const
virtual bool str_needs_quotes ()
- 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_packed (longlong nr)
virtual type_conversion_status store_time (MYSQL_TIME *ltime, uint8 dec)
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 longlong val_time_temporal ()
virtual longlong val_date_temporal ()
longlong val_temporal_by_field_type ()
Stringval_str (String *str)
Stringval_int_as_str (String *val_buffer, my_bool unsigned_flag)
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_in_rec () const
virtual bool compatible_field_size (uint metadata, Relay_log_info *rli, uint16 mflags, int *order)
virtual uint pack_length_from_metadata (uint field_metadata)
virtual int save_field_metadata (uchar *first_byte)
virtual uint32 data_length ()
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 zero_pack () const
virtual enum_field_types real_type () const
virtual enum_field_types binlog_type () const
int cmp (const uchar *str)
virtual int cmp_offset (uint row_offset)
virtual int cmp_binary_offset (uint row_offset)
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 bool optimize_range (uint idx, uint part)
virtual bool can_be_compared_as_longlong () const
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)
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)
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)
uchar * pack (uchar *to, const uchar *from)
const uchar * unpack (uchar *to, const uchar *from)
uint offset (uchar *record)
void copy_from_tmp (int offset)
uint fill_cache_field (struct st_cache_field *copy)
virtual bool get_date (MYSQL_TIME *ltime, uint fuzzydate)
virtual bool get_time (MYSQL_TIME *ltime)
virtual const CHARSET_INFOcharset_for_protocol (void) const
virtual const CHARSET_INFOsort_charset (void) const
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)
longlong convert_decimal2longlong (const my_decimal *val, bool unsigned_flag, bool *has_overflow)
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)

Static Public Member Functions

static void store_length (uchar *i_ptr, uint i_packlength, uint32 i_number, bool low_byte_first)

Protected Member Functions

void store_ptr_and_length (const char *from, uint32 length)
- Protected Member Functions inherited from Field_longstr
type_conversion_status report_if_important_data (const char *ptr, const char *end, bool count_spaces) const
type_conversion_status check_string_copy_error (const char *well_formed_error_pos, const char *cannot_convert_error_pos, const char *from_end_pos, const char *end, bool count_spaces, const CHARSET_INFO *cs) const

Protected Attributes

uint packlength
String value

Friends

type_conversion_status field_conv (Field *to, Field *from)

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 }
- 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
- 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)

Detailed Description

Definition at line 3259 of file field.h.

Member Function Documentation

uint32 Field_blob::char_length ( )
virtual

maximum possible character length for blob.

This method is used in Item_field::set_field to calculate max_length for Item.

For example: CREATE TABLE t2 SELECT CONCAT(tinyblob_utf8_column) FROM t1; must create a "VARCHAR(255) CHARACTER SET utf8" column.

Returns
length

Reimplemented from Field.

Definition at line 10511 of file field.cc.

Field_blob* Field_blob::clone ( MEM_ROOT mem_root) const
inlinevirtual

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.

Definition at line 3436 of file field.h.

Field_blob* Field_blob::clone ( ) const
inlinevirtual

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.

Definition at line 3440 of file field.h.

uint32 Field_blob::get_packed_size ( const uchar *  ptr_arg,
bool  low_byte_first 
)
inline

Return the packed length plus the length of the data.

This is used to determine the size of the data plus the packed length portion in the row data.

Returns
The length in the row plus the size of the data.

Definition at line 3388 of file field.h.

uint Field_blob::is_equal ( Create_field new_field)
virtual

Whether a field being created is compatible with a existing one.

Used by the ALTER TABLE code to evaluate whether the new definition of a table is compatible with the old definition so that it can determine if data needs to be copied over (table data change).

Reimplemented from Field_str.

Definition at line 8229 of file field.cc.

Here is the call graph for this function:

void Field_blob::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.

Definition at line 8081 of file field.cc.

virtual uint32 Field_blob::max_data_length ( ) const
inlinevirtual

Get the maximum size of the data in packed format.

Returns
Maximum data length of the field when packed using the Field::pack() function.

Reimplemented from Field_longstr.

Definition at line 3356 of file field.h.

Here is the caller graph for this function:

uint32 Field_blob::max_display_length ( )
virtual

maximum possible display length for blob.

Returns
length

Reimplemented from Field_str.

Definition at line 10537 of file field.cc.

uchar * Field_blob::pack ( uchar *  to,
const uchar *  from,
uint  max_length,
bool  low_byte_first 
)
virtual

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from Field.

Definition at line 8146 of file field.cc.

uint32 Field_blob::pack_length_no_ptr ( ) const
inline

Return the packed length without the pointer size added.

This is used to determine the size of the actual data in the row buffer.

Returns
The length of the raw data itself without the pointer.

Definition at line 3352 of file field.h.

void Field_blob::put_length ( uchar *  pos,
uint32  length 
)

Put a blob length field into a record buffer.

Depending on the maximum length of a blob, its length field is put into 1 to 4 bytes. This is a property of the blob object, described by 'packlength'.

Parameters
posPointer into the record buffer.
lengthThe length value to put.

Definition at line 7689 of file field.cc.

type_conversion_status Field_blob::store ( double  nr)
virtual

Store double value in Field_string or Field_varstring.

Pretty prints double number into field_length characters buffer.

Parameters
nrnumber

Reimplemented from Field_str.

Definition at line 7849 of file field.cc.

void Field_blob::store_ptr_and_length ( const char *  from,
uint32  length 
)
inlineprotected

Store ptr and length.

Definition at line 3283 of file field.h.

const uchar * Field_blob::unpack ( uchar *  to,
const uchar *  from,
uint  param_data,
bool  low_byte_first 
)
virtual

Unpack a blob field from row data.

This method is used to unpack a blob field from a master whose size of the field is less than that of the slave. Note: This method is included to satisfy inheritance rules, but is not needed for blob fields. It simply is used as a pass-through to the original unpack() method for blob fields.

Parameters
toDestination of the data
fromSource of the data
param_dataTRUE if base types should be stored in little- endian format, FALSE if native format should be used.
Returns
New pointer into memory based on from + length of the data

Reimplemented from Field.

Definition at line 8190 of file field.cc.

Friends And Related Function Documentation

type_conversion_status field_conv ( Field to,
Field from 
)
friend

Simple quick field convert that is called on insert.

Definition at line 784 of file field_conv.cc.

Member Data Documentation

uint Field_blob::packlength
protected

The number of bytes used to represent the length of the blob.

Definition at line 3273 of file field.h.

String Field_blob::value
protected

The 'value'-object is a cache fronting the storage engine.

Definition at line 3278 of file field.h.


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