My Project
Public Member Functions | Public Attributes | Static Public Attributes
Field_varstring Class Reference
Inheritance diagram for Field_varstring:
Field_longstr Field_str Field

List of all members.

Public Member Functions

 Field_varstring (uchar *ptr_arg, uint32 len_arg, uint length_bytes_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, TABLE_SHARE *share, const CHARSET_INFO *cs)
 Field_varstring (uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, TABLE_SHARE *share, const CHARSET_INFO *cs)
enum_field_types type () const
bool match_collation_to_optimize_range () const
enum ha_base_keytype key_type () const
uint row_pack_length () const
bool zero_pack () const
type_conversion_status reset (void)
uint32 pack_length () const
uint32 key_length () const
uint32 sort_length () const
type_conversion_status store (const char *to, uint length, const CHARSET_INFO *charset)
type_conversion_status store (longlong nr, bool unsigned_val)
type_conversion_status store (double nr)
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)
void make_sort_key (uchar *buff, uint length)
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
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)
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)
uint packed_col_length (const uchar *to, uint length)
uint max_packed_col_length (uint max_length)
uint32 data_length ()
enum_field_types real_type () const
bool has_charset (void) const
Fieldnew_field (MEM_ROOT *root, TABLE *new_table, bool keep_type)
Fieldnew_key_field (MEM_ROOT *root, TABLE *new_table, uchar *new_ptr, uchar *new_null_ptr, uint new_null_bit)
Field_varstringclone (MEM_ROOT *mem_root) const
Field_varstringclone () const
uint is_equal (Create_field *new_field)
void hash (ulong *nr, ulong *nr2)

Public Attributes

uint32 length_bytes

Static Public Attributes

static const uint MAX_SIZE = UINT_MAX16

Member Function Documentation

Field_varstring* Field_varstring::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_varstring* Field_varstring::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.

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

int Field_varstring::key_cmp ( const uchar *  a,
const uchar *  b 
) [virtual]

Compare to key segments (always 2 byte length prefix).

Note:
This is used only to compare key segments created for index_read(). (keys are created and compared in key.cc)

Reimplemented from Field.

int Field_varstring::key_cmp ( const uchar *  key_ptr,
uint  max_key_length 
) [virtual]
Note:
varstring and blob keys are ALWAYS stored with a 2 byte length prefix

Reimplemented from Field.

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

uchar * Field_varstring::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.

type_conversion_status Field_varstring::store ( double  nr) [inline, 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.

const uchar * Field_varstring::unpack ( uchar *  to,
const uchar *  from,
uint  param_data,
bool  low_byte_first 
) [virtual]

Unpack a varstring field from row data.

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

Note:
The string length is always packed little-endian.
Parameters:
toDestination of the data
fromSource of the data
param_dataLength bytes from the master's field data
Returns:
New pointer into memory based on from + length of the data

Reimplemented from Field.


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