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

List of all members.

Public Member Functions

 Field_string (uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg, const CHARSET_INFO *cs)
 Field_string (uint32 len_arg, bool maybe_null_arg, const char *field_name_arg, const CHARSET_INFO *cs)
enum_field_types type () const
bool match_collation_to_optimize_range () const
enum ha_base_keytype key_type () const
bool zero_pack () const
type_conversion_status reset (void)
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 (const uchar *, const uchar *)
void make_sort_key (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)
uint pack_length_from_metadata (uint field_metadata)
bool compatible_field_size (uint field_metadata, Relay_log_info *rli, uint16 mflags, int *order_var)
uint row_pack_length () const
int pack_cmp (const uchar *a, const uchar *b, uint key_length, my_bool insert_or_update)
int pack_cmp (const uchar *b, uint key_length, my_bool insert_or_update)
uint packed_col_length (const uchar *to, uint length)
uint max_packed_col_length (uint max_length)
enum_field_types real_type () const
bool has_charset (void) const
Fieldnew_field (MEM_ROOT *root, TABLE *new_table, bool keep_type)
Field_stringclone (MEM_ROOT *mem_root) const
Field_stringclone () const
virtual uint get_key_image (uchar *buff, uint length, imagetype type)

Public Attributes

bool can_alter_field_type

Member Function Documentation

Field_string* Field_string::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_string* Field_string::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.

bool Field_string::compatible_field_size ( uint  metadata,
Relay_log_info rli,
uint16  mflags,
int *  order 
) [virtual]

Check to see if field size is compatible with destination.

This method is used in row-based replication to verify that the slave's field size is less than or equal to the master's field size. The encoded field metadata (from the master or source) is decoded and compared to the size of this field (the slave or destination).

Note:

The comparison is made so that if the source data (from the master) is less than the target data (on the slave), -1 is returned in *order_var. This implies that a conversion is necessary, but that it is lossy and can result in truncation of the value.

If the source data is strictly greater than the target data, 1 is returned in *order_var. This implies that the source type can is contained in the target type and that a conversion is necessary but is non-lossy.

If no conversion is required to fit the source type in the target type, 0 is returned in *order_var.

Parameters:
field_metadataEncoded size in field metadata
mflagsFlags from the table map event for the table.
order_varPointer to variable where the order between the source field and this field will be returned.
Returns:
true if this field's size is compatible with the master's field size, false otherwise.

Reimplemented from Field.

void Field_string::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_string::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_string::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_string::unpack ( uchar *  to,
const uchar *  from,
uint  param_data,
bool  low_byte_first 
) [virtual]

Unpack a string field from row data.

This method is used to unpack a string field from a master whose size of the field is less than that of the slave. Note that there can be a variety of field types represented with this class. Certain types like ENUM or SET are processed differently. Hence, the upper byte of the param_data argument contains the result of field->real_type() from the master.

Note:
For information about how the length is packed, see Field_string::do_save_field_metadata
Parameters:
toDestination of the data
fromSource of the data
param_dataReal type (upper) and length (lower) values
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