📄 rem0rec.h
字号:
/************************************************************************Record manager(c) 1994-1996 Innobase OyCreated 5/30/1994 Heikki Tuuri*************************************************************************/#ifndef rem0rec_h#define rem0rec_h#include "univ.i"#include "data0data.h"#include "rem0types.h"#include "mtr0types.h"/* Maximum values for various fields (for non-blob tuples) */#define REC_MAX_N_FIELDS (1024 - 1)#define REC_MAX_HEAP_NO (2 * 8192 - 1)#define REC_MAX_N_OWNED (16 - 1)/* Flag denoting the predefined minimum record: this bit is ORed in the 4info bits of a record */#define REC_INFO_MIN_REC_FLAG 0x10UL/* Number of extra bytes in an old-style record,in addition to the data and the offsets */#define REC_N_OLD_EXTRA_BYTES 6/* Number of extra bytes in a new-style record,in addition to the data and the offsets */#define REC_N_NEW_EXTRA_BYTES 5/* Record status values */#define REC_STATUS_ORDINARY 0#define REC_STATUS_NODE_PTR 1#define REC_STATUS_INFIMUM 2#define REC_STATUS_SUPREMUM 3/* Number of elements that should be initially allocated for theoffsets[] array, first passed to rec_get_offsets() */#define REC_OFFS_NORMAL_SIZE 100#define REC_OFFS_SMALL_SIZE 10/**********************************************************The following function is used to get the offset of thenext chained record on the same page. */UNIV_INLINEulint rec_get_next_offs(/*==============*/ /* out: the page offset of the next chained record */ rec_t* rec, /* in: physical record */ ulint comp); /* in: nonzero=compact page format *//**********************************************************The following function is used to set the next record offset fieldof the record. */UNIV_INLINEvoidrec_set_next_offs(/*==============*/ rec_t* rec, /* in: physical record */ ulint comp, /* in: nonzero=compact page format */ ulint next); /* in: offset of the next record *//**********************************************************The following function is used to get the number of fieldsin an old-style record. */UNIV_INLINEulintrec_get_n_fields_old(/*=================*/ /* out: number of data fields */ rec_t* rec); /* in: physical record *//**********************************************************The following function is used to get the number of fieldsin a record. */UNIV_INLINEulintrec_get_n_fields(/*=============*/ /* out: number of data fields */ rec_t* rec, /* in: physical record */ dict_index_t* index); /* in: record descriptor *//**********************************************************The following function is used to get the number of recordsowned by the previous directory record. */UNIV_INLINEulintrec_get_n_owned(/*============*/ /* out: number of owned records */ rec_t* rec, /* in: physical record */ ulint comp); /* in: nonzero=compact page format *//**********************************************************The following function is used to set the number of ownedrecords. */UNIV_INLINEvoidrec_set_n_owned(/*============*/ rec_t* rec, /* in: physical record */ ulint comp, /* in: nonzero=compact page format */ ulint n_owned); /* in: the number of owned *//**********************************************************The following function is used to retrieve the info bits ofa record. */UNIV_INLINEulintrec_get_info_bits(/*==============*/ /* out: info bits */ rec_t* rec, /* in: physical record */ ulint comp); /* in: nonzero=compact page format *//**********************************************************The following function is used to set the info bits of a record. */UNIV_INLINEvoidrec_set_info_bits(/*==============*/ rec_t* rec, /* in: physical record */ ulint comp, /* in: nonzero=compact page format */ ulint bits); /* in: info bits *//**********************************************************The following function retrieves the status bits of a new-style record. */UNIV_INLINEulintrec_get_status(/*===========*/ /* out: status bits */ rec_t* rec); /* in: physical record *//**********************************************************The following function is used to set the status bits of a new-style record. */UNIV_INLINEvoidrec_set_status(/*===========*/ rec_t* rec, /* in: physical record */ ulint bits); /* in: info bits *//**********************************************************The following function is used to retrieve the info and statusbits of a record. (Only compact records have status bits.) */UNIV_INLINEulintrec_get_info_and_status_bits(/*=========================*/ /* out: info bits */ rec_t* rec, /* in: physical record */ ulint comp); /* in: nonzero=compact page format *//**********************************************************The following function is used to set the info and statusbits of a record. (Only compact records have status bits.) */UNIV_INLINEvoidrec_set_info_and_status_bits(/*=========================*/ rec_t* rec, /* in: physical record */ ulint comp, /* in: nonzero=compact page format */ ulint bits); /* in: info bits *//**********************************************************The following function tells if record is delete marked. */UNIV_INLINEulintrec_get_deleted_flag(/*=================*/ /* out: nonzero if delete marked */ rec_t* rec, /* in: physical record */ ulint comp); /* in: nonzero=compact page format *//**********************************************************The following function is used to set the deleted bit. */UNIV_INLINEvoidrec_set_deleted_flag(/*=================*/ rec_t* rec, /* in: physical record */ ulint comp, /* in: nonzero=compact page format */ ulint flag); /* in: nonzero if delete marked *//**********************************************************The following function tells if a new-style record is a node pointer. */UNIV_INLINEiboolrec_get_node_ptr_flag(/*=================*/ /* out: TRUE if node pointer */ rec_t* rec); /* in: physical record *//**********************************************************The following function is used to get the order numberof the record in the heap of the index page. */UNIV_INLINEulintrec_get_heap_no(/*=============*/ /* out: heap order number */ rec_t* rec, /* in: physical record */ ulint comp); /* in: nonzero=compact page format *//**********************************************************The following function is used to set the heap numberfield in the record. */UNIV_INLINEvoidrec_set_heap_no(/*=============*/ rec_t* rec, /* in: physical record */ ulint comp, /* in: nonzero=compact page format */ ulint heap_no);/* in: the heap number *//**********************************************************The following function is used to test whether the data offsetsin the record are stored in one-byte or two-byte format. */UNIV_INLINEiboolrec_get_1byte_offs_flag(/*====================*/ /* out: TRUE if 1-byte form */ rec_t* rec); /* in: physical record *//**********************************************************The following function determines the offsets to each fieldin the record. It can reuse a previously allocated array. */ulint*rec_get_offsets_func(/*=================*/ /* out: the new offsets */ rec_t* rec, /* in: physical record */ dict_index_t* index, /* in: record descriptor */ ulint* offsets,/* in: array consisting of offsets[0] allocated elements, or an array from rec_get_offsets(), or NULL */ ulint n_fields,/* in: maximum number of initialized fields (ULINT_UNDEFINED if all fields) */ mem_heap_t** heap, /* in/out: memory heap */ const char* file, /* in: file name where called */ ulint line); /* in: line number where called */#define rec_get_offsets(rec,index,offsets,n,heap) \ rec_get_offsets_func(rec,index,offsets,n,heap,__FILE__,__LINE__)/****************************************************************Validates offsets returned by rec_get_offsets(). */UNIV_INLINEiboolrec_offs_validate(/*==============*/ /* out: TRUE if valid */ rec_t* rec, /* in: record or NULL */ dict_index_t* index, /* in: record descriptor or NULL */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//****************************************************************Updates debug data in offsets, in order to avoid bogusrec_offs_validate() failures. */UNIV_INLINEvoidrec_offs_make_valid(/*================*/ rec_t* rec, /* in: record */ dict_index_t* index,/* in: record descriptor */ ulint* offsets);/* in: array returned by rec_get_offsets() *//****************************************************************The following function is used to get a pointer to the nthdata field in an old-style record. */byte*rec_get_nth_field_old(/*==================*/ /* out: pointer to the field */ rec_t* rec, /* in: record */ ulint n, /* in: index of the field */ ulint* len); /* out: length of the field; UNIV_SQL_NULL if SQL null *//****************************************************************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. */UNIV_INLINEulintrec_get_nth_field_size(/*===================*/ /* out: field size in bytes */ rec_t* rec, /* in: record */ ulint n); /* in: index of the field *//****************************************************************The following function is used to get a pointer to the nthdata field in a record. */UNIV_INLINEbyte*rec_get_nth_field(/*==============*/ /* out: pointer to the field */ rec_t* rec, /* in: record */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ ulint n, /* in: index of the field */ ulint* len); /* out: length of the field; UNIV_SQL_NULL if SQL null */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -