📄 rem0rec.h
字号:
/**********************************************************Determine if the offsets are for a record in the newcompact format. */UNIV_INLINEulintrec_offs_comp(/*==========*/ /* out: nonzero if compact format */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//**********************************************************Returns nonzero if the extern bit is set in nth field of rec. */UNIV_INLINEulintrec_offs_nth_extern(/*================*/ /* out: nonzero if externally stored */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ ulint n); /* in: nth field *//**********************************************************Returns nonzero if the SQL NULL bit is set in nth field of rec. */UNIV_INLINEulintrec_offs_nth_sql_null(/*==================*/ /* out: nonzero if SQL NULL */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ ulint n); /* in: nth field *//**********************************************************Gets the physical size of a field. */UNIV_INLINEulintrec_offs_nth_size(/*==============*/ /* out: length of field */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ ulint n); /* in: nth field *//**********************************************************Returns TRUE if the extern bit is set in any of the fieldsof rec. */UNIV_INLINEiboolrec_offs_any_extern(/*================*/ /* out: TRUE if a field is stored externally */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//***************************************************************Sets the value of the ith field extern storage bit. */UNIV_INLINEvoidrec_set_nth_field_extern_bit(/*=========================*/ rec_t* rec, /* in: record */ dict_index_t* index, /* in: record descriptor */ ulint i, /* in: ith field */ ibool val, /* in: value to set */ mtr_t* mtr); /* in: mtr holding an X-latch to the page where rec is, or NULL; in the NULL case we do not write to log about the change *//***************************************************************Sets TRUE the extern storage bits of fields mentioned in an array. */voidrec_set_field_extern_bits(/*======================*/ rec_t* rec, /* in: record */ dict_index_t* index, /* in: record descriptor */ const ulint* vec, /* in: array of field numbers */ ulint n_fields,/* in: number of fields numbers */ mtr_t* mtr); /* in: mtr holding an X-latch to the page where rec is, or NULL; in the NULL case we do not write to log about the change *//*************************************************************** 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 lenis UNIV_SQL_NULL then the field is treated as an SQL null for old-stylerecords. For new-style records, len must not be UNIV_SQL_NULL. */UNIV_INLINEvoidrec_set_nth_field(/*==============*/ rec_t* rec, /* in: record */ const ulint* offsets,/* in: array returned by rec_get_offsets() */ ulint n, /* in: index number of the field */ const void* data, /* in: pointer to the data if not SQL null */ ulint len); /* in: length of the data or UNIV_SQL_NULL. If not SQL null, must have the same length as the previous value. If SQL null, previous value must be SQL null. *//************************************************************** The following function returns the data size of an old-style physicalrecord, that is the sum of field lengths. SQL null fieldsare counted as length 0 fields. The value returned by the functionis the distance from record origin to record end in bytes. */UNIV_INLINEulintrec_get_data_size_old(/*==================*/ /* out: size */ rec_t* rec); /* in: physical record *//************************************************************** The following function returns the number of fields in a record. */UNIV_INLINEulintrec_offs_n_fields(/*===============*/ /* out: number of fields */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//**************************************************************The following function returns the data size of a physicalrecord, that is the sum of field lengths. SQL null fieldsare counted as length 0 fields. The value returned by the functionis the distance from record origin to record end in bytes. */UNIV_INLINEulintrec_offs_data_size(/*===============*/ /* out: size */ const ulint* offsets);/* in: array returned by rec_get_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. */UNIV_INLINEulintrec_offs_extra_size(/*================*/ /* out: size */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//**************************************************************Returns the total size of a physical record. */UNIV_INLINEulintrec_offs_size(/*==========*/ /* out: size */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//**************************************************************Returns a pointer to the start of the record. */UNIV_INLINEbyte*rec_get_start(/*==========*/ /* out: pointer to start */ rec_t* rec, /* in: pointer to record */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//**************************************************************Returns a pointer to the end of the record. */UNIV_INLINEbyte*rec_get_end(/*========*/ /* out: pointer to end */ rec_t* rec, /* in: pointer to record */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//*******************************************************************Copies a physical record to a buffer. */UNIV_INLINErec_t*rec_copy(/*=====*/ /* out: pointer to the origin of the copy */ void* buf, /* in: buffer */ const rec_t* rec, /* in: physical record */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//******************************************************************Copies the first n fields of a physical record to a new physical record ina buffer. */rec_t*rec_copy_prefix_to_buf(/*===================*/ /* out, own: copied record */ rec_t* rec, /* in: physical record */ dict_index_t* index, /* in: record descriptor */ ulint n_fields, /* in: number of fields to copy */ byte** buf, /* in/out: memory buffer for the copied prefix, or NULL */ ulint* buf_size); /* in/out: buffer size *//****************************************************************Folds a prefix of a physical record to a ulint. */UNIV_INLINEulintrec_fold(/*=====*/ /* out: the folded value */ rec_t* rec, /* in: the physical record */ const ulint* offsets, /* in: array returned by rec_get_offsets() */ ulint n_fields, /* in: number of complete fields to fold */ ulint n_bytes, /* in: number of bytes to fold in an incomplete last field */ dulint tree_id); /* in: index tree id *//*************************************************************Builds a physical record out of a data tuple and stores it beginning fromaddress destination. */rec_t* rec_convert_dtuple_to_rec(/*======================*/ /* out: pointer to the origin of physical record */ byte* buf, /* in: start address of the physical record */ dict_index_t* index, /* in: record descriptor */ dtuple_t* dtuple);/* in: data tuple *//**************************************************************Returns the extra size of an old-style physical record if we know itsdata size and number of fields. */UNIV_INLINEulintrec_get_converted_extra_size(/*=========================*/ /* out: extra size */ ulint data_size, /* in: data size */ ulint n_fields) /* in: number of fields */ __attribute__((const));/**************************************************************The following function returns the size of a data tuple when converted toa physical record. */UNIV_INLINEulintrec_get_converted_size(/*===================*/ /* out: size */ dict_index_t* index, /* in: record descriptor */ dtuple_t* dtuple);/* in: data tuple *//******************************************************************Copies the first n fields of a physical record to a data tuple.The fields are copied to the memory heap. */voidrec_copy_prefix_to_dtuple(/*======================*/ dtuple_t* tuple, /* in: data tuple */ rec_t* rec, /* in: physical record */ dict_index_t* index, /* in: record descriptor */ ulint n_fields, /* in: number of fields to copy */ mem_heap_t* heap); /* in: memory heap *//*******************************************************************Validates the consistency of a physical record. */iboolrec_validate(/*=========*/ /* out: TRUE if ok */ rec_t* rec, /* in: physical record */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//*******************************************************************Prints an old-style physical record. */voidrec_print_old(/*==========*/ FILE* file, /* in: file where to print */ rec_t* rec); /* in: physical record *//*******************************************************************Prints a physical record. */voidrec_print_new(/*==========*/ FILE* file, /* in: file where to print */ rec_t* rec, /* in: physical record */ const ulint* offsets);/* in: array returned by rec_get_offsets() *//*******************************************************************Prints a physical record. */voidrec_print(/*======*/ FILE* file, /* in: file where to print */ rec_t* rec, /* in: physical record */ dict_index_t* index); /* in: record descriptor */#define REC_INFO_BITS 6 /* This is single byte bit-field *//* Maximum lengths for the data in a physical record if the offsetsare given in one byte (resp. two byte) format. */#define REC_1BYTE_OFFS_LIMIT 0x7FUL#define REC_2BYTE_OFFS_LIMIT 0x7FFFUL/* The data size of record must be smaller than this because we reservetwo upmost bits in a two byte offset for special purposes */#define REC_MAX_DATA_SIZE (16 * 1024)#ifndef UNIV_NONINL#include "rem0rec.ic"#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -