#include "univ.i"
#include "data0types.h"
#include "data0type.h"
#include "mem0mem.h"
#include "dict0types.h"
#include "data0data.ic"
Go to the source code of this file.
Classes | |
struct | dfield_struct |
struct | dtuple_struct |
struct | big_rec_field_struct |
struct | big_rec_struct |
Defines | |
#define | dfield_get_type(field) (&(field)->type) |
#define | dfield_get_data(field) ((field)->data) |
#define | dtuple_get_nth_field(tuple, n) ((tuple)->fields + (n)) |
Typedefs | |
typedef struct big_rec_struct | big_rec_t |
typedef struct big_rec_field_struct | big_rec_field_t |
Functions | |
UNIV_INLINE void | dfield_set_type (dfield_t *field, dtype_t *type) |
UNIV_INLINE ulint | dfield_get_len (const dfield_t *field) |
UNIV_INLINE void | dfield_set_len (dfield_t *field, ulint len) |
UNIV_INLINE ulint | dfield_is_null (const dfield_t *field) |
UNIV_INLINE ulint | dfield_is_ext (const dfield_t *field) |
UNIV_INLINE void | dfield_set_ext (dfield_t *field) |
UNIV_INLINE void | dfield_set_data (dfield_t *field, const void *data, ulint len) |
UNIV_INLINE void | dfield_set_null (dfield_t *field) |
UNIV_INLINE void | data_write_sql_null (byte *data, ulint len) |
UNIV_INLINE void | dfield_copy_data (dfield_t *field1, const dfield_t *field2) |
UNIV_INLINE void | dfield_copy (dfield_t *field1, const dfield_t *field2) |
UNIV_INLINE void | dfield_dup (dfield_t *field, mem_heap_t *heap) |
UNIV_INLINE ibool | dfield_datas_are_binary_equal (const dfield_t *field1, const dfield_t *field2) |
UNIV_INTERN ibool | dfield_data_is_binary_equal (const dfield_t *field, ulint len, const byte *data) |
UNIV_INLINE ulint | dtuple_get_n_fields (const dtuple_t *tuple) |
UNIV_INLINE ulint | dtuple_get_info_bits (const dtuple_t *tuple) |
UNIV_INLINE void | dtuple_set_info_bits (dtuple_t *tuple, ulint info_bits) |
UNIV_INLINE ulint | dtuple_get_n_fields_cmp (const dtuple_t *tuple) |
UNIV_INLINE void | dtuple_set_n_fields_cmp (dtuple_t *tuple, ulint n_fields_cmp) |
UNIV_INLINE dtuple_t * | dtuple_create (mem_heap_t *heap, ulint n_fields) |
UNIV_INLINE const dtuple_t * | dtuple_from_fields (dtuple_t *tuple, const dfield_t *fields, ulint n_fields) |
UNIV_INTERN void | dtuple_set_n_fields (dtuple_t *tuple, ulint n_fields) |
UNIV_INLINE dtuple_t * | dtuple_copy (const dtuple_t *tuple, mem_heap_t *heap) |
UNIV_INLINE ulint | dtuple_get_data_size (const dtuple_t *tuple, ulint comp) |
UNIV_INLINE ulint | dtuple_get_n_ext (const dtuple_t *tuple) |
UNIV_INTERN int | dtuple_coll_cmp (const dtuple_t *tuple1, const dtuple_t *tuple2) |
UNIV_INLINE ulint | dtuple_fold (const dtuple_t *tuple, ulint n_fields, ulint n_bytes, index_id_t tree_id) __attribute__((pure)) |
UNIV_INLINE void | dtuple_set_types_binary (dtuple_t *tuple, ulint n) |
UNIV_INLINE ibool | dtuple_contains_null (const dtuple_t *tuple) |
UNIV_INTERN ibool | dfield_check_typed (const dfield_t *field) |
UNIV_INTERN ibool | dtuple_check_typed (const dtuple_t *tuple) |
UNIV_INTERN ibool | dtuple_check_typed_no_assert (const dtuple_t *tuple) |
UNIV_INTERN void | dfield_print (const dfield_t *dfield) |
UNIV_INTERN void | dfield_print_also_hex (const dfield_t *dfield) |
UNIV_INTERN void | dtuple_print (FILE *f, const dtuple_t *tuple) |
UNIV_INTERN big_rec_t * | dtuple_convert_big_rec (dict_index_t *index, dtuple_t *entry, ulint *n_ext) |
UNIV_INTERN void | dtuple_convert_back_big_rec (dict_index_t *index, dtuple_t *entry, big_rec_t *vector) |
UNIV_INLINE void | dtuple_big_rec_free (big_rec_t *vector) |
typedef struct big_rec_field_struct big_rec_field_t |
A slot for a field in a big rec vector
Definition at line 463 of file data0data.h.
typedef struct big_rec_struct big_rec_t |
Storage for overflow data in a big record, that is, a clustered index record which needs external storage of data fields
Definition at line 39 of file data0data.h.
UNIV_INLINE void data_write_sql_null | ( | byte * | data, |
ulint | len | ||
) |
Writes an SQL null field full of zeros. in: SQL null size in bytes
data | in: pointer to a buffer of size len |
UNIV_INTERN ibool dfield_check_typed | ( | const dfield_t * | field | ) |
Checks that a data field is typed. Asserts an error if not.
Copies a data field to another. in: field to copy from
field1 | out: field to copy to |
Referenced by row_build_index_entry(), row_upd_build_difference_binary(), and row_upd_build_sec_rec_difference_binary().
Copies the data and len fields. in: field to copy from
field1 | out: field to copy to |
Referenced by calc_row_difference(), and row_upd_replace().
UNIV_INTERN ibool dfield_data_is_binary_equal | ( | const dfield_t * | field, |
ulint | len, | ||
const byte * | data | ||
) |
Tests if dfield data length and content is equal to the given.
Tests if dfield data length and content is equal to the given.
field | in: field |
len | in: data length or UNIV_SQL_NULL |
data | in: data |
Definition at line 61 of file data0data.cc.
References dfield_get_len().
UNIV_INLINE ibool dfield_datas_are_binary_equal | ( | const dfield_t * | field1, |
const dfield_t * | field2 | ||
) |
Tests if data length and content is equal for two dfields.
field1 | in: field |
Referenced by row_upd_changes_ord_field_binary().
UNIV_INLINE void dfield_dup | ( | dfield_t * | field, |
mem_heap_t * | heap | ||
) |
Copies the data pointed to by a data field. in: memory heap where allocated
field | in/out: data field |
UNIV_INLINE ulint dfield_get_len | ( | const dfield_t * | field | ) |
Gets length of field data.
Referenced by btr_cur_mark_dtuple_inherited_extern(), btr_cur_unmark_dtuple_extern_fields(), btr_push_update_extern_fields(), cmp_dtuple_is_prefix_of_rec(), cmp_dtuple_rec_with_match(), dfield_data_is_binary_equal(), dfield_print(), dfield_print_also_hex(), dict_load_foreigns(), dtuple_convert_back_big_rec(), dtuple_convert_big_rec(), rec_convert_dtuple_to_rec_comp(), rec_get_converted_size_comp(), rec_get_converted_size_comp_prefix(), row_build_index_entry(), row_check_index_for_mysql(), row_fetch_print(), row_ins_check_foreign_constraint(), row_sel_convert_mysql_key_to_innobase(), row_upd_changes_field_size_or_external(), row_upd_index_write_log(), row_upd_rec_in_place(), and trx_undo_rec_get_partial_row().
UNIV_INLINE ulint dfield_is_ext | ( | const dfield_t * | field | ) |
Determines if a field is externally stored
Referenced by btr_cur_mark_dtuple_inherited_extern(), btr_cur_optimistic_update(), btr_cur_unmark_dtuple_extern_fields(), btr_push_update_extern_fields(), dfield_print(), dfield_print_also_hex(), dtuple_convert_back_big_rec(), dtuple_convert_big_rec(), rec_convert_dtuple_to_rec(), rec_convert_dtuple_to_rec_comp(), rec_get_converted_size_comp_prefix(), row_build_index_entry(), row_upd_build_difference_binary(), row_upd_changes_field_size_or_external(), row_upd_rec_in_place(), and row_upd_replace().
UNIV_INLINE ulint dfield_is_null | ( | const dfield_t * | field | ) |
Determines if a field is SQL NULL
Referenced by dfield_print(), dfield_print_also_hex(), dtuple_convert_big_rec(), rec_convert_dtuple_to_rec_comp(), rec_get_converted_size_comp_prefix(), row_build_index_entry(), and row_upd_changes_field_size_or_external().
UNIV_INTERN void dfield_print | ( | const dfield_t * | dfield | ) |
Pretty prints a dfield value according to its data type. in: dfield
Pretty prints a dfield value according to its data type.
dfield | in: dfield |
Definition at line 305 of file data0data.cc.
References dfield_get_len(), dfield_is_ext(), dfield_is_null(), dtype_get_mtype(), mach_read_from_4(), ut_a, and ut_error.
UNIV_INTERN void dfield_print_also_hex | ( | const dfield_t * | dfield | ) |
Pretty prints a dfield value according to its data type. Also the hex string is printed if a string contains non-printable characters. in: dfield
Pretty prints a dfield value according to its data type. Also the hex string is printed if a string contains non-printable characters.
dfield | in: dfield |
Definition at line 346 of file data0data.cc.
References dfield_get_len(), dfield_is_ext(), dfield_is_null(), dtype_get_mtype(), dtype_get_prtype(), mach_read_from_1(), mach_read_from_2(), mach_read_from_3(), mach_read_from_4(), mach_read_from_6(), mach_read_from_7(), mach_read_from_8(), mach_ull_read_compressed(), and TRX_ID_FMT.
UNIV_INLINE void dfield_set_data | ( | dfield_t * | field, |
const void * | data, | ||
ulint | len | ||
) |
Sets pointer to the data and length in a field. in: length or UNIV_SQL_NULL
field | in: field |
data | in: data |
Referenced by btr_push_update_extern_fields(), dict_get_first_table_name_in_db(), dict_index_build_node_ptr(), dict_load_foreigns(), dict_load_table(), dict_load_table_on_id(), dtuple_convert_back_big_rec(), dtuple_convert_big_rec(), rec_copy_prefix_to_dtuple(), row_build(), row_build_index_entry(), row_build_row_ref(), row_build_row_ref_in_tuple(), row_mysql_store_col_in_innobase_format(), row_rec_to_index_entry_low(), row_sel_convert_mysql_key_to_innobase(), row_truncate_table_for_mysql(), row_upd_index_parse(), sym_tab_add_bound_lit(), sym_tab_add_int_lit(), sym_tab_add_str_lit(), trx_undo_rec_get_partial_row(), trx_undo_rec_get_row_ref(), and trx_undo_update_rec_get_update().
UNIV_INLINE void dfield_set_ext | ( | dfield_t * | field | ) |
Sets the "external storage" flag in/out: field
Referenced by btr_push_update_extern_fields(), dtuple_convert_big_rec(), row_build(), row_rec_to_index_entry_low(), trx_undo_rec_get_partial_row(), and trx_undo_update_rec_get_update().
UNIV_INLINE void dfield_set_len | ( | dfield_t * | field, |
ulint | len | ||
) |
Sets length in a field. in: length or UNIV_SQL_NULL
field | in: field |
Referenced by row_build_index_entry(), row_build_row_ref(), row_build_row_ref_in_tuple(), row_sel_convert_mysql_key_to_innobase(), and trx_undo_rec_get_partial_row().
UNIV_INLINE void dfield_set_null | ( | dfield_t * | field | ) |
Sets a data field to SQL NULL. in/out: field
Referenced by calc_row_difference(), dict_table_copy_types(), rec_copy_prefix_to_dtuple(), row_sel_convert_mysql_key_to_innobase(), row_upd_index_parse(), sym_tab_add_bound_id(), sym_tab_add_id(), sym_tab_add_null_lit(), and trx_undo_update_rec_get_update().
Sets the type struct of SQL data field. in: pointer to data type struct
field | in: SQL data field |
UNIV_INLINE void dtuple_big_rec_free | ( | big_rec_t * | vector | ) |
Frees the memory in a big rec vector. in, own: big rec vector; it is freed in this function
UNIV_INTERN ibool dtuple_check_typed | ( | const dtuple_t * | tuple | ) |
Checks that a data tuple is typed. Asserts an error if not.
Referenced by btr_cur_pessimistic_insert(), btr_cur_search_to_nth_level(), cmp_dtuple_rec_with_match(), dict_index_build_data_tuple(), dict_index_build_node_ptr(), dtuple_coll_cmp(), ibuf_insert(), rec_convert_dtuple_to_rec(), rec_copy_prefix_to_dtuple(), row_build(), row_build_index_entry(), row_build_row_ref(), row_build_row_ref_in_tuple(), row_rec_to_index_entry_low(), row_search_index_entry(), and row_search_on_row_ref().
UNIV_INTERN ibool dtuple_check_typed_no_assert | ( | const dtuple_t * | tuple | ) |
Checks that a data tuple is typed.
Checks that a data tuple is typed.
tuple | in: tuple |
Definition at line 170 of file data0data.cc.
References dtuple_get_n_fields().
Compare two data tuples, respecting the collation of character fields.
Compare two data tuples, respecting the collation of character fields.
tuple1 | in: tuple 1 |
tuple2 | in: tuple 2 |
Definition at line 91 of file data0data.cc.
References cmp_dfield_dfield(), dtuple_check_typed(), dtuple_get_n_fields(), and ut_ad.
UNIV_INLINE ibool dtuple_contains_null | ( | const dtuple_t * | tuple | ) |
Checks if a dtuple contains an SQL null value.
Referenced by row_search_for_mysql().
UNIV_INTERN void dtuple_convert_back_big_rec | ( | dict_index_t * | , |
dtuple_t * | entry, | ||
big_rec_t * | vector | ||
) |
Puts back to entry the data stored in vector. Note that to ensure the fields in entry can accommodate the data, vector must have been created from entry with dtuple_convert_big_rec. in, own: big rec vector; it is freed in this function
Puts back to entry the data stored in vector. Note that to ensure the fields in entry can accommodate the data, vector must have been created from entry with dtuple_convert_big_rec.
entry | in: entry whose data was put to vector |
vector | in, own: big rec vector; it is freed in this function |
Definition at line 768 of file data0data.cc.
References BTR_EXTERN_FIELD_REF_SIZE, big_rec_field_struct::data, dfield_get_len(), dfield_is_ext(), dfield_set_data(), DICT_MAX_INDEX_COL_LEN, big_rec_field_struct::field_no, big_rec_struct::fields, big_rec_struct::heap, big_rec_field_struct::len, mem_heap_free, big_rec_struct::n_fields, and ut_ad.
UNIV_INTERN big_rec_t* dtuple_convert_big_rec | ( | dict_index_t * | index, |
dtuple_t * | entry, | ||
ulint * | n_ext | ||
) |
Moves parts of long fields in entry to the big record vector so that the size of tuple drops below the maximum record size allowed in the database. Moves data only from those fields which are not necessary to determine uniquely the insertion place of the tuple in the index.
Moves parts of long fields in entry to the big record vector so that the size of tuple drops below the maximum record size allowed in the database. Moves data only from those fields which are not necessary to determine uniquely the insertion place of the tuple in the index.
index | in: index |
entry | in/out: index entry |
n_ext | in/out: number of externally stored columns |
Definition at line 566 of file data0data.cc.
References BTR_EXTERN_FIELD_REF_SIZE, dict_field_struct::col, big_rec_field_struct::data, dfield_get_len(), dfield_is_ext(), dfield_is_null(), dfield_set_data(), dfield_set_ext(), dict_index_get_n_fields(), dict_index_get_n_unique_in_tree(), dict_index_is_clust(), DICT_MAX_INDEX_COL_LEN, dict_table_get_format(), dict_table_is_comp(), dict_table_zip_size(), DICT_TF_FORMAT_ZIP, dtuple_get_n_fields(), big_rec_field_struct::field_no, big_rec_struct::fields, dict_field_struct::fixed_len, big_rec_struct::heap, big_rec_field_struct::len, dict_col_struct::len, mem_heap_alloc(), mem_heap_create, mem_heap_free, dict_col_struct::mtype, big_rec_struct::n_fields, page_zip_rec_needs_ext(), rec_get_converted_size(), dict_index_struct::table, ut_a, and ut_ad.
UNIV_INLINE dtuple_t* dtuple_copy | ( | const dtuple_t * | tuple, |
mem_heap_t * | heap | ||
) |
Copies a data tuple to another. This is a shallow copy; if a deep copy is desired, dfield_dup() will have to be invoked on each field.
tuple | in: tuple to copy from |
Referenced by row_undo_search_clust_to_pcur().
UNIV_INLINE dtuple_t* dtuple_create | ( | mem_heap_t * | heap, |
ulint | n_fields | ||
) |
Creates a data tuple to a memory heap. The default value for number of fields used in record comparisons for this tuple is n_fields.
heap | in: memory heap where the tuple is created |
Referenced by dict_get_first_table_name_in_db(), dict_index_build_data_tuple(), dict_index_build_node_ptr(), dict_load_foreigns(), dict_load_table(), dict_load_table_on_id(), pars_insert_statement(), ha_innobase::records_in_range(), row_build(), row_build_index_entry(), row_build_row_ref(), row_create_prebuilt(), row_rec_to_index_entry_low(), row_truncate_table_for_mysql(), trx_undo_rec_get_partial_row(), and trx_undo_rec_get_row_ref().
UNIV_INLINE ulint dtuple_fold | ( | const dtuple_t * | tuple, |
ulint | n_fields, | ||
ulint | n_bytes, | ||
index_id_t | tree_id | ||
) |
Folds a prefix given as the number of fields of a tuple.
tuple | in: the tuple |
n_fields | in: number of complete fields to fold |
n_bytes | in: number of bytes to fold in an incomplete last field |
tree_id | in: index tree id |
Referenced by btr_search_guess_on_hash().
UNIV_INLINE const dtuple_t* dtuple_from_fields | ( | dtuple_t * | tuple, |
const dfield_t * | fields, | ||
ulint | n_fields | ||
) |
Wrap data fields in a tuple. The default value for number of fields used in record comparisons for this tuple is n_fields.
tuple | in: storage for data tuple |
fields | in: fields |
UNIV_INLINE ulint dtuple_get_data_size | ( | const dtuple_t * | tuple, |
ulint | comp | ||
) |
The following function returns the sum of data lengths of a tuple. The space occupied by the field structs or the tuple struct is not counted.
tuple | in: typed data tuple |
UNIV_INLINE ulint dtuple_get_info_bits | ( | const dtuple_t * | tuple | ) |
Gets info bits in a data tuple.
Referenced by btr_root_raise_and_insert(), cmp_dtuple_rec_with_match(), and dict_index_build_node_ptr().
UNIV_INLINE ulint dtuple_get_n_ext | ( | const dtuple_t * | tuple | ) |
Computes the number of externally stored fields in a data tuple.
UNIV_INLINE ulint dtuple_get_n_fields | ( | const dtuple_t * | tuple | ) |
Gets number of fields in a data tuple.
Referenced by btr_cur_mark_dtuple_inherited_extern(), btr_cur_optimistic_insert(), btr_cur_unmark_dtuple_extern_fields(), btr_estimate_n_rows_in_range(), btr_search_guess_on_hash(), cmp_dtuple_is_prefix_of_rec(), dict_table_copy_types(), dtuple_check_typed_no_assert(), dtuple_coll_cmp(), dtuple_convert_big_rec(), dtuple_print(), opt_print_query_plan(), rec_convert_dtuple_to_rec(), row_build_row_ref_in_tuple(), row_search_for_mysql(), row_search_index_entry(), row_search_on_row_ref(), row_upd_build_difference_binary(), row_upd_build_sec_rec_difference_binary(), row_upd_replace(), and row_vers_impl_x_locked_off_kernel().
UNIV_INLINE ulint dtuple_get_n_fields_cmp | ( | const dtuple_t * | tuple | ) |
Gets number of fields used in record comparisons.
Referenced by cmp_dtuple_rec_with_match(), page_cur_search_with_match(), row_ins_check_foreign_constraint(), and row_search_for_mysql().
UNIV_INTERN void dtuple_print | ( | FILE * | f, |
const dtuple_t * | tuple | ||
) |
The following function prints the contents of a tuple. in: tuple
The following function prints the contents of a tuple.
f | in: output stream |
tuple | in: tuple |
Definition at line 532 of file data0data.cc.
References dtuple_get_n_fields(), and ut_ad.
UNIV_INLINE void dtuple_set_info_bits | ( | dtuple_t * | tuple, |
ulint | info_bits | ||
) |
Sets info bits in a data tuple. in: info bits
tuple | in: tuple |
Referenced by btr_root_raise_and_insert(), dict_index_build_node_ptr(), rec_copy_prefix_to_dtuple(), row_build(), row_rec_to_index_entry(), row_upd_index_replace_new_col_vals(), row_upd_index_replace_new_col_vals_index_pos(), and row_upd_replace().
UNIV_INTERN void dtuple_set_n_fields | ( | dtuple_t * | tuple, |
ulint | n_fields | ||
) |
Sets number of fields used in a tuple. Normally this is set in dtuple_create, but if you want later to set it smaller, you can use this. in: number of fields
Sets number of fields used in a tuple. Normally this is set in dtuple_create, but if you want later to set it smaller, you can use this.
tuple | in: tuple |
n_fields | in: number of fields |
Definition at line 132 of file data0data.cc.
References dtuple_struct::n_fields, dtuple_struct::n_fields_cmp, and ut_ad.
UNIV_INLINE void dtuple_set_n_fields_cmp | ( | dtuple_t * | tuple, |
ulint | n_fields_cmp | ||
) |
Gets number of fields used in record comparisons. in: number of fields used in comparisons in rem0cmp.*
tuple | in: tuple |
Referenced by dict_index_build_node_ptr(), row_build_index_entry(), row_ins_check_foreign_constraint(), and row_rec_to_index_entry_low().
UNIV_INLINE void dtuple_set_types_binary | ( | dtuple_t * | tuple, |
ulint | n | ||
) |
Sets types of fields binary in a tuple. in: number of fields to set
tuple | in: data tuple |
Referenced by dict_index_copy_types(), and row_vers_impl_x_locked_off_kernel().