Public Types | |
enum | utype { NONE, NEXT_NUMBER, TIMESTAMP_OLD_FIELD, TIMESTAMP_DN_FIELD, TIMESTAMP_UN_FIELD, TIMESTAMP_DNUN_FIELD } |
Public Member Functions | |
Int64 (unsigned char *ptr_arg, uint32_t len_arg, unsigned char *null_ptr_arg, unsigned char null_bit_arg, enum utype unireg_check_arg, const char *field_name_arg) | |
Int64 (uint32_t len_arg, bool maybe_null_arg, const char *field_name_arg, bool unsigned_arg) | |
enum Item_result | result_type () const |
enum_field_types | type () const |
enum ha_base_keytype | key_type () const |
int | store (const char *to, uint32_t length, const CHARSET_INFO *const charset) |
int | store (double nr) |
int | store (int64_t nr, bool unsigned_val) |
int | reset (void) |
double | val_real (void) const |
int64_t | val_int (void) const |
String * | val_str (String *, String *) const |
int | cmp (const unsigned char *, const unsigned char *) |
void | sort_string (unsigned char *buff, uint32_t length) |
uint32_t | pack_length () const |
void | sql_type (String &str) const |
bool | can_be_compared_as_int64_t () const |
uint32_t | max_display_length () |
virtual unsigned char * | pack (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 param_data, bool low_byte_first) |
void | make_field (SendField *) |
uint32_t | decimals () const |
uint32_t | size_of () const |
bool | eq_def (Field *field) |
int | store_decimal (const type::Decimal *) |
type::Decimal * | val_decimal (type::Decimal *) const |
uint32_t | is_equal (CreateField *new_field) |
int | check_int (const CHARSET_INFO *const cs, const char *str, int length, const char *int_end, int error) |
bool | get_int (const CHARSET_INFO *const cs, const char *from, uint32_t len, int64_t *rnd, uint64_t unsigned_max, int64_t signed_min, int64_t signed_max) |
Table * | getTable () |
Table * | getTable () const |
void | setTable (Table *table_arg) |
bool | isUnsigned () const |
uint16_t | position () const |
void | setPosition (uint32_t arg) |
bool | hasDefault () const |
int | store_and_check (enum_check_fields check_level, const char *to, uint32_t length, const CHARSET_INFO *const cs) |
virtual int | store_time (type::Time <ime, type::timestamp_t t_type) |
String * | val_str_internal (String *str) const |
String * | val_str_internal (String *str, const unsigned char *new_ptr) |
virtual bool | str_needs_quotes () |
virtual Item_result | cmp_type () const |
virtual Item_result | cast_to_int_type () const |
virtual bool | eq (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 uint32_t | sort_length () const |
virtual uint32_t | max_data_length () const |
virtual void | reset_fields () |
virtual void | set_default () |
virtual bool | binary () const |
virtual bool | zero_pack () const |
virtual uint32_t | key_length () const |
virtual enum_field_types | real_type () const |
virtual int | cmp_max (const unsigned char *a, const unsigned char *b, uint32_t max_len) |
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) |
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 bool | optimize_range (uint32_t idx, uint32_t part) |
virtual void | free () |
virtual Field * | new_field (memory::Root *root, Table *new_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 *mem_root, Table *new_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 *const) |
virtual void | get_image (std::basic_string< unsigned char > &buff, uint32_t length, const CHARSET_INFO *const) |
virtual void | set_image (const unsigned char *buff, uint32_t length, const CHARSET_INFO *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) |
unsigned char * | pack (unsigned char *to, const unsigned char *from) |
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 <ime, uint32_t fuzzydate) const |
virtual bool | get_time (type::Time <ime) const |
virtual const CHARSET_INFO * | charset (void) const |
virtual const CHARSET_INFO * | sort_charset (void) const |
virtual bool | has_charset (void) const |
virtual void | set_charset (const CHARSET_INFO *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) |
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 | |
const uint8_t | dec |
bool | decimal_precision |
bool | unsigned_flag |
unsigned char * | ptr |
unsigned char * | null_ptr |
Table * | orig_table |
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_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 |
Friends | |
class | CreateField |
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) |
bool drizzled::field::Int64::can_be_compared_as_int64_t | ( | ) | const [inline, virtual] |
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 from drizzled::Field.
int drizzled::Field_num::check_int | ( | const CHARSET_INFO *const | cs, |
const char * | str, | ||
int | length, | ||
const char * | int_end, | ||
int | error | ||
) | [inherited] |
Test if given number is a int.
str | String to test |
length | Length of 'str' |
int_end | Pointer to char after last used digit |
cs | Character set |
0 | OK |
1 | error: empty string or wrong integer. |
2 | error: garbage at the end of string. |
Definition at line 79 of file num.cc.
References drizzled::Field::field_name, drizzled::Table::in_use, drizzled::Session::row_count, drizzled::Field::set_warning(), and drizzled::test_if_important_data().
Field * drizzled::Field::clone | ( | memory::Root * | mem_root, |
Table * | new_table | ||
) | [inherited] |
This is used to generate a field in Table from TableShare
Definition at line 1094 of file field.cc.
References drizzled::memory::Root::memdup_root().
int64_t drizzled::Field::convert_decimal2int64_t | ( | const type::Decimal * | val, |
bool | unsigned_flag, | ||
int * | err | ||
) | [inherited] |
Conversion from decimal to int64_t with checking overflow and setting correct value (min/max) in case of overflow.
val | value which have to be converted |
unsigned_flag | type of integer in which we convert val |
err | variable to pass error code |
Definition at line 981 of file field.cc.
References drizzled::Field::warn_if_overflow().
Referenced by drizzled::Field_num::store_decimal().
uint32_t drizzled::Field::data_length | ( | ) | [virtual, inherited] |
Return the "real size" of the data in memory. For varstrings, this does _not_ include the length bytes.
Definition at line 649 of file field.cc.
References drizzled::Field::pack_length().
bool drizzled::Field_num::eq_def | ( | Field * | field | ) | [virtual, inherited] |
Reimplemented from drizzled::Field.
Definition at line 212 of file num.cc.
References drizzled::Field::eq_def().
enum_field_types drizzled::Field::field_type_merge | ( | enum_field_types | a, |
enum_field_types | b | ||
) | [static, inherited] |
Return type of which can carry value of both given types in UNION result.
a | type for merging |
b | type for merging |
type | of field |
Definition at line 619 of file field.cc.
Referenced by drizzled::Item_type_holder::join_types().
virtual uint32_t drizzled::Field::get_key_image | ( | unsigned char * | buff, |
uint32_t | length | ||
) | [inline, virtual, inherited] |
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.
output | buffer |
output | buffer size |
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.
Number | of copied bytes (excluding padded zero bytes -- see above). |
Reimplemented in drizzled::Field_blob, and drizzled::Field_varstring.
Definition at line 448 of file field.h.
Referenced by drizzled::matching_cond().
uint32_t drizzled::Field::max_data_length | ( | ) | const [virtual, inherited] |
Get the maximum size of the data in packed format.
Reimplemented in drizzled::Field_blob, and drizzled::Field_str.
Definition at line 664 of file field.cc.
References drizzled::Field::pack_length().
unsigned char * drizzled::field::Int64::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.
max_length
characters.to | Pointer to memory area where representation of field should be put. |
from | Pointer to memory area where record representation of field is stored. |
max_length | Maximum 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_first | true 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.
uint32_t drizzled::field::Int64::pack_length | ( | ) | const [inline, 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.
uint32_t drizzled::Field::pack_length_in_rec | ( | ) | const [virtual, inherited] |
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 644 of file field.cc.
References drizzled::Field::pack_length().
Item_result drizzled::Field::result_merge_type | ( | enum_field_types | field_type | ) | [static, inherited] |
Detect Item_result by given field type of UNION merge result.
field_type | given field type |
Definition at line 627 of file field.cc.
Referenced by drizzled::Item_type_holder::join_types(), and drizzled::Item_type_holder::result_type().
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 | ||
) | [inherited] |
Produce warning or note about datetime string data saved into field.
level | level of message (Note/Warning/Error) |
code | error code of message to be produced |
str | string value which we tried to save |
str_length | length of string which we tried to save |
ts_type | type of datetime value (datetime/date/time) |
cuted_increment | whenever we should increase cut fields count or not |
Definition at line 1204 of file field.cc.
References drizzled::Field::field_name, and drizzled::Field::set_warning().
Referenced by drizzled::Field_date::store_time().
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 | ||
) | [inherited] |
Produce warning or note about integer datetime value saved into field.
level | level of message (Note/Warning/Error) |
code | error code of message to be produced |
nr | numeric value which we tried to save |
ts_type | type of datetime value (datetime/date/time) |
cuted_increment | whenever we should increase cut fields count or not |
Definition at line 1220 of file field.cc.
References drizzled::Field::field_name, and drizzled::Field::set_warning().
void drizzled::Field::set_datetime_warning | ( | DRIZZLE_ERROR::enum_warning_level | level, |
const drizzled::error_t | code, | ||
double | nr, | ||
type::timestamp_t | ts_type | ||
) | [inherited] |
Produce warning or note about double datetime data saved into field.
level | level of message (Note/Warning/Error) |
code | error code of message to be produced |
nr | double value which we tried to save |
ts_type | type of datetime value (datetime/date/time) |
Definition at line 1238 of file field.cc.
References drizzled::Field::field_name, and drizzled::Field::set_warning().
bool drizzled::Field::set_warning | ( | DRIZZLE_ERROR::enum_warning_level | level, |
drizzled::error_t | code, | ||
int | cuted_increment | ||
) | [inherited] |
Produce warning or note about data saved into field.
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 |
if count_cuted_fields == CHECK_FIELD_IGNORE then we ignore notes. This allows us to avoid notes in optimisation, like convert_constant_item().
1 | if count_cuted_fields == CHECK_FIELD_IGNORE and error level is not NOTE |
0 | otherwise |
Definition at line 1184 of file field.cc.
References drizzled::Session::cuted_fields, drizzled::Field::field_name, drizzled::Table::in_use, drizzled::Session::row_count, and drizzled::Field::table.
Referenced by drizzled::Field_num::check_int(), drizzled::do_cut_string(), drizzled::do_cut_string_complex(), drizzled::Field::set_datetime_warning(), drizzled::set_field_to_null_with_conversions(), drizzled::Field_date::store_time(), and drizzled::Field::warn_if_overflow().
int drizzled::Field_num::store_decimal | ( | const type::Decimal * | val | ) | [virtual, inherited] |
Storing decimal in integer fields.
val | value for storing |
0 | OK |
!=0 | error |
Implements drizzled::Field.
Reimplemented in drizzled::Field_decimal, and drizzled::Field_real.
Definition at line 171 of file num.cc.
References drizzled::Field::convert_decimal2int64_t().
int drizzled::Field::store_time | ( | type::Time & | ltime, |
type::timestamp_t | t_type | ||
) | [virtual, inherited] |
This is called when storing a date in a string.
Reimplemented in drizzled::Field_date, drizzled::Field_datetime, drizzled::Field_decimal, and drizzled::field::Microtime.
bool drizzled::Field::type_can_have_key_part | ( | enum_field_types | type | ) | [static, inherited] |
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().
type | field type |
true | Type can have a prefixed key |
false | Type can not have a prefixed key |
Definition at line 797 of file field.cc.
Referenced by drizzled::prepare_alter_table().
const unsigned char * drizzled::field::Int64::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).
to | Destination of the data |
from | Source of the data |
param_data | Real type and original pack length of the field data |
low_byte_first | If 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. |
Reimplemented from drizzled::Field.
uint32_t drizzled::Field::used_length | ( | ) | [virtual, inherited] |
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 654 of file field.cc.
References drizzled::Field::pack_length().
type::Decimal * drizzled::Field_num::val_decimal | ( | type::Decimal * | decimal_value | ) | const [virtual, inherited] |
Return decimal value of integer field.
decimal_value | buffer for storing decimal value |
Reimplemented from drizzled::Field.
Reimplemented in drizzled::Field_decimal, and drizzled::Field_real.
int drizzled::Field::warn_if_overflow | ( | int | op_result | ) | [inherited] |
Process decimal library return codes and issue warnings for overflow and truncation.
op_result | decimal library return code (E_DEC_* see include/decimal.h) |
E_DEC_OVERFLOW | there was overflow E_DEC_TRUNCATED there was truncation |
0 | no error or there was some other error except overflow or truncation |
Definition at line 808 of file field.cc.
References drizzled::Field::set_warning().
Referenced by drizzled::Field::convert_decimal2int64_t(), drizzled::Field_decimal::store(), and drizzled::Field_decimal::store_value().
LEX_STRING drizzled::Field::comment [inherited] |
A comment about the field
Definition at line 121 of file field.h.
Referenced by drizzled::CreateField::CreateField().
uint32_t drizzled::Field::field_length [inherited] |
Length of this field in bytes
Definition at line 147 of file field.h.
Referenced by drizzled::calc_group_buffer(), drizzled::CreateField::CreateField(), drizzled::field_conv(), drizzled::Field_varstring::pack_length(), and drizzled::Field::pack_length().
const char* drizzled::Field::field_name [inherited] |
Name of the field
Definition at line 120 of file field.h.
Referenced by drizzled::Field_num::check_int(), create_index(), create_table_def(), drizzled::create_tmp_field_from_field(), drizzled::CreateField::CreateField(), drizzled::Item_default_value::fix_fields(), ha_innobase::innobase_initialize_autoinc(), drizzled::prepare_alter_table(), drizzled::Item_field::reset_field(), drizzled::Field::set_datetime_warning(), drizzled::set_field_to_null_with_conversions(), drizzled::Field::set_warning(), drizzled::TransactionServices::setDeleteHeader(), drizzled::TransactionServices::setInsertHeader(), and drizzled::TransactionServices::setUpdateHeader().
bool drizzled::Field::is_created_from_null_item [inherited] |
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.
Definition at line 179 of file field.h.
Referenced by drizzled::create_tmp_field_from_item(), and drizzled::Item_type_holder::get_real_type().
key_map drizzled::Field::key_start [inherited] |
The field is part of the following keys
Definition at line 124 of file field.h.
Referenced by drizzled::make_join_statistics(), and drizzled::update_const_equal_items().
unsigned char drizzled::Field::null_bit [inherited] |
Bit used to test null bit
Definition at line 170 of file field.h.
Referenced by build_template(), drizzled::Table::compare_records(), field_in_record_is_null(), drizzled::CopyField::set(), and set_field_in_record_to_null().
unsigned char* drizzled::Field::null_ptr [inherited] |
Byte where null_bit is
Definition at line 90 of file field.h.
Referenced by build_template(), calc_row_difference(), drizzled::Table::compare_records(), create_table_def(), field_in_record_is_null(), drizzled::CopyField::set(), and set_field_in_record_to_null().
Table* drizzled::Field::orig_table [inherited] |
Pointer to the original Table. What is "the original table"?
Definition at line 119 of file field.h.
Referenced by drizzled::change_to_use_tmp_fields(), and drizzled::create_tmp_field_from_field().
unsigned char* drizzled::Field::ptr [inherited] |
Position to field in record. Stores raw field value
Definition at line 89 of file field.h.
Referenced by drizzled::CreateField::CreateField(), drizzled::TransactionServices::deleteRecord(), drizzled::field_conv(), get_field_offset(), drizzled::Field_blob::get_key_image(), innobase_col_to_mysql(), drizzled::TransactionServices::isFieldUpdated(), drizzled::SortParam::make_sortkey(), drizzled::Field_blob::pack(), drizzled::Field_blob::pack_key(), drizzled::CopyField::set(), drizzled::field::Microtime::store(), drizzled::field::Microtime::store_time(), drizzled::Field_datetime::store_time(), drizzled::Field_date::store_time(), drizzled::Field_decimal::store_value(), drizzled::unpack_addon_fields(), and drizzled::Field_decimal::val_decimal().