drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
drizzled::Field_blob Class Reference

#include <blob.h>

Inheritance diagram for drizzled::Field_blob:
[legend]
Collaboration diagram for drizzled::Field_blob:
[legend]

Public Member Functions

 Field_blob (unsigned char *ptr_arg, unsigned char *null_ptr_arg, unsigned char null_bit_arg, const char *field_name_arg, TableShare *share, const charset_info_st *const cs)
 Field_blob (uint32_t len_arg, bool maybe_null_arg, const char *field_name_arg, const charset_info_st *const cs)
enum_field_types type () const
enum ha_base_keytype key_type () const
int store (const char *to, uint32_t length, const charset_info_st *const charset)
int store (double nr)
int store (int64_t nr, bool unsigned_val)
double val_real (void) const
int64_t val_int (void) const
String * val_str (String *, String *) const
type::Decimal * val_decimal (type::Decimal *) const
int cmp_max (const unsigned char *, const unsigned char *, uint32_t max_length)
int cmp (const unsigned char *a, const unsigned char *b)
int cmp (const unsigned char *a, uint32_t a_length, const unsigned char *b, uint32_t b_length)
int cmp_binary (const unsigned char *a, const unsigned char *b, uint32_t max_length=UINT32_MAX)
int key_cmp (const unsigned char *, const unsigned char *)
int key_cmp (const unsigned char *str, uint32_t length)
uint32_t key_length () const
void sort_string (unsigned char *buff, uint32_t length)
uint32_t pack_length () const
uint32_t pack_length_no_ptr () const
uint32_t sort_length () const
virtual uint32_t max_data_length () const
int reset (void)
void reset_fields ()
void store_length (unsigned char *i_ptr, uint32_t i_number)
void store_length (uint32_t number)
uint32_t get_packed_size (const unsigned char *ptr_arg, bool low_byte_first)
DRIZZLED_API uint32_t get_length (uint32_t row_offset=0) const
DRIZZLED_API uint32_t get_length (const unsigned char *ptr, bool low_byte_first) const
DRIZZLED_API uint32_t get_length (const unsigned char *ptr_arg) const
void put_length (unsigned char *pos, uint32_t length)
unsigned char * get_ptr () const
void set_ptr (unsigned char *length, unsigned char *data)
void set_ptr_offset (ptrdiff_t ptr_diff, uint32_t length, unsigned char *data)
void set_ptr (uint32_t length, unsigned char *data)
uint32_t get_key_image (unsigned char *buff, uint32_t length)
uint32_t get_key_image (std::basic_string< unsigned char > &buff, uint32_t length)
void set_key_image (const unsigned char *buff, uint32_t length)
void copy ()
virtual unsigned char * pack (unsigned char *to, const unsigned char *from, uint32_t max_length, bool low_byte_first)
unsigned char * pack_key (unsigned char *to, const unsigned char *from, uint32_t max_length, bool low_byte_first)
virtual const unsigned char * unpack (unsigned char *to, const unsigned char *from, uint32_t, bool low_byte_first)
void free ()
uint32_t size_of () const
bool has_charset (void) const
uint32_t max_display_length ()
unsigned char * pack (unsigned char *to, const unsigned char *from)
const unsigned char * unpack (unsigned char *to, const unsigned char *from)
Public Member Functions inherited from drizzled::Field_str
 Field_str (unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg, unsigned char null_bit_arg, const char *field_name_arg, const charset_info_st *const charset)
Item_result result_type () const
uint32_t decimals () const
int store (double nr)
int store_decimal (const type::Decimal *)
uint32_t size_of () const
const charset_info_st * charset (void) const
void set_charset (const charset_info_st *const charset_arg)
enum Derivation derivation (void) const
virtual void set_derivation (enum Derivation derivation_arg)
bool binary () const
uint32_t max_display_length ()
type::Decimal * val_decimal (type::Decimal *) const
virtual bool str_needs_quotes ()
uint32_t max_data_length () const
Public Member Functions inherited from drizzled::Field
Table * getTable ()
Table * getTable () const
void setTable (Table *table_arg)
bool isUnsigned () const
uint16_t position () const
void setPosition (uint32_t arg)
 Field (unsigned char *ptr_arg, uint32_t length_arg, unsigned char *null_ptr_arg, unsigned char 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.
bool hasDefault () const
int store_and_check (enum_check_fields check_level, const char *to, uint32_t length, const charset_info_st *const cs)
virtual int store_time (type::Time &ltime, type::timestamp_t t_type)
String * val_str_internal (String *str) const
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 bool is_timestamp () const
virtual uint32_t pack_length_in_rec () const
virtual uint32_t data_length ()
virtual uint32_t used_length ()
virtual void set_default ()
virtual bool zero_pack () const
virtual enum_field_types real_type () const
int cmp_internal (const unsigned char *str)
virtual int cmp_offset (uint32_t row_offset)
virtual int cmp_binary_offset (uint32_t row_offset)
bool is_null (ptrdiff_t row_offset=0) const
bool is_real_null (ptrdiff_t row_offset=0) const
bool is_null_in_record (const unsigned char *record) const
bool is_null_in_record_with_offset (ptrdiff_t offset) const
void set_null (ptrdiff_t row_offset=0)
void set_notnull (ptrdiff_t row_offset=0)
bool maybe_null (void) const
bool real_maybe_null (void) const
virtual void make_field (SendField *)
virtual bool optimize_range (uint32_t idx, uint32_t part)
virtual bool can_be_compared_as_int64_t () const
virtual Field * new_field (memory::Root *, Table *, bool keep_type)
virtual Field * new_key_field (memory::Root *root, Table *new_table, unsigned char *new_ptr, unsigned char *new_null_ptr, uint32_t new_null_bit)
Field * clone (memory::Root *, Table *)
void move_field (unsigned char *ptr_arg, unsigned char *null_ptr_arg, unsigned char null_bit_arg)
void move_field (unsigned char *ptr_arg)
virtual void move_field_offset (ptrdiff_t ptr_diff)
virtual void get_image (unsigned char *buff, uint32_t length, const charset_info_st *const)
virtual void get_image (std::basic_string< unsigned char > &buff, uint32_t length, const charset_info_st *const)
virtual void set_image (const unsigned char *buff, uint32_t length, const charset_info_st *const)
int64_t val_int_offset (uint32_t row_offset)
int64_t val_int_internal (const unsigned char *new_ptr)
String * val_str_internal (String *str, const unsigned char *new_ptr)
unsigned char * pack (unsigned char *to, const unsigned char *from)
const unsigned char * unpack (unsigned char *to, const unsigned char *from)
virtual const unsigned char * unpack_key (unsigned char *to, const unsigned char *from, uint32_t max_length, bool low_byte_first)
virtual uint32_t max_packed_col_length (uint32_t max_length)
uint32_t offset (const unsigned char *record)
void copy_from_tmp (int offset)
uint32_t fill_cache_field (CacheField *copy)
virtual bool get_date (type::Time &ltime, uint32_t fuzzydate) const
virtual bool get_time (type::Time &ltime) const
virtual const charset_info_st * sort_charset (void) const
bool set_warning (DRIZZLE_ERROR::enum_warning_level, drizzled::error_t code, int cuted_increment)
void set_datetime_warning (DRIZZLE_ERROR::enum_warning_level, drizzled::error_t code, const char *str, uint32_t str_len, type::timestamp_t ts_type, int cuted_increment)
void set_datetime_warning (DRIZZLE_ERROR::enum_warning_level, drizzled::error_t code, int64_t nr, type::timestamp_t ts_type, int cuted_increment)
void set_datetime_warning (DRIZZLE_ERROR::enum_warning_level, const drizzled::error_t code, double nr, type::timestamp_t ts_type)
bool check_overflow (int op_result)
int warn_if_overflow (int op_result)
void init (Table *table_arg)
virtual uint32_t is_equal (CreateField *new_field)
int64_t convert_decimal2int64_t (const type::Decimal *val, bool unsigned_flag, int *err)
uint32_t char_length () const
enum column_format_type column_format () const
virtual void hash (uint32_t *nr, uint32_t *nr2) const
bool isReadSet () const
bool isWriteSet ()
void setReadSet (bool arg=true)
void setWriteSet (bool arg=true)

Static Public Member Functions

static void store_length (unsigned char *i_ptr, uint32_t i_number, bool low_byte_first)
Static Public Member Functions inherited from drizzled::Field
static void * operator new (size_t size)
static void * operator new (size_t size, memory::Root *mem_root)
static void operator delete (void *, size_t)
static void operator delete (void *, memory::Root *)
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 Attributes

String value
Protected Attributes inherited from drizzled::Field_str
const charset_info_st * field_charset
enum Derivation field_derivation

Friends

int field_conv (Field *to, Field *from)

Additional Inherited Members

Public Types inherited from drizzled::Field
enum  utype {
  NONE , NEXT_NUMBER , TIMESTAMP_OLD_FIELD , TIMESTAMP_DN_FIELD ,
  TIMESTAMP_UN_FIELD , TIMESTAMP_DNUN_FIELD
}
Public Attributes inherited from drizzled::Field
unsigned char * ptr
unsigned char * null_ptr
Table * orig_table
const char * field_name
str_ref 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_t field_length
uint32_t flags
unsigned char null_bit
bool is_created_from_null_item
Protected Member Functions inherited from drizzled::Field_str
int report_if_important_data (const char *ptr, const char *end)
Protected Member Functions inherited from drizzled::Field
void pack_num (uint64_t arg, unsigned char *destination=NULL)
void pack_num (uint32_t arg, unsigned char *destination=NULL)
uint64_t unpack_num (uint64_t &destination, const unsigned char *arg=NULL) const
uint32_t unpack_num (uint32_t &destination, const unsigned char *arg=NULL) const

Detailed Description

Class representing a BLOB data type column

Definition at line 34 of file blob.h.

Constructor & Destructor Documentation

◆ Field_blob() [1/2]

drizzled::Field_blob::Field_blob ( unsigned char * ptr_arg,
unsigned char * null_ptr_arg,
unsigned char null_bit_arg,
const char * field_name_arg,
TableShare * share,
const charset_info_st *const cs )

Definition at line 49 of file blob.cc.

◆ Field_blob() [2/2]

drizzled::Field_blob::Field_blob ( uint32_t len_arg,
bool maybe_null_arg,
const char * field_name_arg,
const charset_info_st *const cs )
inline

Definition at line 54 of file blob.h.

Member Function Documentation

◆ cmp() [1/2]

int drizzled::Field_blob::cmp ( const unsigned char * a,
const unsigned char * b )
inlinevirtual

Implements drizzled::Field.

Definition at line 81 of file blob.h.

◆ cmp() [2/2]

int drizzled::Field_blob::cmp ( const unsigned char * a,
uint32_t a_length,
const unsigned char * b,
uint32_t b_length )

Definition at line 288 of file blob.cc.

◆ cmp_binary()

int drizzled::Field_blob::cmp_binary ( const unsigned char * a,
const unsigned char * b,
uint32_t max_length = UINT32_MAX )
virtual

Reimplemented from drizzled::Field.

Definition at line 310 of file blob.cc.

◆ cmp_max()

int drizzled::Field_blob::cmp_max ( const unsigned char * a_ptr,
const unsigned char * b_ptr,
uint32_t max_length )
virtual

Reimplemented from drizzled::Field.

Definition at line 297 of file blob.cc.

◆ copy()

void drizzled::Field_blob::copy ( )
inline

Definition at line 163 of file blob.h.

◆ free()

void drizzled::Field_blob::free ( )
inlinevirtual

Reimplemented from drizzled::Field.

Definition at line 172 of file blob.h.

◆ get_key_image() [1/2]

uint32_t drizzled::Field_blob::get_key_image ( std::basic_string< unsigned char > & buff,
uint32_t length )
virtual

Reimplemented from drizzled::Field.

Definition at line 358 of file blob.cc.

◆ get_key_image() [2/2]

uint32_t drizzled::Field_blob::get_key_image ( unsigned char * buff,
uint32_t length )
virtual

Copy a field part into an output buffer.

This function makes a copy of field part of size equal to or less than "length" parameter value. For fields of string types (VARCHAR, TEXT) the rest of buffer is padded by zero byte.

Parameters
outputbuffer
outputbuffer size
Note

For variable length character fields (i.e. UTF-8) the "length" parameter means a number of output buffer bytes as if all field characters have maximal possible size (mbmaxlen). In the other words, "length" parameter is a number of characters multiplied by field_charset->mbmaxlen.

Return values
Numberof copied bytes (excluding padded zero bytes – see above).

Reimplemented from drizzled::Field.

Definition at line 335 of file blob.cc.

◆ get_length() [1/3]

uint32_t drizzled::Field_blob::get_length ( const unsigned char * ptr,
bool low_byte_first ) const

Definition at line 92 of file blob.cc.

◆ get_length() [2/3]

uint32_t drizzled::Field_blob::get_length ( const unsigned char * ptr_arg) const

Definition at line 123 of file blob.cc.

◆ get_length() [3/3]

uint32_t drizzled::Field_blob::get_length ( uint32_t row_offset = 0) const

Definition at line 116 of file blob.cc.

◆ get_packed_size()

uint32_t drizzled::Field_blob::get_packed_size ( const unsigned char * ptr_arg,
bool low_byte_first )

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 109 of file blob.cc.

◆ get_ptr()

unsigned char * drizzled::Field_blob::get_ptr ( ) const
inline

Definition at line 139 of file blob.h.

◆ has_charset()

bool drizzled::Field_blob::has_charset ( void ) const
inlinevirtual

Reimplemented from drizzled::Field.

Definition at line 175 of file blob.h.

◆ key_cmp() [1/2]

int drizzled::Field_blob::key_cmp ( const unsigned char * a,
const unsigned char * b )
virtual

Reimplemented from drizzled::Field.

Definition at line 405 of file blob.cc.

◆ key_cmp() [2/2]

int drizzled::Field_blob::key_cmp ( const unsigned char * str,
uint32_t length )
virtual

Reimplemented from drizzled::Field.

Definition at line 390 of file blob.cc.

◆ key_length()

uint32_t drizzled::Field_blob::key_length ( ) const
inlinevirtual

Reimplemented from drizzled::Field.

Definition at line 87 of file blob.h.

◆ key_type()

enum ha_base_keytype drizzled::Field_blob::key_type ( ) const
inlinevirtual

Reimplemented from drizzled::Field.

Definition at line 69 of file blob.h.

◆ max_data_length()

virtual uint32_t drizzled::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 drizzled::Field.

Definition at line 104 of file blob.h.

◆ max_display_length()

uint32_t drizzled::Field_blob::max_display_length ( )
virtual

maximum possible display length for blob.

Returns
length

Implements drizzled::Field.

Definition at line 539 of file blob.cc.

◆ pack() [1/2]

unsigned char * drizzled::Field::pack ( unsigned char * to,
const unsigned char * from )

Definition at line 505 of file field.cc.

◆ pack() [2/2]

unsigned char * drizzled::Field_blob::pack ( unsigned char * to,
const unsigned char * from,
uint32_t max_length,
bool low_byte_first )
virtual

Pack the field into a format suitable for storage and transfer.

To implement packing functionality, only the virtual function should be overridden. The other functions are just convenience functions and hence should not be overridden.

The value of low_byte_first is dependent on how the packed data is going to be used: for local use, e.g., temporary store on disk or in memory, use the native format since that is faster. For data that is going to be transfered to other machines (e.g., when writing data to the binary log), data should always be stored in little-endian format.

Note
The default method for packing fields just copy the raw bytes of the record into the destination, but never more than max_length characters.
Parameters
toPointer to memory area where representation of field should be put.
fromPointer to memory area where record representation of field is stored.
max_lengthMaximum length of the field, as given in the column definition. For example, for CHAR(1000), the max_length is 1000. This information is sometimes needed to decide how to pack the data.
low_byte_firsttrue if integers should be stored little-endian, false if native format should be used. Note that for little-endian machines, the value of this flag is a moot point since the native format is little-endian.

Reimplemented from drizzled::Field.

Definition at line 450 of file blob.cc.

◆ pack_key()

unsigned char * drizzled::Field_blob::pack_key ( unsigned char * to,
const unsigned char * from,
uint32_t max_length,
bool low_byte_first )
virtual

Create a packed key that will be used for storage from a MySQL row.

Reimplemented from drizzled::Field.

Definition at line 509 of file blob.cc.

◆ pack_length()

uint32_t drizzled::Field_blob::pack_length ( ) const
virtual

Returns size (in bytes) used to store field data in memory (i.e. it returns the maximum size of the field in a row of the table, which is located in RAM).

Reimplemented from drizzled::Field.

Definition at line 445 of file blob.cc.

◆ pack_length_no_ptr()

uint32_t drizzled::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 100 of file blob.h.

◆ put_length()

void drizzled::Field_blob::put_length ( unsigned char * pos,
uint32_t length )

Put a blob length field into a record buffer.

Blob length is always stored in sizeof(uint32_t) (4 bytes)

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

Definition at line 138 of file blob.cc.

◆ reset()

int drizzled::Field_blob::reset ( void )
inlinevirtual

Reimplemented from drizzled::Field.

Definition at line 108 of file blob.h.

◆ reset_fields()

void drizzled::Field_blob::reset_fields ( )
inlinevirtual

Reimplemented from drizzled::Field.

Definition at line 109 of file blob.h.

◆ set_key_image()

void drizzled::Field_blob::set_key_image ( const unsigned char * buff,
uint32_t length )
virtual

Reimplemented from drizzled::Field.

Definition at line 384 of file blob.cc.

◆ set_ptr() [1/2]

void drizzled::Field_blob::set_ptr ( uint32_t length,
unsigned char * data )
inline

Definition at line 156 of file blob.h.

◆ set_ptr() [2/2]

void drizzled::Field_blob::set_ptr ( unsigned char * length,
unsigned char * data )
inline

Definition at line 145 of file blob.h.

◆ set_ptr_offset()

void drizzled::Field_blob::set_ptr_offset ( ptrdiff_t ptr_diff,
uint32_t length,
unsigned char * data )
inline

Definition at line 150 of file blob.h.

◆ size_of()

uint32_t drizzled::Field_blob::size_of ( ) const
inlinevirtual

Implements drizzled::Field.

Definition at line 174 of file blob.h.

◆ sort_length()

uint32_t drizzled::Field_blob::sort_length ( ) const
virtual

Reimplemented from drizzled::Field.

Definition at line 411 of file blob.cc.

◆ sort_string()

void drizzled::Field_blob::sort_string ( unsigned char * buff,
uint32_t length )
virtual

Implements drizzled::Field.

Definition at line 417 of file blob.cc.

◆ store() [1/3]

int drizzled::Field_blob::store ( const char * to,
uint32_t length,
const charset_info_st *const charset )
virtual

Implements drizzled::Field_str.

Definition at line 144 of file blob.cc.

◆ store() [2/3]

int drizzled::Field_blob::store ( double nr)
virtual

Implements drizzled::Field.

Definition at line 200 of file blob.cc.

◆ store() [3/3]

int drizzled::Field_blob::store ( int64_t nr,
bool unsigned_val )
virtual

Implements drizzled::Field_str.

Definition at line 208 of file blob.cc.

◆ store_length() [1/3]

void drizzled::Field_blob::store_length ( uint32_t number)
inline

Definition at line 120 of file blob.h.

◆ store_length() [2/3]

void drizzled::Field_blob::store_length ( unsigned char * i_ptr,
uint32_t i_number )

Definition at line 86 of file blob.cc.

◆ store_length() [3/3]

void drizzled::Field_blob::store_length ( unsigned char * i_ptr,
uint32_t i_number,
bool low_byte_first )
static

Definition at line 67 of file blob.cc.

◆ type()

enum_field_types drizzled::Field_blob::type ( ) const
inlinevirtual

Implements drizzled::Field.

Definition at line 68 of file blob.h.

◆ unpack() [1/2]

const unsigned char * drizzled::Field::unpack ( unsigned char * to,
const unsigned char * from )

Definition at line 545 of file field.cc.

◆ unpack() [2/2]

const unsigned char * drizzled::Field_blob::unpack ( unsigned char * to,
const unsigned char * from,
uint32_t ,
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 drizzled::Field.

Definition at line 494 of file blob.cc.

◆ val_decimal()

type::Decimal * drizzled::Field_blob::val_decimal ( type::Decimal * decimal_value) const
virtual

Reimplemented from drizzled::Field.

Definition at line 264 of file blob.cc.

◆ val_int()

int64_t drizzled::Field_blob::val_int ( void ) const
virtual

Implements drizzled::Field.

Definition at line 235 of file blob.cc.

◆ val_real()

double drizzled::Field_blob::val_real ( void ) const
virtual

Implements drizzled::Field.

Definition at line 217 of file blob.cc.

◆ val_str()

String * drizzled::Field_blob::val_str ( String * ,
String * val_ptr ) const
virtual

Implements drizzled::Field.

Definition at line 249 of file blob.cc.

◆ field_conv

int field_conv ( Field * to,
Field * from )
friend

Simple quick field convert that is called on insert.

Definition at line 795 of file field_conv.cc.

Member Data Documentation

◆ value

String drizzled::Field_blob::value
protected

Definition at line 38 of file blob.h.


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