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

#include <field.h>

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

Public Types

enum  utype {
  NONE , NEXT_NUMBER , TIMESTAMP_OLD_FIELD , TIMESTAMP_DN_FIELD ,
  TIMESTAMP_UN_FIELD , TIMESTAMP_DNUN_FIELD
}

Public Member Functions

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
virtual int store (const char *to, uint32_t length, const charset_info_st *const cs)=0
virtual int store (double nr)=0
virtual int store (int64_t nr, bool unsigned_val)=0
virtual int store_decimal (const type::Decimal *d)=0
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)
virtual double val_real () const =0
virtual int64_t val_int () const =0
virtual type::Decimal * val_decimal (type::Decimal *) const
String * val_str_internal (String *str) const
virtual String * val_str (String *, String *) const =0
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 bool is_timestamp () const
virtual uint32_t pack_length () const
virtual uint32_t pack_length_in_rec () const
virtual uint32_t data_length ()
virtual uint32_t used_length ()
virtual uint32_t sort_length () const
virtual uint32_t max_data_length () const
virtual int 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_t key_length () const
virtual enum_field_types type () const =0
virtual enum_field_types real_type () const
virtual int cmp_max (const unsigned char *a, const unsigned char *b, uint32_t max_len)
virtual int cmp (const unsigned char *, const unsigned char *)=0
int cmp_internal (const unsigned char *str)
virtual int cmp_binary (const unsigned char *a, const unsigned char *b, uint32_t max_length=UINT32_MAX)
virtual int cmp_offset (uint32_t row_offset)
virtual int cmp_binary_offset (uint32_t row_offset)
virtual int key_cmp (const unsigned char *a, const unsigned char *b)
virtual int key_cmp (const unsigned char *str, uint32_t length)
virtual uint32_t decimals () const
virtual uint32_t size_of () const =0
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 void sort_string (unsigned char *buff, uint32_t length)=0
virtual bool optimize_range (uint32_t idx, uint32_t part)
virtual bool can_be_compared_as_int64_t () const
virtual void free ()
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)
virtual uint32_t get_key_image (unsigned char *buff, uint32_t length)
virtual uint32_t get_key_image (std::basic_string< unsigned char > &buff, uint32_t length)
virtual void set_key_image (const unsigned char *buff, uint32_t length)
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)
virtual unsigned char * pack (unsigned char *to, const unsigned char *from, uint32_t max_length, bool low_byte_first)
unsigned char * pack (unsigned char *to, const unsigned char *from)
virtual const unsigned char * unpack (unsigned char *to, const unsigned char *from, uint32_t param_data, bool low_byte_first)
const unsigned char * unpack (unsigned char *to, const unsigned char *from)
virtual unsigned char * pack_key (unsigned char *to, const unsigned char *from, uint32_t max_length, bool low_byte_first)
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 * charset (void) const
virtual const charset_info_st * sort_charset (void) const
virtual bool has_charset (void) const
virtual void set_charset (const charset_info_st *const)
virtual enum Derivation derivation (void) const
virtual void set_derivation (enum Derivation)
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 max_display_length ()=0
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 * 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)

Public Attributes

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

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

Private Attributes

Table * table
uint16_t field_index

Friends

class CopyField
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 (Session *, Table *, bool)

Detailed Description

Class representing a Field in a Table

The value stored in the Field object is stored in the unsigned char pointer member variable called ptr. The val_xxx() methods retrieve this raw byte value and convert the byte into the appropriate output (int, decimal, etc).

The store_xxx() methods take various input and convert the input into the raw bytes stored in the ptr member variable.

Definition at line 70 of file field.h.

Member Enumeration Documentation

◆ utype

enum drizzled::Field::utype

Definition at line 120 of file field.h.

Constructor & Destructor Documentation

◆ Field()

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

Definition at line 892 of file field.cc.

◆ ~Field()

virtual drizzled::Field::~Field ( )
inlinevirtual

Definition at line 178 of file field.h.

Member Function Documentation

◆ binary()

bool drizzled::Field::binary ( ) const
virtual

Definition at line 757 of file field.cc.

◆ can_be_compared_as_int64_t()

virtual bool drizzled::Field::can_be_compared_as_int64_t ( ) const
inlinevirtual

Returns true for fields which, when compared with constant items, can be casted to int64_t. In this case we will at 'fix_fields' stage cast the constant items to int64_ts and at the execution stage use field->val_int() for comparison. Used to optimize clauses like 'a_column BETWEEN date_const AND date_const'.

Reimplemented in drizzled::field::Boolean, drizzled::field::Epoch, drizzled::field::Int64, drizzled::field::Microtime, drizzled::field::Size, drizzled::field::Time, drizzled::Field_date, and drizzled::Field_datetime.

Definition at line 361 of file field.h.

◆ cast_to_int_type()

virtual Item_result drizzled::Field::cast_to_int_type ( ) const
inlinevirtual

Definition at line 232 of file field.h.

◆ char_length()

uint32_t drizzled::Field::char_length ( ) const
inline

Definition at line 703 of file field.h.

◆ charset()

virtual const charset_info_st * drizzled::Field::charset ( void ) const
inlinevirtual

Definition at line 575 of file field.h.

◆ check_overflow()

bool drizzled::Field::check_overflow ( int op_result)
inline

Definition at line 665 of file field.h.

◆ clone()

Field * drizzled::Field::clone ( memory::Root * root,
Table * new_table )

This is used to generate a field in Table from TableShare

Definition at line 1133 of file field.cc.

◆ cmp_binary()

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

Definition at line 787 of file field.cc.

◆ cmp_binary_offset()

int drizzled::Field::cmp_binary_offset ( uint32_t row_offset)
virtual

Definition at line 797 of file field.cc.

◆ cmp_internal()

int drizzled::Field::cmp_internal ( const unsigned char * str)
inline

Definition at line 330 of file field.h.

◆ cmp_max()

int drizzled::Field::cmp_max ( const unsigned char * a,
const unsigned char * b,
uint32_t max_len )
virtual

Definition at line 782 of file field.cc.

◆ cmp_offset()

int drizzled::Field::cmp_offset ( uint32_t row_offset)
virtual

Definition at line 792 of file field.cc.

◆ cmp_type()

virtual Item_result drizzled::Field::cmp_type ( ) const
inlinevirtual

Definition at line 231 of file field.h.

◆ column_format()

enum column_format_type drizzled::Field::column_format ( ) const
inline

Definition at line 708 of file field.h.

◆ convert_decimal2int64_t()

int64_t drizzled::Field::convert_decimal2int64_t ( const type::Decimal * val,
bool unsigned_flag,
int * err )

Conversion from decimal to int64_t with checking overflow and setting correct value (min/max) in case of overflow.

Parameters
valvalue which have to be converted
unsigned_flagtype of integer in which we convert val
errvariable to pass error code
Returns
value converted from val

Definition at line 1040 of file field.cc.

◆ copy_from_tmp()

void drizzled::Field::copy_from_tmp ( int offset)

Definition at line 930 of file field.cc.

◆ data_length()

uint32_t drizzled::Field::data_length ( )
virtual

Return the "real size" of the data in memory. For varstrings, this does not include the length bytes.

Definition at line 717 of file field.cc.

◆ decimals()

uint32_t drizzled::Field::decimals ( ) const
virtual

Definition at line 812 of file field.cc.

◆ derivation()

virtual enum Derivation drizzled::Field::derivation ( void ) const
inlinevirtual

Definition at line 580 of file field.h.

◆ eq()

bool drizzled::Field::eq ( Field * field)
virtual

Definition at line 701 of file field.cc.

◆ eq_def()

bool drizzled::Field::eq_def ( Field * field)
virtual

Returns true if the fields are equally defined

Return values
trueThis Field is equally defined to supplied Field
falseThis Field is NOT equally defined to supplied Field

Reimplemented in drizzled::Field_enum, and drizzled::Field_num.

Definition at line 1146 of file field.cc.

◆ field_type_merge()

enum_field_types drizzled::Field::field_type_merge ( enum_field_types a,
enum_field_types b )
static

Return type of which can carry value of both given types in UNION result.

Parameters
atype for merging
btype for merging
Return values
typeof field

Definition at line 687 of file field.cc.

◆ fill_cache_field()

uint32_t drizzled::Field::fill_cache_field ( CacheField * copy)

Definition at line 1053 of file field.cc.

◆ free()

virtual void drizzled::Field::free ( )
inlinevirtual

Definition at line 365 of file field.h.

◆ get_date()

bool drizzled::Field::get_date ( type::Time & ltime,
uint32_t fuzzydate ) const
virtual

Definition at line 1074 of file field.cc.

◆ get_image() [1/2]

virtual void drizzled::Field::get_image ( std::basic_string< unsigned char > & buff,
uint32_t length,
const charset_info_st * const  )
inlinevirtual

Definition at line 390 of file field.h.

◆ get_image() [2/2]

virtual void drizzled::Field::get_image ( unsigned char * buff,
uint32_t length,
const charset_info_st * const  )
inlinevirtual

Definition at line 386 of file field.h.

◆ get_key_image() [1/2]

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

Definition at line 428 of file field.h.

◆ get_key_image() [2/2]

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

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 in drizzled::Field_blob, and drizzled::Field_varstring.

Definition at line 423 of file field.h.

◆ get_time()

bool drizzled::Field::get_time ( type::Time & ltime) const
virtual

Definition at line 1085 of file field.cc.

◆ getTable() [1/2]

Table * drizzled::Field::getTable ( )
inline

Definition at line 86 of file field.h.

◆ getTable() [2/2]

Table * drizzled::Field::getTable ( ) const
inline

Definition at line 92 of file field.h.

◆ has_charset()

virtual bool drizzled::Field::has_charset ( void ) const
inlinevirtual

Definition at line 577 of file field.h.

◆ hasDefault()

bool drizzled::Field::hasDefault ( ) const
inline

Definition at line 180 of file field.h.

◆ hash()

void drizzled::Field::hash ( uint32_t * nr,
uint32_t * nr2 ) const
virtual

Definition at line 916 of file field.cc.

◆ init()

void drizzled::Field::init ( Table * table_arg)

Definition at line 886 of file field.cc.

◆ is_equal()

uint32_t drizzled::Field::is_equal ( CreateField * new_field)
virtual

Definition at line 1141 of file field.cc.

◆ is_null()

bool drizzled::Field::is_null ( ptrdiff_t row_offset = 0) const

Definition at line 817 of file field.cc.

◆ is_null_in_record()

bool drizzled::Field::is_null_in_record ( const unsigned char * record) const

Definition at line 827 of file field.cc.

◆ is_null_in_record_with_offset()

bool drizzled::Field::is_null_in_record_with_offset ( ptrdiff_t offset) const

Definition at line 832 of file field.cc.

◆ is_real_null()

bool drizzled::Field::is_real_null ( ptrdiff_t row_offset = 0) const

Definition at line 822 of file field.cc.

◆ is_timestamp()

virtual bool drizzled::Field::is_timestamp ( ) const
inlinevirtual

Definition at line 280 of file field.h.

◆ isReadSet()

bool drizzled::Field::isReadSet ( ) const

Definition at line 1286 of file field.cc.

◆ isUnsigned()

bool drizzled::Field::isUnsigned ( ) const
inline

Definition at line 134 of file field.h.

◆ isWriteSet()

bool drizzled::Field::isWriteSet ( )

Definition at line 1291 of file field.cc.

◆ key_cmp() [1/2]

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

Reimplemented in drizzled::Field_varstring.

Definition at line 802 of file field.cc.

◆ key_cmp() [2/2]

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

Reimplemented in drizzled::Field_varstring.

Definition at line 807 of file field.cc.

◆ key_length()

uint32_t drizzled::Field::key_length ( ) const
virtual

Definition at line 772 of file field.cc.

◆ key_type()

enum ha_base_keytype drizzled::Field::key_type ( ) const
virtual

Definition at line 767 of file field.cc.

◆ make_field()

void drizzled::Field::make_field ( SendField * field)
virtual

Definition at line 1013 of file field.cc.

◆ max_data_length()

uint32_t drizzled::Field::max_data_length ( ) const
virtual

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 in drizzled::Field_blob, and drizzled::Field_str.

Definition at line 732 of file field.cc.

◆ max_display_length()

virtual uint32_t drizzled::Field::max_display_length ( )
pure virtual

Implemented in drizzled::Field_blob.

◆ max_packed_col_length()

virtual uint32_t drizzled::Field::max_packed_col_length ( uint32_t max_length)
inlinevirtual

Definition at line 562 of file field.h.

◆ maybe_null()

bool drizzled::Field::maybe_null ( void ) const

Definition at line 849 of file field.cc.

◆ move_field() [1/2]

void drizzled::Field::move_field ( unsigned char * ptr_arg)
inline

Definition at line 379 of file field.h.

◆ move_field() [2/2]

void drizzled::Field::move_field ( unsigned char * ptr_arg,
unsigned char * null_ptr_arg,
unsigned char null_bit_arg )
inline

Definition at line 373 of file field.h.

◆ move_field_offset()

virtual void drizzled::Field::move_field_offset ( ptrdiff_t ptr_diff)
inlinevirtual

Definition at line 380 of file field.h.

◆ new_field()

Field * drizzled::Field::new_field ( memory::Root * root,
Table * new_table,
bool keep_type )
virtual

Definition at line 1106 of file field.cc.

◆ new_key_field()

Field * drizzled::Field::new_key_field ( memory::Root * root,
Table * new_table,
unsigned char * new_ptr,
unsigned char * new_null_ptr,
uint32_t new_null_bit )
virtual

Definition at line 1121 of file field.cc.

◆ offset()

uint32_t drizzled::Field::offset ( const unsigned char * record)
inline

Definition at line 567 of file field.h.

◆ operator delete() [1/2]

void drizzled::Field::operator delete ( void * ,
memory::Root *  )
inlinestatic

Definition at line 169 of file field.h.

◆ operator delete() [2/2]

void drizzled::Field::operator delete ( void * ,
size_t  )
inlinestatic

Definition at line 167 of file field.h.

◆ operator new() [1/2]

void * drizzled::Field::operator new ( size_t size)
static

Definition at line 677 of file field.cc.

◆ operator new() [2/2]

void * drizzled::Field::operator new ( size_t size,
memory::Root * mem_root )
static

Definition at line 682 of file field.cc.

◆ optimize_range()

bool drizzled::Field::optimize_range ( uint32_t idx,
uint32_t part )
virtual

Definition at line 1101 of file field.cc.

◆ pack() [1/2]

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

Definition at line 963 of file field.cc.

◆ pack() [2/2]

unsigned char * drizzled::Field::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 in drizzled::field::Int32, drizzled::field::Int64, drizzled::field::Size, drizzled::Field_blob, drizzled::Field_real, and drizzled::Field_varstring.

Definition at line 955 of file field.cc.

◆ pack_key()

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

Reimplemented in drizzled::Field_blob.

Definition at line 548 of file field.h.

◆ pack_length()

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

◆ pack_length_in_rec()

uint32_t drizzled::Field::pack_length_in_rec ( ) const
virtual

Returns size (in bytes) used to store field data on storage (i.e. it returns the maximal size of the field in a row of the table, which is located on disk).

Definition at line 712 of file field.cc.

◆ pack_num() [1/2]

void drizzled::Field::pack_num ( uint32_t arg,
unsigned char * destination = NULL )
protected

Definition at line 1320 of file field.cc.

◆ pack_num() [2/2]

void drizzled::Field::pack_num ( uint64_t arg,
unsigned char * destination = NULL )
protected

Definition at line 1312 of file field.cc.

◆ position()

uint16_t drizzled::Field::position ( ) const
inline

Definition at line 144 of file field.h.

◆ real_maybe_null()

bool drizzled::Field::real_maybe_null ( void ) const

Definition at line 854 of file field.cc.

◆ real_type()

enum_field_types drizzled::Field::real_type ( ) const
virtual

Definition at line 777 of file field.cc.

◆ reset()

int drizzled::Field::reset ( void )
virtual

Definition at line 737 of file field.cc.

◆ reset_fields()

void drizzled::Field::reset_fields ( )
virtual

Definition at line 743 of file field.cc.

◆ result_merge_type()

Item_result drizzled::Field::result_merge_type ( enum_field_types field_type)
static

Detect Item_result by given field type of UNION merge result.

Parameters
field_typegiven field type
Returns
Item_result (type of internal MySQL expression result)

Definition at line 695 of file field.cc.

◆ set_charset()

virtual void drizzled::Field::set_charset ( const charset_info_st * const )
inlinevirtual

Definition at line 578 of file field.h.

◆ set_datetime_warning() [1/3]

void drizzled::Field::set_datetime_warning ( DRIZZLE_ERROR::enum_warning_level level,
const drizzled::error_t code,
double nr,
type::timestamp_t ts_type )

Produce warning or note about double datetime data saved into field.

Parameters
levellevel of message (Note/Warning/Error)
codeerror code of message to be produced
nrdouble value which we tried to save
ts_typetype of datetime value (datetime/date/time)
Note
This function will always produce some warning but won't increase cut fields counter if count_cuted_fields == FIELD_CHECK_IGNORE for current thread.

Definition at line 1269 of file field.cc.

◆ set_datetime_warning() [2/3]

void drizzled::Field::set_datetime_warning ( DRIZZLE_ERROR::enum_warning_level level,
drizzled::error_t code,
const char * str,
uint32_t str_len,
type::timestamp_t ts_type,
int cuted_increment )

Produce warning or note about datetime string data saved into field.

Parameters
levellevel of message (Note/Warning/Error)
codeerror code of message to be produced
strstring value which we tried to save
str_lengthlength of string which we tried to save
ts_typetype of datetime value (datetime/date/time)
cuted_incrementwhenever we should increase cut fields count or not
Note
This function will always produce some warning but won't increase cut fields counter if count_cuted_fields ==FIELD_CHECK_IGNORE for current thread.

Definition at line 1237 of file field.cc.

◆ set_datetime_warning() [3/3]

void drizzled::Field::set_datetime_warning ( DRIZZLE_ERROR::enum_warning_level level,
drizzled::error_t code,
int64_t nr,
type::timestamp_t ts_type,
int cuted_increment )

Produce warning or note about integer datetime value saved into field.

Parameters
levellevel of message (Note/Warning/Error)
codeerror code of message to be produced
nrnumeric value which we tried to save
ts_typetype of datetime value (datetime/date/time)
cuted_incrementwhenever we should increase cut fields count or not
Note
This function will always produce some warning but won't increase cut fields counter if count_cuted_fields == FIELD_CHECK_IGNORE for current thread.

Definition at line 1252 of file field.cc.

◆ set_default()

void drizzled::Field::set_default ( )
virtual

Definition at line 746 of file field.cc.

◆ set_derivation()

virtual void drizzled::Field::set_derivation ( enum Derivation )
inlinevirtual

Definition at line 584 of file field.h.

◆ set_image()

virtual void drizzled::Field::set_image ( const unsigned char * buff,
uint32_t length,
const charset_info_st * const  )
inlinevirtual

Definition at line 394 of file field.h.

◆ set_key_image()

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

Definition at line 433 of file field.h.

◆ set_notnull()

void drizzled::Field::set_notnull ( ptrdiff_t row_offset = 0)

Definition at line 843 of file field.cc.

◆ set_null()

void drizzled::Field::set_null ( ptrdiff_t row_offset = 0)

Definition at line 837 of file field.cc.

◆ set_warning()

bool drizzled::Field::set_warning ( DRIZZLE_ERROR::enum_warning_level level,
drizzled::error_t code,
int cuted_increment )

Produce warning or note about data saved into field.

Parameters
level- level of message (Note/Warning/Error)
code- error code of message to be produced
cuted_increment- whenever we should increase cut fields count or not
Note
This function won't produce warning and increase cut fields counter if count_cuted_fields == CHECK_FIELD_IGNORE for current thread.

if count_cuted_fields == CHECK_FIELD_IGNORE then we ignore notes. This allows us to avoid notes in optimisation, like convert_constant_item().

Return values
1if count_cuted_fields == CHECK_FIELD_IGNORE and error level is not NOTE
0otherwise

Definition at line 1217 of file field.cc.

◆ setPosition()

void drizzled::Field::setPosition ( uint32_t arg)
inline

Definition at line 149 of file field.h.

◆ setReadSet()

void drizzled::Field::setReadSet ( bool arg = true)

Definition at line 1296 of file field.cc.

◆ setTable()

void drizzled::Field::setTable ( Table * table_arg)
inline

Definition at line 98 of file field.h.

◆ setWriteSet()

void drizzled::Field::setWriteSet ( bool arg = true)

Definition at line 1304 of file field.cc.

◆ sort_charset()

virtual const charset_info_st * drizzled::Field::sort_charset ( void ) const
inlinevirtual

Definition at line 576 of file field.h.

◆ sort_length()

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

Definition at line 727 of file field.cc.

◆ store() [1/3]

virtual int drizzled::Field::store ( const char * to,
uint32_t length,
const charset_info_st *const cs )
pure virtual

Implemented in drizzled::Field_enum.

◆ store() [2/3]

virtual int drizzled::Field::store ( double nr)
pure virtual

◆ store() [3/3]

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

Implemented in drizzled::Field_enum.

◆ store_and_check()

int drizzled::Field::store_and_check ( enum_check_fields check_level,
const char * to,
uint32_t length,
const charset_info_st *const cs )

Definition at line 942 of file field.cc.

◆ store_decimal()

virtual int drizzled::Field::store_decimal ( const type::Decimal * d)
pure virtual

◆ store_time()

int drizzled::Field::store_time ( type::Time & ltime,
type::timestamp_t t_type )
virtual

This is called when storing a date in a string.

Note
Needs to be changed if/when we want to support different time formats.

Reimplemented in drizzled::field::Microtime, drizzled::Field_date, drizzled::Field_datetime, and drizzled::Field_decimal.

Definition at line 1094 of file field.cc.

◆ str_needs_quotes()

virtual bool drizzled::Field::str_needs_quotes ( )
inlinevirtual

Definition at line 229 of file field.h.

◆ type_can_have_key_part()

bool drizzled::Field::type_can_have_key_part ( enum_field_types type)
static

Check whether a field type can be partially indexed by a key.

This is a static method, rather than a virtual function, because we need to check the type of a non-Field in alter_table().

Parameters
typefield type
Return values
trueType can have a prefixed key
falseType can not have a prefixed key

Definition at line 859 of file field.cc.

◆ unpack() [1/2]

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

Definition at line 1000 of file field.cc.

◆ unpack() [2/2]

const unsigned char * drizzled::Field::unpack ( unsigned char * to,
const unsigned char * from,
uint32_t param_data,
bool low_byte_first )
virtual

Unpack a field from row data.

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

The param_data parameter is a two-byte integer (stored in the least significant 16 bits of the unsigned integer) usually consisting of two parts: the real type in the most significant byte and a original pack length in the least significant byte.

The exact layout of the param_data field is given by the Table_map_log_event::save_field_metadata().

This is the default method for unpacking a field. It just copies the memory block in byte order (of original pack length bytes or length of field, whichever is smaller).

Parameters
toDestination of the data
fromSource of the data
param_dataReal type and original pack length of the field data
low_byte_firstIf this flag is true, all composite entities (e.g., lengths) should be unpacked in little-endian format; otherwise, the entities are unpacked in native order.
Returns
New pointer into memory based on from + length of the data

Reimplemented in drizzled::field::Int32, drizzled::field::Int64, drizzled::field::Size, drizzled::Field_blob, drizzled::Field_decimal, drizzled::Field_real, and drizzled::Field_varstring.

Definition at line 968 of file field.cc.

◆ unpack_key()

virtual const unsigned char * drizzled::Field::unpack_key ( unsigned char * to,
const unsigned char * from,
uint32_t max_length,
bool low_byte_first )
inlinevirtual

Definition at line 555 of file field.h.

◆ unpack_num() [1/2]

uint32_t drizzled::Field::unpack_num ( uint32_t & destination,
const unsigned char * arg = NULL ) const
protected

Definition at line 1338 of file field.cc.

◆ unpack_num() [2/2]

uint64_t drizzled::Field::unpack_num ( uint64_t & destination,
const unsigned char * arg = NULL ) const
protected

Definition at line 1328 of file field.cc.

◆ used_length()

uint32_t drizzled::Field::used_length ( )
virtual

Returns the number of bytes actually used to store the data of the field. So for a varstring it includes both lenght byte(s) and string data, and anything after data_length() bytes are unused.

Reimplemented in drizzled::Field_varstring.

Definition at line 722 of file field.cc.

◆ val_decimal()

type::Decimal * drizzled::Field::val_decimal ( type::Decimal * ) const
virtual

Reimplemented in drizzled::Field_num, and drizzled::Field_real.

Definition at line 1005 of file field.cc.

◆ val_int_internal()

int64_t drizzled::Field::val_int_internal ( const unsigned char * new_ptr)
inline

Definition at line 445 of file field.h.

◆ val_int_offset()

int64_t drizzled::Field::val_int_offset ( uint32_t row_offset)
inline

Definition at line 437 of file field.h.

◆ val_str_internal() [1/2]

String * drizzled::Field::val_str_internal ( String * str) const
inline

Definition at line 206 of file field.h.

◆ val_str_internal() [2/2]

String * drizzled::Field::val_str_internal ( String * str,
const unsigned char * new_ptr )
inline

Definition at line 454 of file field.h.

◆ warn_if_overflow()

int drizzled::Field::warn_if_overflow ( int op_result)

Process decimal library return codes and issue warnings for overflow and truncation.

Parameters
op_resultdecimal library return code (E_DEC_* see include/decimal.h)
Return values
E_DEC_OVERFLOWthere was overflow E_DEC_TRUNCATED there was truncation
0no error or there was some other error except overflow or truncation

Definition at line 871 of file field.cc.

◆ zero_pack()

bool drizzled::Field::zero_pack ( ) const
virtual

Definition at line 762 of file field.cc.

◆ CopyField

friend class CopyField
friend

Definition at line 718 of file field.h.

◆ Item_avg_field

friend class Item_avg_field
friend

Definition at line 719 of file field.h.

◆ Item_func_group_concat

friend class Item_func_group_concat
friend

Definition at line 729 of file field.h.

◆ Item_std_field

friend class Item_std_field
friend

Definition at line 720 of file field.h.

◆ Item_sum_avg

friend class Item_sum_avg
friend

Definition at line 725 of file field.h.

◆ Item_sum_count

friend class Item_sum_count
friend

Definition at line 724 of file field.h.

◆ Item_sum_max

friend class Item_sum_max
friend

Definition at line 728 of file field.h.

◆ Item_sum_min

friend class Item_sum_min
friend

Definition at line 727 of file field.h.

◆ Item_sum_num

friend class Item_sum_num
friend

Definition at line 721 of file field.h.

◆ Item_sum_std

friend class Item_sum_std
friend

Definition at line 726 of file field.h.

◆ Item_sum_str

friend class Item_sum_str
friend

Definition at line 723 of file field.h.

◆ Item_sum_sum

friend class Item_sum_sum
friend

Definition at line 722 of file field.h.

Member Data Documentation

◆ comment

str_ref drizzled::Field::comment

A comment about the field

Definition at line 105 of file field.h.

◆ field_index

uint16_t drizzled::Field::field_index
private

Index of this Field in Table::fields array

Definition at line 140 of file field.h.

◆ field_length

uint32_t drizzled::Field::field_length

Length of this field in bytes

Definition at line 131 of file field.h.

◆ field_name

const char* drizzled::Field::field_name

Name of the field

Definition at line 104 of file field.h.

◆ flags

uint32_t drizzled::Field::flags

Definition at line 132 of file field.h.

◆ is_created_from_null_item

bool drizzled::Field::is_created_from_null_item

If true, this field was created in create_tmp_field_from_item from a NULL value. This means that the type of the field is just a guess, and the type may be freely coerced to another type.

See also
create_tmp_field_from_item
Item_type_holder::get_real_type

Definition at line 163 of file field.h.

◆ key_start

key_map drizzled::Field::key_start

The field is part of the following keys

Definition at line 108 of file field.h.

◆ null_bit

unsigned char drizzled::Field::null_bit

Bit used to test null bit

Definition at line 154 of file field.h.

◆ null_ptr

unsigned char* drizzled::Field::null_ptr

Byte where null_bit is

Definition at line 74 of file field.h.

◆ orig_table

Table* drizzled::Field::orig_table

Pointer to the original Table. @TODO What is "the original table"?

Definition at line 103 of file field.h.

◆ part_of_key

key_map drizzled::Field::part_of_key

Definition at line 109 of file field.h.

◆ part_of_key_not_clustered

key_map drizzled::Field::part_of_key_not_clustered

Definition at line 110 of file field.h.

◆ part_of_sortkey

key_map drizzled::Field::part_of_sortkey

Definition at line 111 of file field.h.

◆ ptr

unsigned char* drizzled::Field::ptr

Position to field in record. Stores raw field value

Definition at line 73 of file field.h.

◆ table

Table* drizzled::Field::table
private

Pointer to the Table object containing this Field

Note
You can use table->in_use as replacement for current_session member only inside of val_*() and store() members (e.g. you can't use it in cons)

Definition at line 83 of file field.h.

◆ unireg_check

utype drizzled::Field::unireg_check

Definition at line 130 of file field.h.


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