Drizzled Public API Documentation

rem0rec.h File Reference
#include "univ.i"
#include "data0data.h"
#include "rem0types.h"
#include "mtr0types.h"
#include "page0types.h"

Go to the source code of this file.

Macros

#define rem0rec_h
 
#define REC_INFO_MIN_REC_FLAG   0x10UL
 
#define REC_INFO_DELETED_FLAG
 
#define REC_N_OLD_EXTRA_BYTES   6
 
#define REC_N_NEW_EXTRA_BYTES   5
 
#define REC_STATUS_ORDINARY   0
 
#define REC_STATUS_NODE_PTR   1
 
#define REC_STATUS_INFIMUM   2
 
#define REC_STATUS_SUPREMUM   3
 
#define REC_NEW_HEAP_NO   4
 
#define REC_HEAP_NO_SHIFT   3
 
#define REC_NODE_PTR_SIZE   4
 
#define REC_OFFS_HEADER_SIZE   2
 
#define REC_OFFS_NORMAL_SIZE   100
 
#define REC_OFFS_SMALL_SIZE   10
 
#define rec_get_offsets(rec, index, offsets, n, heap)   rec_get_offsets_func(rec,index,offsets,n,heap,__FILE__,__LINE__)
 
#define rec_offs_make_valid(rec, index, offsets)   ((void) 0)
 
#define rec_get_nth_field_old(rec, n, len)   ((rec) + rec_get_nth_field_offs_old(rec, n, len))
 
#define rec_get_nth_field(rec, offsets, n, len)   ((rec) + rec_get_nth_field_offs(offsets, n, len))
 
#define rec_offs_init(offsets)   rec_offs_set_n_alloc(offsets, (sizeof offsets) / sizeof *offsets)
 
#define rec_get_start(rec, offsets)   ((rec) - rec_offs_extra_size(offsets))
 
#define rec_get_end(rec, offsets)   ((rec) + rec_offs_data_size(offsets))
 
#define REC_INFO_BITS   6 /* This is single byte bit-field */
 
#define REC_1BYTE_OFFS_LIMIT   0x7FUL
 
#define REC_2BYTE_OFFS_LIMIT   0x7FFFUL
 
#define REC_MAX_DATA_SIZE   (16 * 1024)
 

Functions

UNIV_INLINE const rec_t * rec_get_next_ptr_const (const rec_t *rec, ulint comp)
 
UNIV_INLINE rec_t * rec_get_next_ptr (rec_t *rec, ulint comp)
 
UNIV_INLINE ulint rec_get_next_offs (const rec_t *rec, ulint comp)
 
UNIV_INLINE void rec_set_next_offs_old (rec_t *rec, ulint next)
 
UNIV_INLINE void rec_set_next_offs_new (rec_t *rec, ulint next)
 
UNIV_INLINE ulint rec_get_n_fields_old (const rec_t *rec)
 
UNIV_INLINE ulint rec_get_n_fields (const rec_t *rec, const dict_index_t *index)
 
UNIV_INLINE ulint rec_get_n_owned_old (const rec_t *rec)
 
UNIV_INLINE void rec_set_n_owned_old (rec_t *rec, ulint n_owned)
 
UNIV_INLINE ulint rec_get_n_owned_new (const rec_t *rec)
 
UNIV_INLINE void rec_set_n_owned_new (rec_t *rec, page_zip_des_t *page_zip, ulint n_owned)
 
UNIV_INLINE ulint rec_get_info_bits (const rec_t *rec, ulint comp)
 
UNIV_INLINE void rec_set_info_bits_old (rec_t *rec, ulint bits)
 
UNIV_INLINE void rec_set_info_bits_new (rec_t *rec, ulint bits)
 
UNIV_INLINE ulint rec_get_status (const rec_t *rec)
 
UNIV_INLINE void rec_set_status (rec_t *rec, ulint bits)
 
UNIV_INLINE ulint rec_get_info_and_status_bits (const rec_t *rec, ulint comp)
 
UNIV_INLINE void rec_set_info_and_status_bits (rec_t *rec, ulint bits)
 
UNIV_INLINE ulint rec_get_deleted_flag (const rec_t *rec, ulint comp)
 
UNIV_INLINE void rec_set_deleted_flag_old (rec_t *rec, ulint flag)
 
UNIV_INLINE void rec_set_deleted_flag_new (rec_t *rec, page_zip_des_t *page_zip, ulint flag)
 
UNIV_INLINE ibool rec_get_node_ptr_flag (const rec_t *rec)
 
UNIV_INLINE ulint rec_get_heap_no_old (const rec_t *rec)
 
UNIV_INLINE void rec_set_heap_no_old (rec_t *rec, ulint heap_no)
 
UNIV_INLINE ulint rec_get_heap_no_new (const rec_t *rec)
 
UNIV_INLINE void rec_set_heap_no_new (rec_t *rec, ulint heap_no)
 
UNIV_INLINE ibool rec_get_1byte_offs_flag (const rec_t *rec)
 
UNIV_INTERN ulint rec_get_n_extern_new (const rec_t *rec, dict_index_t *index, ulint n)
 
UNIV_INTERN ulint * rec_get_offsets_func (const rec_t *rec, const dict_index_t *index, ulint *offsets, ulint n_fields, mem_heap_t **heap, const char *file, ulint line)
 
UNIV_INTERN void rec_init_offsets_comp_ordinary (const rec_t *rec, ulint extra, const dict_index_t *index, ulint *offsets)
 
UNIV_INTERN void rec_get_offsets_reverse (const byte *extra, const dict_index_t *index, ulint node_ptr, ulint *offsets)
 
UNIV_INLINE ibool rec_offs_validate (const rec_t *rec, const dict_index_t *index, const ulint *offsets)
 
UNIV_INTERN ulint rec_get_nth_field_offs_old (const rec_t *rec, ulint n, ulint *len)
 
UNIV_INLINE ulint rec_get_nth_field_size (const rec_t *rec, ulint n)
 
UNIV_INLINE ulint rec_get_nth_field_offs (const ulint *offsets, ulint n, ulint *len)
 
UNIV_INLINE ulint rec_offs_comp (const ulint *offsets)
 
UNIV_INLINE ulint rec_offs_any_extern (const ulint *offsets)
 
UNIV_INLINE ulint rec_offs_nth_extern (const ulint *offsets, ulint n)
 
UNIV_INLINE ulint rec_offs_nth_sql_null (const ulint *offsets, ulint n)
 
UNIV_INLINE ulint rec_offs_nth_size (const ulint *offsets, ulint n)
 
UNIV_INLINE ulint rec_offs_n_extern (const ulint *offsets)
 
UNIV_INLINE void rec_set_nth_field (rec_t *rec, const ulint *offsets, ulint n, const void *data, ulint len)
 
UNIV_INLINE ulint rec_get_data_size_old (const rec_t *rec)
 
UNIV_INLINE ulint rec_offs_get_n_alloc (const ulint *offsets)
 
UNIV_INLINE void rec_offs_set_n_alloc (ulint *offsets, ulint n_alloc)
 
UNIV_INLINE ulint rec_offs_n_fields (const ulint *offsets)
 
UNIV_INLINE ulint rec_offs_data_size (const ulint *offsets)
 
UNIV_INLINE ulint rec_offs_extra_size (const ulint *offsets)
 
UNIV_INLINE ulint rec_offs_size (const ulint *offsets)
 
UNIV_INLINE rec_t * rec_copy (void *buf, const rec_t *rec, const ulint *offsets)
 
UNIV_INTERN rec_t * rec_copy_prefix_to_buf (const rec_t *rec, const dict_index_t *index, ulint n_fields, byte **buf, ulint *buf_size)
 
UNIV_INLINE ulint rec_fold (const rec_t *rec, const ulint *offsets, ulint n_fields, ulint n_bytes, index_id_t tree_id) __attribute__((pure))
 
UNIV_INTERN void rec_convert_dtuple_to_rec_comp (rec_t *rec, ulint extra, const dict_index_t *index, ulint status, const dfield_t *fields, ulint n_fields)
 
UNIV_INTERN rec_t * rec_convert_dtuple_to_rec (byte *buf, const dict_index_t *index, const dtuple_t *dtuple, ulint n_ext)
 
UNIV_INLINE ulint rec_get_converted_extra_size (ulint data_size, ulint n_fields, ulint n_ext) __attribute__((const ))
 
UNIV_INTERN ulint rec_get_converted_size_comp_prefix (const dict_index_t *index, const dfield_t *fields, ulint n_fields, ulint *extra)
 
UNIV_INTERN ulint rec_get_converted_size_comp (const dict_index_t *index, ulint status, const dfield_t *fields, ulint n_fields, ulint *extra)
 
UNIV_INLINE ulint rec_get_converted_size (dict_index_t *index, const dtuple_t *dtuple, ulint n_ext)
 
UNIV_INTERN void rec_copy_prefix_to_dtuple (dtuple_t *tuple, const rec_t *rec, const dict_index_t *index, ulint n_fields, mem_heap_t *heap)
 
UNIV_INTERN ibool rec_validate (const rec_t *rec, const ulint *offsets)
 
UNIV_INTERN void rec_print_old (FILE *file, const rec_t *rec)
 
UNIV_INTERN void rec_print_comp (FILE *file, const rec_t *rec, const ulint *offsets)
 
UNIV_INTERN void rec_print_new (FILE *file, const rec_t *rec, const ulint *offsets)
 
UNIV_INTERN void rec_print (FILE *file, const rec_t *rec, const dict_index_t *index)
 

Detailed Description

Record manager

Created 5/30/1994 Heikki Tuuri

Definition in file rem0rec.h.

Macro Definition Documentation

#define REC_INFO_DELETED_FLAG
Value:
0x20UL /* when bit is set to 1, it means the
record has been delete marked */

Definition at line 42 of file rem0rec.h.

Function Documentation

UNIV_INTERN rec_t* rec_convert_dtuple_to_rec ( byte *  buf,
const dict_index_t index,
const dtuple_t dtuple,
ulint  n_ext 
)

Builds a physical record out of a data tuple and stores it into the given buffer.

Returns
pointer to the origin of physical record in: number of externally stored columns

Builds a physical record out of a data tuple and stores it beginning from the start of the given buffer.

Returns
pointer to the origin of physical record
Parameters
bufin: start address of the physical record
indexin: record descriptor
dtuplein: data tuple
n_extin: number of externally stored columns

Definition at line 1240 of file rem0rec.cc.

References dfield_is_ext(), dict_table_is_comp(), dtuple_check_typed(), dtuple_get_n_fields(), mem_heap_free, rec_convert_dtuple_to_rec(), rec_offs_n_fields(), rec_offs_nth_extern(), rec_validate(), dict_index_struct::table, and ut_ad.

Referenced by btr_page_split_and_insert(), rec_convert_dtuple_to_rec(), and trx_undo_prev_version_build().

UNIV_INTERN void rec_convert_dtuple_to_rec_comp ( rec_t *  rec,
ulint  extra,
const dict_index_t index,
ulint  status,
const dfield_t fields,
ulint  n_fields 
)

Builds a ROW_FORMAT=COMPACT record out of a data tuple. in: number of data fields

Builds a ROW_FORMAT=COMPACT record out of a data tuple.

Parameters
recin: origin of record
extrain: number of bytes to reserve between the record header and the data payload (normally REC_N_NEW_EXTRA_BYTES)
indexin: record descriptor
statusin: status bits of the record
fieldsin: array of data fields
n_fieldsin: number of data fields

Definition at line 1073 of file rem0rec.cc.

References BTR_EXTERN_FIELD_REF_SIZE, dict_field_struct::col, dfield_get_len(), dfield_is_ext(), dfield_is_null(), dict_index_get_n_fields(), dict_index_get_n_unique_in_tree(), dict_table_is_comp(), dtype_get_len(), dtype_get_mtype(), dtype_get_prtype(), dict_field_struct::fixed_len, dict_col_struct::len, dict_col_struct::mtype, dict_index_struct::n_nullable, rec_convert_dtuple_to_rec_comp(), dict_index_struct::table, ut_ad, UT_BITS_IN_BYTES, and ut_error.

Referenced by rec_convert_dtuple_to_rec_comp().

UNIV_INLINE rec_t* rec_copy ( void *  buf,
const rec_t *  rec,
const ulint *  offsets 
)

Copies a physical record to a buffer.

Returns
pointer to the origin of the copy in: array returned by rec_get_offsets()
Parameters
bufin: buffer
recin: physical record

Referenced by page_copy_rec_list_end_to_created_page(), page_cur_insert_rec_low(), page_cur_insert_rec_zip(), row_build(), row_build_row_ref(), row_rec_to_index_entry(), row_vers_build_for_consistent_read(), row_vers_build_for_semi_consistent_read(), and trx_undo_prev_version_build().

UNIV_INTERN rec_t* rec_copy_prefix_to_buf ( const rec_t *  rec,
const dict_index_t index,
ulint  n_fields,
byte **  buf,
ulint *  buf_size 
)

Copies the first n fields of a physical record to a new physical record in a buffer.

Returns
own: copied record in/out: buffer size

Copies the first n fields of a physical record to a new physical record in a buffer.

Returns
own: copied record
Parameters
recin: physical record
indexin: record descriptor
n_fieldsin: number of fields to copy
bufin/out: memory buffer for the copied prefix, or NULL
buf_sizein/out: buffer size

Definition at line 1383 of file rem0rec.cc.

References dict_field_get_col(), dict_index_get_n_fields(), dict_index_get_n_unique_in_tree(), dict_table_is_comp(), dict_field_struct::fixed_len, dict_col_struct::len, mem_free, dict_col_struct::mtype, dict_index_struct::n_nullable, dict_col_struct::prtype, rec_copy_prefix_to_buf(), rec_get_status(), dict_index_struct::table, ut_ad, UT_BITS_IN_BYTES, and ut_error.

Referenced by dict_index_copy_rec_order_prefix(), and rec_copy_prefix_to_buf().

UNIV_INTERN void rec_copy_prefix_to_dtuple ( dtuple_t tuple,
const rec_t *  rec,
const dict_index_t index,
ulint  n_fields,
mem_heap_t heap 
)

Copies the first n fields of a physical record to a data tuple. The fields are copied to the memory heap. in: memory heap

Copies the first n fields of a physical record to a data tuple. The fields are copied to the memory heap.

Parameters
tupleout: data tuple
recin: physical record
indexin: record descriptor
n_fieldsin: number of fields to copy
heapin: memory heap

Definition at line 1293 of file rem0rec.cc.

References dfield_set_data(), dfield_set_null(), dict_table_is_comp(), dtuple_check_typed(), dtuple_set_info_bits(), mem_heap_dup(), rec_copy_prefix_to_dtuple(), rec_get_info_bits(), rec_offs_nth_extern(), rec_validate(), dict_index_struct::table, and ut_ad.

Referenced by dict_index_build_data_tuple(), dict_index_build_node_ptr(), and rec_copy_prefix_to_dtuple().

UNIV_INLINE ulint rec_fold ( const rec_t *  rec,
const ulint *  offsets,
ulint  n_fields,
ulint  n_bytes,
index_id_t  tree_id 
)

Folds a prefix of a physical record to a ulint.

Returns
the folded value
Parameters
recin: the physical record
offsetsin: array returned by rec_get_offsets()
n_fieldsin: number of complete fields to fold
n_bytesin: number of bytes to fold in an incomplete last field
tree_idin: index tree id

Referenced by btr_search_drop_page_hash_index(), btr_search_update_hash_on_delete(), and btr_search_update_hash_on_insert().

UNIV_INLINE ibool rec_get_1byte_offs_flag ( const rec_t *  rec)

The following function is used to test whether the data offsets in the record are stored in one-byte or two-byte format.

Returns
TRUE if 1-byte form in: physical record

Referenced by rec_get_nth_field_offs_old(), and rec_print_old().

UNIV_INLINE ulint rec_get_converted_extra_size ( ulint  data_size,
ulint  n_fields,
ulint  n_ext 
) const

Returns the extra size of an old-style physical record if we know its data size and number of fields.

Returns
extra size
Parameters
data_sizein: data size
n_fieldsin: number of fields
n_extin: number of externally stored columns
UNIV_INLINE ulint rec_get_converted_size ( dict_index_t index,
const dtuple_t dtuple,
ulint  n_ext 
)

The following function returns the size of a data tuple when converted to a physical record.

Returns
size in: number of externally stored columns
Parameters
indexin: record descriptor
dtuplein: data tuple

Referenced by btr_cur_optimistic_update(), btr_page_split_and_insert(), dtuple_convert_big_rec(), ibuf_insert(), ibuf_merge_or_delete_for_page(), and trx_undo_prev_version_build().

UNIV_INTERN ulint rec_get_converted_size_comp ( const dict_index_t index,
ulint  status,
const dfield_t fields,
ulint  n_fields,
ulint *  extra 
)

Determines the size of a data tuple in ROW_FORMAT=COMPACT.

Returns
total size out: extra size

Determines the size of a data tuple in ROW_FORMAT=COMPACT.

Returns
total size
Parameters
indexin: record descriptor; dict_table_is_comp() is assumed to hold, even if it does not
statusin: status bits of the record
fieldsin: array of data fields
n_fieldsin: number of data fields
extraout: extra size

Definition at line 854 of file rem0rec.cc.

References dfield_get_len(), dict_index_get_n_fields(), dict_index_get_n_unique_in_tree(), rec_get_converted_size_comp(), rec_get_converted_size_comp_prefix(), ut_ad, and ut_error.

Referenced by rec_get_converted_size_comp().

UNIV_INTERN ulint rec_get_converted_size_comp_prefix ( const dict_index_t index,
const dfield_t fields,
ulint  n_fields,
ulint *  extra 
)

Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.

Returns
total size out: extra size

Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT.

Returns
total size
Parameters
indexin: record descriptor; dict_table_is_comp() is assumed to hold, even if it does not
fieldsin: array of data fields
n_fieldsin: number of data fields
extraout: extra size

Definition at line 771 of file rem0rec.cc.

References dfield_get_len(), dfield_is_ext(), dfield_is_null(), dict_field_get_col(), dict_index_get_n_fields(), dict_field_struct::fixed_len, dict_col_struct::len, dict_col_struct::mtype, dict_index_struct::n_nullable, dict_field_struct::prefix_len, dict_col_struct::prtype, rec_get_converted_size_comp_prefix(), ut_ad, and UT_BITS_IN_BYTES.

Referenced by rec_get_converted_size_comp(), and rec_get_converted_size_comp_prefix().

UNIV_INLINE ulint rec_get_data_size_old ( const rec_t *  rec)

The following function returns the data size of an old-style physical record, that is the sum of field lengths. SQL null fields are counted as length 0 fields. The value returned by the function is the distance from record origin to record end in bytes.

Returns
size in: physical record

Referenced by lock_move_rec_list_end(), lock_move_rec_list_start(), and lock_move_reorganize_page().

UNIV_INLINE ulint rec_get_heap_no_new ( const rec_t *  rec)
UNIV_INLINE ulint rec_get_heap_no_old ( const rec_t *  rec)

The following function is used to get the order number of an old-style record in the heap of the index page.

Returns
heap order number in: physical record

Referenced by lock_clust_rec_modify_check_and_lock(), lock_move_rec_list_end(), lock_move_rec_list_start(), lock_move_reorganize_page(), lock_update_delete(), lock_update_discard(), lock_update_insert(), page_cur_insert_rec_low(), page_find_rec_with_heap_no(), page_rec_print(), and page_rec_validate().

UNIV_INLINE ulint rec_get_info_and_status_bits ( const rec_t *  rec,
ulint  comp 
)

The following function is used to retrieve the info and status bits of a record. (Only compact records have status bits.)

Returns
info bits in: nonzero=compact page format
Parameters
recin: physical record

Referenced by page_cur_parse_insert_rec().

UNIV_INLINE ulint rec_get_info_bits ( const rec_t *  rec,
ulint  comp 
)

The following function is used to retrieve the info bits of a record.

Returns
info bits in: nonzero=compact page format
Parameters
recin: physical record

Referenced by btr_cur_search_to_nth_level(), btr_set_min_rec_mark(), cmp_dtuple_rec_with_match(), cmp_rec_rec_with_match(), rec_copy_prefix_to_dtuple(), rec_print_new(), rec_print_old(), row_build(), and row_rec_to_index_entry().

UNIV_INTERN ulint rec_get_n_extern_new ( const rec_t *  rec,
dict_index_t index,
ulint  n 
)

Determine how many of the first n columns in a compact physical record are stored externally.

Returns
number of externally stored columns in: number of columns to scan

Determine how many of the first n columns in a compact physical record are stored externally.

Returns
number of externally stored columns
Parameters
recin: compact physical record
indexin: record descriptor
nin: number of columns to scan

Definition at line 162 of file rem0rec.cc.

References dict_field_get_col(), dict_index_get_n_fields(), dict_table_is_comp(), dict_field_struct::fixed_len, dict_col_struct::len, dict_col_struct::mtype, dict_index_struct::n_nullable, rec_get_n_extern_new(), rec_get_status(), dict_index_struct::table, ut_ad, and UT_BITS_IN_BYTES.

Referenced by rec_get_n_extern_new().

UNIV_INLINE ulint rec_get_n_fields ( const rec_t *  rec,
const dict_index_t index 
)

The following function is used to get the number of fields in a record.

Returns
number of data fields in: record descriptor
Parameters
recin: physical record
UNIV_INLINE ulint rec_get_n_fields_old ( const rec_t *  rec)
UNIV_INLINE ulint rec_get_n_owned_new ( const rec_t *  rec)

The following function is used to get the number of records owned by the previous directory record.

Returns
number of owned records in: new-style physical record

Referenced by page_cur_insert_rec_low(), page_cur_insert_rec_zip(), page_delete_rec_list_end(), page_dir_find_owner_slot(), page_rec_get_n_recs_before(), page_rec_print(), page_rec_validate(), page_simple_validate_new(), and page_validate().

UNIV_INLINE ulint rec_get_n_owned_old ( const rec_t *  rec)

The following function is used to get the number of records owned by the previous directory record.

Returns
number of owned records in: old-style physical record

Referenced by page_cur_insert_rec_low(), page_delete_rec_list_end(), page_dir_find_owner_slot(), page_rec_get_n_recs_before(), page_rec_print(), page_rec_validate(), page_simple_validate_old(), and page_validate().

UNIV_INLINE ulint rec_get_next_offs ( const rec_t *  rec,
ulint  comp 
)

The following function is used to get the offset of the next chained record on the same page.

Returns
the page offset of the next chained record, or 0 if none in: nonzero=compact page format
Parameters
recin: physical record

Referenced by lock_update_delete(), lock_update_discard(), page_find_rec_with_heap_no(), page_rec_print(), page_simple_validate_new(), page_simple_validate_old(), page_zip_copy_recs(), and row_search_for_mysql().

UNIV_INLINE rec_t* rec_get_next_ptr ( rec_t *  rec,
ulint  comp 
)

The following function is used to get the pointer of the next chained record on the same page.

Returns
pointer to the next chained record, or NULL if none in: nonzero=compact page format
Parameters
recin: physical record

Referenced by page_copy_rec_list_end(), page_copy_rec_list_start(), page_cur_insert_rec_low(), page_cur_insert_rec_zip(), page_delete_rec_list_end(), and page_dir_balance_slot().

UNIV_INLINE const rec_t* rec_get_next_ptr_const ( const rec_t *  rec,
ulint  comp 
)

The following function is used to get the pointer of the next chained record on the same page.

Returns
pointer to the next chained record, or NULL if none in: nonzero=compact page format
Parameters
recin: physical record

Referenced by page_dir_find_owner_slot(), and page_rec_get_n_recs_before().

UNIV_INLINE ibool rec_get_node_ptr_flag ( const rec_t *  rec)

The following function tells if a new-style record is a node pointer.

Returns
TRUE if node pointer in: physical record

Referenced by page_cur_insert_rec_low(), page_cur_insert_rec_zip(), and page_validate().

UNIV_INLINE ulint rec_get_nth_field_offs ( const ulint *  offsets,
ulint  n,
ulint *  len 
)

The following function is used to get an offset to the nth data field in a record.

Returns
offset from the origin of rec out: length of the field; UNIV_SQL_NULL if SQL null
Parameters
offsetsin: array returned by rec_get_offsets()
nin: index of the field

Referenced by btr_index_rec_validate(), page_cur_insert_rec_zip(), and row_get_trx_id_offset().

UNIV_INTERN ulint rec_get_nth_field_offs_old ( const rec_t *  rec,
ulint  n,
ulint *  len 
)

The following function is used to get the offset to the nth data field in an old-style record.

Returns
offset to the field out: length of the field; UNIV_SQL_NULL if SQL null

The following function is used to get the offset to the nth data field in an old-style record.

Returns
offset to the field
Parameters
recin: record
nin: index of the field
lenout: length of the field; UNIV_SQL_NULL if SQL null

Definition at line 718 of file rem0rec.cc.

References rec_get_1byte_offs_flag(), rec_get_n_fields_old(), rec_get_nth_field_offs_old(), ut_a, and ut_ad.

Referenced by dict_load_column_low(), dict_load_field_low(), dict_load_index_low(), dict_load_table_low(), dict_process_sys_foreign_col_rec(), dict_process_sys_foreign_rec(), and rec_get_nth_field_offs_old().

UNIV_INLINE ulint rec_get_nth_field_size ( const rec_t *  rec,
ulint  n 
)

Gets the physical size of an old-style field. Also an SQL null may have a field of size > 0, if the data type is of a fixed size.

Returns
field size in bytes in: index of the field
Parameters
recin: record

Referenced by rec_print_old(), and rec_validate().

UNIV_INTERN ulint* rec_get_offsets_func ( const rec_t *  rec,
const dict_index_t index,
ulint *  offsets,
ulint  n_fields,
mem_heap_t **  heap,
const char *  file,
ulint  line 
)

The following function determines the offsets to each field in the record. It can reuse a previously allocated array.

Returns
the new offsets in: line number where called

The following function determines the offsets to each field in the record. It can reuse a previously returned array.

Returns
the new offsets
Parameters
recin: physical record
indexin: record descriptor
offsetsin/out: array consisting of offsets[0] allocated elements, or an array from rec_get_offsets(), or NULL
n_fieldsin: maximum number of initialized fields (ULINT_UNDEFINED if all fields)
heapin/out: memory heap
filein: file name where called
linein: line number where called

Definition at line 524 of file rem0rec.cc.

References dict_index_get_n_fields(), dict_index_get_n_unique_in_tree(), dict_table_is_comp(), mem_heap_alloc(), mem_heap_create_func(), rec_get_n_fields_old(), rec_get_offsets_func(), rec_get_status(), rec_offs_get_n_alloc(), rec_offs_set_n_alloc(), dict_index_struct::table, ut_ad, and ut_error.

Referenced by rec_get_offsets_func().

UNIV_INTERN void rec_get_offsets_reverse ( const byte *  extra,
const dict_index_t index,
ulint  node_ptr,
ulint *  offsets 
)

The following function determines the offsets to each field in the record. It can reuse a previously allocated array. in/out: array consisting of offsets[0] allocated elements

The following function determines the offsets to each field in the record. It can reuse a previously allocated array.

Parameters
extrain: the extra bytes of a compact record in reverse order, excluding the fixed-size REC_N_NEW_EXTRA_BYTES
indexin: record descriptor
node_ptrin: nonzero=node pointer, 0=leaf node
offsetsin/out: array consisting of offsets[0] allocated elements

Definition at line 595 of file rem0rec.cc.

References dict_field_get_col(), dict_index_get_n_fields(), dict_index_get_n_unique_in_tree(), dict_table_is_comp(), dict_field_struct::fixed_len, dict_col_struct::len, dict_col_struct::mtype, dict_index_struct::n_nullable, rec_get_offsets_reverse(), rec_offs_get_n_alloc(), rec_offs_n_fields(), dict_index_struct::table, ut_a, ut_ad, and UT_BITS_IN_BYTES.

Referenced by rec_get_offsets_reverse().

UNIV_INLINE ulint rec_get_status ( const rec_t *  rec)

The following function retrieves the status bits of a new-style record.

Returns
status bits in: physical record

Referenced by page_cur_insert_rec_low(), page_cur_insert_rec_zip(), rec_copy_prefix_to_buf(), rec_get_n_extern_new(), and rec_get_offsets_func().

UNIV_INTERN void rec_init_offsets_comp_ordinary ( const rec_t *  rec,
ulint  extra,
const dict_index_t index,
ulint *  offsets 
)

Determine the offset to each field in a leaf-page record in ROW_FORMAT=COMPACT. This is a special case of rec_init_offsets() and rec_get_offsets_func(). in/out: array of offsets; in: n=rec_offs_n_fields(offsets)

Determine the offset to each field in a leaf-page record in ROW_FORMAT=COMPACT. This is a special case of rec_init_offsets() and rec_get_offsets_func().

Parameters
recin: physical record in ROW_FORMAT=COMPACT
extrain: number of bytes to reserve between the record header and the data payload (usually REC_N_NEW_EXTRA_BYTES)
indexin: record descriptor
offsetsin/out: array of offsets; in: n=rec_offs_n_fields(offsets)

Definition at line 244 of file rem0rec.cc.

References dict_field_get_col(), dict_index_is_clust(), dict_field_struct::fixed_len, dict_col_struct::len, dict_col_struct::mtype, dict_index_struct::n_nullable, rec_init_offsets_comp_ordinary(), rec_offs_n_fields(), ut_ad, and UT_BITS_IN_BYTES.

Referenced by rec_init_offsets_comp_ordinary().

UNIV_INLINE ulint rec_offs_any_extern ( const ulint *  offsets)

Determine if the offsets are for a record containing externally stored columns.

Returns
nonzero if externally stored in: array returned by rec_get_offsets()

Referenced by btr_cur_optimistic_update(), page_zip_write_rec(), row_build_row_ref(), and row_build_row_ref_in_tuple().

UNIV_INLINE ulint rec_offs_data_size ( const ulint *  offsets)

The following function returns the data size of a physical record, that is the sum of field lengths. SQL null fields are counted as length 0 fields. The value returned by the function is the distance from record origin to record end in bytes.

Returns
size in: array returned by rec_get_offsets()

Referenced by page_cur_insert_rec_low(), page_cur_insert_rec_zip(), page_zip_write_rec(), page_zip_write_trx_id_and_roll_ptr(), and rec_validate().

UNIV_INLINE ulint rec_offs_extra_size ( const ulint *  offsets)

Returns the total size of record minus data size of record. The value returned by the function is the distance from record start to record origin in bytes.

Returns
size in: array returned by rec_get_offsets()

Referenced by page_cur_insert_rec_low(), page_cur_insert_rec_zip(), page_cur_parse_insert_rec(), page_delete_rec_list_end(), page_zip_write_rec(), page_zip_write_trx_id_and_roll_ptr(), and row_search_for_mysql().

UNIV_INLINE ulint rec_offs_get_n_alloc ( const ulint *  offsets)

The following function returns the number of allocated elements for an array of offsets.

Returns
number of elements in: array for rec_get_offsets()

Referenced by rec_get_offsets_func(), rec_get_offsets_reverse(), and row_check_index_for_mysql().

UNIV_INLINE ulint rec_offs_n_extern ( const ulint *  offsets)

Returns the number of extern bits set in a record.

Returns
number of externally stored fields in: array returned by rec_get_offsets()

Referenced by row_build().

UNIV_INLINE ulint rec_offs_n_fields ( const ulint *  offsets)
UNIV_INLINE ulint rec_offs_nth_extern ( const ulint *  offsets,
ulint  n 
)

Returns nonzero if the extern bit is set in nth field of rec.

Returns
nonzero if externally stored in: nth field
Parameters
offsetsin: array returned by rec_get_offsets()

Referenced by cmp_dtuple_rec_with_match(), cmp_rec_rec_simple(), cmp_rec_rec_with_match(), rec_convert_dtuple_to_rec(), rec_copy_prefix_to_dtuple(), row_build(), row_rec_to_index_entry_low(), row_upd_build_difference_binary(), row_upd_changes_field_size_or_external(), and row_upd_rec_in_place().

UNIV_INLINE ulint rec_offs_nth_size ( const ulint *  offsets,
ulint  n 
)

Gets the physical size of a field.

Returns
length of field in: nth field
Parameters
offsetsin: array returned by rec_get_offsets()

Referenced by row_upd_changes_field_size_or_external().

UNIV_INLINE ulint rec_offs_nth_sql_null ( const ulint *  offsets,
ulint  n 
)

Returns nonzero if the SQL NULL bit is set in nth field of rec.

Returns
nonzero if SQL NULL in: nth field
Parameters
offsetsin: array returned by rec_get_offsets()

Referenced by row_upd_changes_field_size_or_external().

UNIV_INLINE void rec_offs_set_n_alloc ( ulint *  offsets,
ulint  n_alloc 
)

The following function sets the number of allocated elements for an array of offsets. in: number of elements

Parameters
offsetsout: array for rec_get_offsets(), must be allocated

Referenced by rec_get_offsets_func().

UNIV_INTERN void rec_print ( FILE *  file,
const rec_t *  rec,
const dict_index_t index 
)

Prints a physical record. in: record descriptor

Prints a physical record.

Parameters
filein: file where to print
recin: physical record
indexin: record descriptor

Definition at line 1750 of file rem0rec.cc.

References dict_table_is_comp(), mem_heap_free, rec_print(), rec_print_new(), dict_index_struct::table, and ut_ad.

Referenced by btr_cur_del_mark_set_sec_rec(), rec_print(), and trx_undo_prev_version_build().

UNIV_INTERN void rec_print_comp ( FILE *  file,
const rec_t *  rec,
const ulint *  offsets 
)

Prints a physical record in ROW_FORMAT=COMPACT. Ignores the record header. in: array returned by rec_get_offsets()

Prints a physical record in ROW_FORMAT=COMPACT. Ignores the record header.

Parameters
filein: file where to print
recin: physical record
offsetsin: array returned by rec_get_offsets()

Definition at line 1684 of file rem0rec.cc.

References rec_offs_n_fields(), rec_print_comp(), and ut_print_buf().

Referenced by rec_print_comp(), and rec_print_new().

UNIV_INTERN void rec_print_new ( FILE *  file,
const rec_t *  rec,
const ulint *  offsets 
)

Prints a physical record. in: array returned by rec_get_offsets()

Prints a physical record.

Parameters
filein: file where to print
recin: physical record
offsetsin: array returned by rec_get_offsets()

Definition at line 1722 of file rem0rec.cc.

References rec_get_info_bits(), rec_offs_comp(), rec_offs_n_fields(), rec_offs_validate(), rec_print_comp(), rec_print_new(), rec_validate(), and ut_ad.

Referenced by btr_cur_del_mark_set_clust_rec(), btr_cur_optimistic_update(), btr_cur_update_in_place(), btr_index_rec_validate(), lock_check_trx_id_sanity(), lock_rec_print(), page_rec_print(), page_validate(), rec_print(), rec_print_new(), row_check_index_for_mysql(), and trx_undo_prev_version_build().

UNIV_INTERN void rec_print_old ( FILE *  file,
const rec_t *  rec 
)

Prints an old-style physical record. in: physical record

Prints an old-style physical record.

Parameters
filein: file where to print
recin: physical record

Definition at line 1630 of file rem0rec.cc.

References rec_get_1byte_offs_flag(), rec_get_info_bits(), rec_get_n_fields_old(), rec_get_nth_field_size(), ut_ad, and ut_print_buf().

UNIV_INLINE void rec_set_deleted_flag_new ( rec_t *  rec,
page_zip_des_t page_zip,
ulint  flag 
)

The following function is used to set the deleted bit. in: nonzero if delete marked

Parameters
recin/out: new-style physical record
page_zipin/out: compressed page, or NULL
UNIV_INLINE void rec_set_deleted_flag_old ( rec_t *  rec,
ulint  flag 
)

The following function is used to set the deleted bit. in: nonzero if delete marked

Parameters
recin: old-style physical record
UNIV_INLINE void rec_set_heap_no_new ( rec_t *  rec,
ulint  heap_no 
)

The following function is used to set the heap number field in a new-style record. in: the heap number

Parameters
recin/out: physical record

Referenced by page_copy_rec_list_end_to_created_page(), page_cur_insert_rec_low(), and page_cur_insert_rec_zip().

UNIV_INLINE void rec_set_heap_no_old ( rec_t *  rec,
ulint  heap_no 
)

The following function is used to set the heap number field in an old-style record. in: the heap number

Parameters
recin: physical record

Referenced by page_copy_rec_list_end_to_created_page(), and page_cur_insert_rec_low().

UNIV_INLINE void rec_set_info_and_status_bits ( rec_t *  rec,
ulint  bits 
)

The following function is used to set the info and status bits of a record. (Only compact records have status bits.) in: info bits

Parameters
recin/out: compact physical record

Referenced by page_cur_parse_insert_rec().

UNIV_INLINE void rec_set_info_bits_new ( rec_t *  rec,
ulint  bits 
)

The following function is used to set the info bits of a record. in: info bits

Parameters
recin/out: new-style physical record

Referenced by btr_set_min_rec_mark(), and row_upd_rec_in_place().

UNIV_INLINE void rec_set_info_bits_old ( rec_t *  rec,
ulint  bits 
)

The following function is used to set the info bits of a record. in: info bits

Parameters
recin: old-style physical record

Referenced by btr_set_min_rec_mark(), page_cur_parse_insert_rec(), and row_upd_rec_in_place().

UNIV_INLINE void rec_set_n_owned_new ( rec_t *  rec,
page_zip_des_t page_zip,
ulint  n_owned 
)

The following function is used to set the number of owned records. in: the number of owned

Parameters
recin/out: new-style physical record
page_zipin/out: compressed page, or NULL

Referenced by page_copy_rec_list_end_to_created_page(), page_cur_insert_rec_low(), page_cur_insert_rec_zip(), and page_dir_balance_slot().

UNIV_INLINE void rec_set_n_owned_old ( rec_t *  rec,
ulint  n_owned 
)

The following function is used to set the number of owned records. in: the number of owned

Parameters
recin: old-style physical record

Referenced by page_copy_rec_list_end_to_created_page(), page_cur_insert_rec_low(), and page_dir_balance_slot().

UNIV_INLINE void rec_set_next_offs_new ( rec_t *  rec,
ulint  next 
)

The following function is used to set the next record offset field of a new-style record. in: offset of the next record

Parameters
recin/out: new-style physical record

Referenced by page_copy_rec_list_end_to_created_page().

UNIV_INLINE void rec_set_next_offs_old ( rec_t *  rec,
ulint  next 
)

The following function is used to set the next record offset field of an old-style record. in: offset of the next record

Parameters
recin: old-style physical record

Referenced by page_copy_rec_list_end_to_created_page().

UNIV_INLINE void rec_set_nth_field ( rec_t *  rec,
const ulint *  offsets,
ulint  n,
const void *  data,
ulint  len 
)

This is used to modify the value of an already existing field in a record. The previous value must have exactly the same size as the new value. If len is UNIV_SQL_NULL then the field is treated as an SQL null. For records in ROW_FORMAT=COMPACT (new-style records), len must not be UNIV_SQL_NULL unless the field already is SQL null. in: length of the data or UNIV_SQL_NULL

Parameters
recin: record
offsetsin: array returned by rec_get_offsets()
nin: index number of the field
datain: pointer to the data if not SQL null

Referenced by row_upd_rec_in_place().

UNIV_INLINE void rec_set_status ( rec_t *  rec,
ulint  bits 
)

The following function is used to set the status bits of a new-style record. in: info bits

Parameters
recin/out: physical record
UNIV_INTERN ibool rec_validate ( const rec_t *  rec,
const ulint *  offsets 
)

Validates the consistency of a physical record.

Returns
TRUE if ok in: array returned by rec_get_offsets()

Validates the consistency of a physical record.

Returns
TRUE if ok
Parameters
recin: physical record
offsetsin: array returned by rec_get_offsets()

Definition at line 1564 of file rem0rec.cc.

References rec_get_n_fields_old(), rec_get_nth_field_size(), rec_offs_comp(), rec_offs_data_size(), rec_offs_n_fields(), rec_validate(), and ut_a.

Referenced by page_rec_print(), page_rec_validate(), rec_convert_dtuple_to_rec(), rec_copy_prefix_to_dtuple(), rec_print_new(), rec_validate(), and row_search_for_mysql().