diff options
Diffstat (limited to 'storage/xtradb/include/rem0rec.ic')
-rw-r--r-- | storage/xtradb/include/rem0rec.ic | 625 |
1 files changed, 310 insertions, 315 deletions
diff --git a/storage/xtradb/include/rem0rec.ic b/storage/xtradb/include/rem0rec.ic index 0b2b9f4a685..8e5bd9a7fcd 100644 --- a/storage/xtradb/include/rem0rec.ic +++ b/storage/xtradb/include/rem0rec.ic @@ -16,7 +16,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA *****************************************************************************/ -/************************************************************************ +/********************************************************************//** +@file include/rem0rec.ic Record manager Created 5/30/1994 Heikki Tuuri @@ -64,7 +65,7 @@ most significant bytes and bits are written below less significant. - offset_of_this_record) mod 64Ki, where mod is the modulo as a non-negative number; - we can calculate the the offset of the next + we can calculate the offset of the next record with the formula: relative_offset + offset_of_this_record mod UNIV_PAGE_SIZE @@ -143,52 +144,52 @@ a field stored to another page: */ # error "sum of new-style masks != 0xFFFFFFUL" #endif -/*************************************************************** +/***********************************************************//** Sets the value of the ith field SQL null bit of an old-style record. */ UNIV_INTERN void rec_set_nth_field_null_bit( /*=======================*/ - rec_t* rec, /* in: record */ - ulint i, /* in: ith field */ - ibool val); /* in: value to set */ -/*************************************************************** + rec_t* rec, /*!< in: record */ + ulint i, /*!< in: ith field */ + ibool val); /*!< in: value to set */ +/***********************************************************//** Sets an old-style record field to SQL null. The physical size of the field is not changed. */ UNIV_INTERN void rec_set_nth_field_sql_null( /*=======================*/ - rec_t* rec, /* in: record */ - ulint n); /* in: index of the field */ + rec_t* rec, /*!< in: record */ + ulint n); /*!< in: index of the field */ -/********************************************************** +/******************************************************//** Gets a bit field from within 1 byte. */ UNIV_INLINE ulint rec_get_bit_field_1( /*================*/ - const rec_t* rec, /* in: pointer to record origin */ - ulint offs, /* in: offset from the origin down */ - ulint mask, /* in: mask used to filter bits */ - ulint shift) /* in: shift right applied after masking */ + const rec_t* rec, /*!< in: pointer to record origin */ + ulint offs, /*!< in: offset from the origin down */ + ulint mask, /*!< in: mask used to filter bits */ + ulint shift) /*!< in: shift right applied after masking */ { ut_ad(rec); return((mach_read_from_1(rec - offs) & mask) >> shift); } -/********************************************************** +/******************************************************//** Sets a bit field within 1 byte. */ UNIV_INLINE void rec_set_bit_field_1( /*================*/ - rec_t* rec, /* in: pointer to record origin */ - ulint val, /* in: value to set */ - ulint offs, /* in: offset from the origin down */ - ulint mask, /* in: mask used to filter bits */ - ulint shift) /* in: shift right applied after masking */ + rec_t* rec, /*!< in: pointer to record origin */ + ulint val, /*!< in: value to set */ + ulint offs, /*!< in: offset from the origin down */ + ulint mask, /*!< in: mask used to filter bits */ + ulint shift) /*!< in: shift right applied after masking */ { ut_ad(rec); ut_ad(offs <= REC_N_OLD_EXTRA_BYTES); @@ -202,33 +203,33 @@ rec_set_bit_field_1( | (val << shift)); } -/********************************************************** +/******************************************************//** Gets a bit field from within 2 bytes. */ UNIV_INLINE ulint rec_get_bit_field_2( /*================*/ - const rec_t* rec, /* in: pointer to record origin */ - ulint offs, /* in: offset from the origin down */ - ulint mask, /* in: mask used to filter bits */ - ulint shift) /* in: shift right applied after masking */ + const rec_t* rec, /*!< in: pointer to record origin */ + ulint offs, /*!< in: offset from the origin down */ + ulint mask, /*!< in: mask used to filter bits */ + ulint shift) /*!< in: shift right applied after masking */ { ut_ad(rec); return((mach_read_from_2(rec - offs) & mask) >> shift); } -/********************************************************** +/******************************************************//** Sets a bit field within 2 bytes. */ UNIV_INLINE void rec_set_bit_field_2( /*================*/ - rec_t* rec, /* in: pointer to record origin */ - ulint val, /* in: value to set */ - ulint offs, /* in: offset from the origin down */ - ulint mask, /* in: mask used to filter bits */ - ulint shift) /* in: shift right applied after masking */ + rec_t* rec, /*!< in: pointer to record origin */ + ulint val, /*!< in: value to set */ + ulint offs, /*!< in: offset from the origin down */ + ulint mask, /*!< in: mask used to filter bits */ + ulint shift) /*!< in: shift right applied after masking */ { ut_ad(rec); ut_ad(offs <= REC_N_OLD_EXTRA_BYTES); @@ -244,17 +245,16 @@ rec_set_bit_field_2( | (val << shift)); } -/********************************************************** +/******************************************************//** The following function is used to get the pointer of the next chained record -on the same page. */ +on the same page. +@return pointer to the next chained record, or NULL if none */ UNIV_INLINE const rec_t* rec_get_next_ptr_const( /*===================*/ - /* out: pointer to the next chained record, or - NULL if none */ - const rec_t* rec, /* in: physical record */ - ulint comp) /* in: nonzero=compact page format */ + const rec_t* rec, /*!< in: physical record */ + ulint comp) /*!< in: nonzero=compact page format */ { ulint field_value; @@ -301,32 +301,30 @@ rec_get_next_ptr_const( } } -/********************************************************** +/******************************************************//** The following function is used to get the pointer of the next chained record -on the same page. */ +on the same page. +@return pointer to the next chained record, or NULL if none */ UNIV_INLINE rec_t* rec_get_next_ptr( /*=============*/ - /* out: pointer to the next chained record, or - NULL if none */ - rec_t* rec, /* in: physical record */ - ulint comp) /* in: nonzero=compact page format */ + rec_t* rec, /*!< in: physical record */ + ulint comp) /*!< in: nonzero=compact page format */ { return((rec_t*) rec_get_next_ptr_const(rec, comp)); } -/********************************************************** +/******************************************************//** The following function is used to get the offset of the next chained record -on the same page. */ +on the same page. +@return the page offset of the next chained record, or 0 if none */ UNIV_INLINE ulint rec_get_next_offs( /*==============*/ - /* out: the page offset of the next - chained record, or 0 if none */ - const rec_t* rec, /* in: physical record */ - ulint comp) /* in: nonzero=compact page format */ + const rec_t* rec, /*!< in: physical record */ + ulint comp) /*!< in: nonzero=compact page format */ { ulint field_value; #if REC_NEXT_MASK != 0xFFFFUL @@ -374,15 +372,15 @@ rec_get_next_offs( } } -/********************************************************** +/******************************************************//** The following function is used to set the next record offset field of an old-style record. */ UNIV_INLINE void rec_set_next_offs_old( /*==================*/ - rec_t* rec, /* in: old-style physical record */ - ulint next) /* in: offset of the next record */ + rec_t* rec, /*!< in: old-style physical record */ + ulint next) /*!< in: offset of the next record */ { ut_ad(rec); ut_ad(UNIV_PAGE_SIZE > next); @@ -396,15 +394,15 @@ rec_set_next_offs_old( mach_write_to_2(rec - REC_NEXT, next); } -/********************************************************** +/******************************************************//** The following function is used to set the next record offset field of a new-style record. */ UNIV_INLINE void rec_set_next_offs_new( /*==================*/ - rec_t* rec, /* in/out: new-style physical record */ - ulint next) /* in: offset of the next record */ + rec_t* rec, /*!< in/out: new-style physical record */ + ulint next) /*!< in: offset of the next record */ { ulint field_value; @@ -427,15 +425,15 @@ rec_set_next_offs_new( mach_write_to_2(rec - REC_NEXT, field_value); } -/********************************************************** +/******************************************************//** The following function is used to get the number of fields -in an old-style record. */ +in an old-style record. +@return number of data fields */ UNIV_INLINE ulint rec_get_n_fields_old( /*=================*/ - /* out: number of data fields */ - const rec_t* rec) /* in: physical record */ + const rec_t* rec) /*!< in: physical record */ { ulint ret; @@ -450,15 +448,15 @@ rec_get_n_fields_old( return(ret); } -/********************************************************** +/******************************************************//** The following function is used to set the number of fields in an old-style record. */ UNIV_INLINE void rec_set_n_fields_old( /*=================*/ - rec_t* rec, /* in: physical record */ - ulint n_fields) /* in: the number of fields */ + rec_t* rec, /*!< in: physical record */ + ulint n_fields) /*!< in: the number of fields */ { ut_ad(rec); ut_ad(n_fields <= REC_MAX_N_FIELDS); @@ -468,14 +466,14 @@ rec_set_n_fields_old( REC_OLD_N_FIELDS_MASK, REC_OLD_N_FIELDS_SHIFT); } -/********************************************************** -The following function retrieves the status bits of a new-style record. */ +/******************************************************//** +The following function retrieves the status bits of a new-style record. +@return status bits */ UNIV_INLINE ulint rec_get_status( /*===========*/ - /* out: status bits */ - const rec_t* rec) /* in: physical record */ + const rec_t* rec) /*!< in: physical record */ { ulint ret; @@ -488,16 +486,16 @@ rec_get_status( return(ret); } -/********************************************************** +/******************************************************//** The following function is used to get the number of fields -in a record. */ +in a record. +@return number of data fields */ UNIV_INLINE ulint rec_get_n_fields( /*=============*/ - /* out: number of data fields */ - const rec_t* rec, /* in: physical record */ - const dict_index_t* index) /* in: record descriptor */ + const rec_t* rec, /*!< in: physical record */ + const dict_index_t* index) /*!< in: record descriptor */ { ut_ad(rec); ut_ad(index); @@ -520,57 +518,56 @@ rec_get_n_fields( } } -/********************************************************** +/******************************************************//** The following function is used to get the number of records owned by the -previous directory record. */ +previous directory record. +@return number of owned records */ UNIV_INLINE ulint rec_get_n_owned_old( /*================*/ - /* out: number of owned records */ - const rec_t* rec) /* in: old-style physical record */ + const rec_t* rec) /*!< in: old-style physical record */ { return(rec_get_bit_field_1(rec, REC_OLD_N_OWNED, REC_N_OWNED_MASK, REC_N_OWNED_SHIFT)); } -/********************************************************** +/******************************************************//** The following function is used to set the number of owned records. */ UNIV_INLINE void rec_set_n_owned_old( /*================*/ - /* out: TRUE on success */ - rec_t* rec, /* in: old-style physical record */ - ulint n_owned) /* in: the number of owned */ + rec_t* rec, /*!< in: old-style physical record */ + ulint n_owned) /*!< in: the number of owned */ { rec_set_bit_field_1(rec, n_owned, REC_OLD_N_OWNED, REC_N_OWNED_MASK, REC_N_OWNED_SHIFT); } -/********************************************************** +/******************************************************//** The following function is used to get the number of records owned by the -previous directory record. */ +previous directory record. +@return number of owned records */ UNIV_INLINE ulint rec_get_n_owned_new( /*================*/ - /* out: number of owned records */ - const rec_t* rec) /* in: new-style physical record */ + const rec_t* rec) /*!< in: new-style physical record */ { return(rec_get_bit_field_1(rec, REC_NEW_N_OWNED, REC_N_OWNED_MASK, REC_N_OWNED_SHIFT)); } -/********************************************************** +/******************************************************//** The following function is used to set the number of owned records. */ UNIV_INLINE void rec_set_n_owned_new( /*================*/ - rec_t* rec, /* in/out: new-style physical record */ - page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */ - ulint n_owned)/* in: the number of owned */ + rec_t* rec, /*!< in/out: new-style physical record */ + page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */ + ulint n_owned)/*!< in: the number of owned */ { rec_set_bit_field_1(rec, n_owned, REC_NEW_N_OWNED, REC_N_OWNED_MASK, REC_N_OWNED_SHIFT); @@ -581,69 +578,69 @@ rec_set_n_owned_new( } } -/********************************************************** -The following function is used to retrieve the info bits of a record. */ +/******************************************************//** +The following function is used to retrieve the info bits of a record. +@return info bits */ UNIV_INLINE ulint rec_get_info_bits( /*==============*/ - /* out: info bits */ - const rec_t* rec, /* in: physical record */ - ulint comp) /* in: nonzero=compact page format */ + const rec_t* rec, /*!< in: physical record */ + ulint comp) /*!< in: nonzero=compact page format */ { return(rec_get_bit_field_1( rec, comp ? REC_NEW_INFO_BITS : REC_OLD_INFO_BITS, REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT)); } -/********************************************************** +/******************************************************//** The following function is used to set the info bits of a record. */ UNIV_INLINE void rec_set_info_bits_old( /*==================*/ - rec_t* rec, /* in: old-style physical record */ - ulint bits) /* in: info bits */ + rec_t* rec, /*!< in: old-style physical record */ + ulint bits) /*!< in: info bits */ { rec_set_bit_field_1(rec, bits, REC_OLD_INFO_BITS, REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT); } -/********************************************************** +/******************************************************//** The following function is used to set the info bits of a record. */ UNIV_INLINE void rec_set_info_bits_new( /*==================*/ - rec_t* rec, /* in/out: new-style physical record */ - ulint bits) /* in: info bits */ + rec_t* rec, /*!< in/out: new-style physical record */ + ulint bits) /*!< in: info bits */ { rec_set_bit_field_1(rec, bits, REC_NEW_INFO_BITS, REC_INFO_BITS_MASK, REC_INFO_BITS_SHIFT); } -/********************************************************** +/******************************************************//** The following function is used to set the status bits of a new-style record. */ UNIV_INLINE void rec_set_status( /*===========*/ - rec_t* rec, /* in/out: physical record */ - ulint bits) /* in: info bits */ + rec_t* rec, /*!< in/out: physical record */ + ulint bits) /*!< in: info bits */ { rec_set_bit_field_1(rec, bits, REC_NEW_STATUS, REC_NEW_STATUS_MASK, REC_NEW_STATUS_SHIFT); } -/********************************************************** +/******************************************************//** The following function is used to retrieve the info and status -bits of a record. (Only compact records have status bits.) */ +bits of a record. (Only compact records have status bits.) +@return info bits */ UNIV_INLINE ulint rec_get_info_and_status_bits( /*=========================*/ - /* out: info bits */ - const rec_t* rec, /* in: physical record */ - ulint comp) /* in: nonzero=compact page format */ + const rec_t* rec, /*!< in: physical record */ + ulint comp) /*!< in: nonzero=compact page format */ { ulint bits; #if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \ @@ -658,15 +655,15 @@ rec_get_info_and_status_bits( } return(bits); } -/********************************************************** +/******************************************************//** The following function is used to set the info and status bits of a record. (Only compact records have status bits.) */ UNIV_INLINE void rec_set_info_and_status_bits( /*=========================*/ - rec_t* rec, /* in/out: physical record */ - ulint bits) /* in: info bits */ + rec_t* rec, /*!< in/out: physical record */ + ulint bits) /*!< in: info bits */ { #if (REC_NEW_STATUS_MASK >> REC_NEW_STATUS_SHIFT) \ & (REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT) @@ -676,15 +673,15 @@ rec_set_info_and_status_bits( rec_set_info_bits_new(rec, bits & ~REC_NEW_STATUS_MASK); } -/********************************************************** -The following function tells if record is delete marked. */ +/******************************************************//** +The following function tells if record is delete marked. +@return nonzero if delete marked */ UNIV_INLINE ulint rec_get_deleted_flag( /*=================*/ - /* out: nonzero if delete marked */ - const rec_t* rec, /* in: physical record */ - ulint comp) /* in: nonzero=compact page format */ + const rec_t* rec, /*!< in: physical record */ + ulint comp) /*!< in: nonzero=compact page format */ { if (UNIV_EXPECT(comp, REC_OFFS_COMPACT)) { return(UNIV_UNLIKELY( @@ -699,14 +696,14 @@ rec_get_deleted_flag( } } -/********************************************************** +/******************************************************//** The following function is used to set the deleted bit. */ UNIV_INLINE void rec_set_deleted_flag_old( /*=====================*/ - rec_t* rec, /* in: old-style physical record */ - ulint flag) /* in: nonzero if delete marked */ + rec_t* rec, /*!< in: old-style physical record */ + ulint flag) /*!< in: nonzero if delete marked */ { ulint val; @@ -721,15 +718,15 @@ rec_set_deleted_flag_old( rec_set_info_bits_old(rec, val); } -/********************************************************** +/******************************************************//** The following function is used to set the deleted bit. */ UNIV_INLINE void rec_set_deleted_flag_new( /*=====================*/ - rec_t* rec, /* in/out: new-style physical record */ - page_zip_des_t* page_zip,/* in/out: compressed page, or NULL */ - ulint flag) /* in: nonzero if delete marked */ + rec_t* rec, /*!< in/out: new-style physical record */ + page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */ + ulint flag) /*!< in: nonzero if delete marked */ { ulint val; @@ -748,83 +745,83 @@ rec_set_deleted_flag_new( } } -/********************************************************** -The following function tells if a new-style record is a node pointer. */ +/******************************************************//** +The following function tells if a new-style record is a node pointer. +@return TRUE if node pointer */ UNIV_INLINE ibool rec_get_node_ptr_flag( /*==================*/ - /* out: TRUE if node pointer */ - const rec_t* rec) /* in: physical record */ + const rec_t* rec) /*!< in: physical record */ { return(REC_STATUS_NODE_PTR == rec_get_status(rec)); } -/********************************************************** +/******************************************************//** The following function is used to get the order number -of an old-style record in the heap of the index page. */ +of an old-style record in the heap of the index page. +@return heap order number */ UNIV_INLINE ulint rec_get_heap_no_old( /*================*/ - /* out: heap order number */ - const rec_t* rec) /* in: physical record */ + const rec_t* rec) /*!< in: physical record */ { return(rec_get_bit_field_2(rec, REC_OLD_HEAP_NO, REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT)); } -/********************************************************** +/******************************************************//** The following function is used to set the heap number field in an old-style record. */ UNIV_INLINE void rec_set_heap_no_old( /*================*/ - rec_t* rec, /* in: physical record */ - ulint heap_no)/* in: the heap number */ + rec_t* rec, /*!< in: physical record */ + ulint heap_no)/*!< in: the heap number */ { rec_set_bit_field_2(rec, heap_no, REC_OLD_HEAP_NO, REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT); } -/********************************************************** +/******************************************************//** The following function is used to get the order number -of a new-style record in the heap of the index page. */ +of a new-style record in the heap of the index page. +@return heap order number */ UNIV_INLINE ulint rec_get_heap_no_new( /*================*/ - /* out: heap order number */ - const rec_t* rec) /* in: physical record */ + const rec_t* rec) /*!< in: physical record */ { return(rec_get_bit_field_2(rec, REC_NEW_HEAP_NO, REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT)); } -/********************************************************** +/******************************************************//** The following function is used to set the heap number field in a new-style record. */ UNIV_INLINE void rec_set_heap_no_new( /*================*/ - rec_t* rec, /* in/out: physical record */ - ulint heap_no)/* in: the heap number */ + rec_t* rec, /*!< in/out: physical record */ + ulint heap_no)/*!< in: the heap number */ { rec_set_bit_field_2(rec, heap_no, REC_NEW_HEAP_NO, REC_HEAP_NO_MASK, REC_HEAP_NO_SHIFT); } -/********************************************************** +/******************************************************//** The following function is used to test whether the data offsets in the record -are stored in one-byte or two-byte format. */ +are stored in one-byte or two-byte format. +@return TRUE if 1-byte form */ UNIV_INLINE ibool rec_get_1byte_offs_flag( /*====================*/ - /* out: TRUE if 1-byte form */ - const rec_t* rec) /* in: physical record */ + const rec_t* rec) /*!< in: physical record */ { #if TRUE != 1 #error "TRUE != 1" @@ -834,14 +831,14 @@ rec_get_1byte_offs_flag( REC_OLD_SHORT_SHIFT)); } -/********************************************************** +/******************************************************//** The following function is used to set the 1-byte offsets flag. */ UNIV_INLINE void rec_set_1byte_offs_flag( /*====================*/ - rec_t* rec, /* in: physical record */ - ibool flag) /* in: TRUE if 1byte form */ + rec_t* rec, /*!< in: physical record */ + ibool flag) /*!< in: TRUE if 1byte form */ { #if TRUE != 1 #error "TRUE != 1" @@ -852,18 +849,17 @@ rec_set_1byte_offs_flag( REC_OLD_SHORT_SHIFT); } -/********************************************************** +/******************************************************//** Returns the offset of nth field end if the record is stored in the 1-byte offsets form. If the field is SQL null, the flag is ORed in the returned -value. */ +value. +@return offset of the start of the field, SQL null flag ORed */ UNIV_INLINE ulint rec_1_get_field_end_info( /*=====================*/ - /* out: offset of the start of the - field, SQL null flag ORed */ - const rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ { ut_ad(rec_get_1byte_offs_flag(rec)); ut_ad(n < rec_get_n_fields_old(rec)); @@ -871,19 +867,18 @@ rec_1_get_field_end_info( return(mach_read_from_1(rec - (REC_N_OLD_EXTRA_BYTES + n + 1))); } -/********************************************************** +/******************************************************//** Returns the offset of nth field end if the record is stored in the 2-byte offsets form. If the field is SQL null, the flag is ORed in the returned -value. */ +value. +@return offset of the start of the field, SQL null flag and extern +storage flag ORed */ UNIV_INLINE ulint rec_2_get_field_end_info( /*=====================*/ - /* out: offset of the start of the - field, SQL null flag and extern - storage flag ORed */ - const rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ { ut_ad(!rec_get_1byte_offs_flag(rec)); ut_ad(n < rec_get_n_fields_old(rec)); @@ -896,15 +891,15 @@ this position, and following positions hold the end offsets of the fields. */ #define rec_offs_base(offsets) (offsets + REC_OFFS_HEADER_SIZE) -/************************************************************** +/**********************************************************//** The following function returns the number of allocated elements -for an array of offsets. */ +for an array of offsets. +@return number of elements */ UNIV_INLINE ulint rec_offs_get_n_alloc( /*=================*/ - /* out: number of elements */ - const ulint* offsets)/* in: array for rec_get_offsets() */ + const ulint* offsets)/*!< in: array for rec_get_offsets() */ { ulint n_alloc; ut_ad(offsets); @@ -914,16 +909,16 @@ rec_offs_get_n_alloc( return(n_alloc); } -/************************************************************** +/**********************************************************//** The following function sets the number of allocated elements for an array of offsets. */ UNIV_INLINE void rec_offs_set_n_alloc( /*=================*/ - ulint* offsets, /* out: array for rec_get_offsets(), + ulint* offsets, /*!< out: array for rec_get_offsets(), must be allocated */ - ulint n_alloc) /* in: number of elements */ + ulint n_alloc) /*!< in: number of elements */ { ut_ad(offsets); ut_ad(n_alloc > REC_OFFS_HEADER_SIZE); @@ -931,14 +926,14 @@ rec_offs_set_n_alloc( offsets[0] = n_alloc; } -/************************************************************** -The following function returns the number of fields in a record. */ +/**********************************************************//** +The following function returns the number of fields in a record. +@return number of fields */ UNIV_INLINE ulint rec_offs_n_fields( /*==============*/ - /* out: number of fields */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint n_fields; ut_ad(offsets); @@ -950,16 +945,16 @@ rec_offs_n_fields( return(n_fields); } -/**************************************************************** -Validates offsets returned by rec_get_offsets(). */ +/************************************************************//** +Validates offsets returned by rec_get_offsets(). +@return TRUE if valid */ UNIV_INLINE ibool rec_offs_validate( /*==============*/ - /* out: TRUE if valid */ - const rec_t* rec, /* in: record or NULL */ - const dict_index_t* index, /* in: record descriptor or NULL */ - const ulint* offsets)/* in: array returned by + const rec_t* rec, /*!< in: record or NULL */ + const dict_index_t* index, /*!< in: record descriptor or NULL */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint i = rec_offs_n_fields(offsets); @@ -1006,16 +1001,16 @@ rec_offs_validate( return(TRUE); } #ifdef UNIV_DEBUG -/**************************************************************** +/************************************************************//** Updates debug data in offsets, in order to avoid bogus rec_offs_validate() failures. */ UNIV_INLINE void rec_offs_make_valid( /*================*/ - const rec_t* rec, /* in: record */ - const dict_index_t* index, /* in: record descriptor */ - ulint* offsets)/* in: array returned by + const rec_t* rec, /*!< in: record */ + const dict_index_t* index, /*!< in: record descriptor */ + ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ut_ad(rec); @@ -1027,17 +1022,17 @@ rec_offs_make_valid( } #endif /* UNIV_DEBUG */ -/**************************************************************** +/************************************************************//** The following function is used to get an offset to the nth -data field in a record. */ +data field in a record. +@return offset from the origin of rec */ UNIV_INLINE ulint rec_get_nth_field_offs( /*===================*/ - /* out: offset from the origin of rec */ - 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 + 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 */ { ulint offs; @@ -1064,43 +1059,43 @@ rec_get_nth_field_offs( return(offs); } -/********************************************************** +/******************************************************//** Determine if the offsets are for a record in the new -compact format. */ +compact format. +@return nonzero if compact format */ UNIV_INLINE ulint rec_offs_comp( /*==========*/ - /* out: nonzero if compact format */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ut_ad(rec_offs_validate(NULL, NULL, offsets)); return(*rec_offs_base(offsets) & REC_OFFS_COMPACT); } -/********************************************************** +/******************************************************//** Determine if the offsets are for a record containing -externally stored columns. */ +externally stored columns. +@return nonzero if externally stored */ UNIV_INLINE ulint rec_offs_any_extern( /*================*/ - /* out: nonzero if externally stored */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ut_ad(rec_offs_validate(NULL, NULL, offsets)); return(UNIV_UNLIKELY(*rec_offs_base(offsets) & REC_OFFS_EXTERNAL)); } -/********************************************************** -Returns nonzero if the extern bit is set in nth field of rec. */ +/******************************************************//** +Returns nonzero if the extern bit is set in nth field of rec. +@return nonzero if externally stored */ UNIV_INLINE ulint rec_offs_nth_extern( /*================*/ - /* out: nonzero if externally stored */ - const ulint* offsets,/* in: array returned by rec_get_offsets() */ - ulint n) /* in: nth field */ + const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ + ulint n) /*!< in: nth field */ { ut_ad(rec_offs_validate(NULL, NULL, offsets)); ut_ad(n < rec_offs_n_fields(offsets)); @@ -1108,15 +1103,15 @@ rec_offs_nth_extern( & REC_OFFS_EXTERNAL)); } -/********************************************************** -Returns nonzero if the SQL NULL bit is set in nth field of rec. */ +/******************************************************//** +Returns nonzero if the SQL NULL bit is set in nth field of rec. +@return nonzero if SQL NULL */ UNIV_INLINE ulint rec_offs_nth_sql_null( /*==================*/ - /* out: nonzero if SQL NULL */ - const ulint* offsets,/* in: array returned by rec_get_offsets() */ - ulint n) /* in: nth field */ + const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ + ulint n) /*!< in: nth field */ { ut_ad(rec_offs_validate(NULL, NULL, offsets)); ut_ad(n < rec_offs_n_fields(offsets)); @@ -1124,15 +1119,15 @@ rec_offs_nth_sql_null( & REC_OFFS_SQL_NULL)); } -/********************************************************** -Gets the physical size of a field. */ +/******************************************************//** +Gets the physical size of a field. +@return length of field */ UNIV_INLINE ulint rec_offs_nth_size( /*==============*/ - /* out: length of field */ - const ulint* offsets,/* in: array returned by rec_get_offsets() */ - ulint n) /* in: nth field */ + const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ + ulint n) /*!< in: nth field */ { ut_ad(rec_offs_validate(NULL, NULL, offsets)); ut_ad(n < rec_offs_n_fields(offsets)); @@ -1143,14 +1138,14 @@ rec_offs_nth_size( & REC_OFFS_MASK); } -/********************************************************** -Returns the number of extern bits set in a record. */ +/******************************************************//** +Returns the number of extern bits set in a record. +@return number of externally stored fields */ UNIV_INLINE ulint rec_offs_n_extern( /*==============*/ - /* out: number of externally stored fields */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint n = 0; @@ -1167,20 +1162,19 @@ rec_offs_n_extern( return(n); } -/********************************************************** +/******************************************************//** Returns the offset of n - 1th field end if the record is stored in the 1-byte offsets form. If the field is SQL null, the flag is ORed in the returned value. This function and the 2-byte counterpart are defined here because the C-compiler was not able to sum negative and positive constant offsets, and -warned of constant arithmetic overflow within the compiler. */ +warned of constant arithmetic overflow within the compiler. +@return offset of the start of the PREVIOUS field, SQL null flag ORed */ UNIV_INLINE ulint rec_1_get_prev_field_end_info( /*==========================*/ - /* out: offset of the start of the - PREVIOUS field, SQL null flag ORed */ - const rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ { ut_ad(rec_get_1byte_offs_flag(rec)); ut_ad(n <= rec_get_n_fields_old(rec)); @@ -1188,18 +1182,17 @@ rec_1_get_prev_field_end_info( return(mach_read_from_1(rec - (REC_N_OLD_EXTRA_BYTES + n))); } -/********************************************************** +/******************************************************//** Returns the offset of n - 1th field end if the record is stored in the 2-byte offsets form. If the field is SQL null, the flag is ORed in the returned -value. */ +value. +@return offset of the start of the PREVIOUS field, SQL null flag ORed */ UNIV_INLINE ulint rec_2_get_prev_field_end_info( /*==========================*/ - /* out: offset of the start of the - PREVIOUS field, SQL null flag ORed */ - const rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ { ut_ad(!rec_get_1byte_offs_flag(rec)); ut_ad(n <= rec_get_n_fields_old(rec)); @@ -1207,16 +1200,16 @@ rec_2_get_prev_field_end_info( return(mach_read_from_2(rec - (REC_N_OLD_EXTRA_BYTES + 2 * n))); } -/********************************************************** +/******************************************************//** Sets the field end info for the nth field if the record is stored in the 1-byte format. */ UNIV_INLINE void rec_1_set_field_end_info( /*=====================*/ - rec_t* rec, /* in: record */ - ulint n, /* in: field index */ - ulint info) /* in: value to set */ + rec_t* rec, /*!< in: record */ + ulint n, /*!< in: field index */ + ulint info) /*!< in: value to set */ { ut_ad(rec_get_1byte_offs_flag(rec)); ut_ad(n < rec_get_n_fields_old(rec)); @@ -1224,16 +1217,16 @@ rec_1_set_field_end_info( mach_write_to_1(rec - (REC_N_OLD_EXTRA_BYTES + n + 1), info); } -/********************************************************** +/******************************************************//** Sets the field end info for the nth field if the record is stored in the 2-byte format. */ UNIV_INLINE void rec_2_set_field_end_info( /*=====================*/ - rec_t* rec, /* in: record */ - ulint n, /* in: field index */ - ulint info) /* in: value to set */ + rec_t* rec, /*!< in: record */ + ulint n, /*!< in: field index */ + ulint info) /*!< in: value to set */ { ut_ad(!rec_get_1byte_offs_flag(rec)); ut_ad(n < rec_get_n_fields_old(rec)); @@ -1241,16 +1234,16 @@ rec_2_set_field_end_info( mach_write_to_2(rec - (REC_N_OLD_EXTRA_BYTES + 2 * n + 2), info); } -/********************************************************** +/******************************************************//** Returns the offset of nth field start if the record is stored in the 1-byte -offsets form. */ +offsets form. +@return offset of the start of the field */ UNIV_INLINE ulint rec_1_get_field_start_offs( /*=======================*/ - /* out: offset of the start of the field */ - const rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ { ut_ad(rec_get_1byte_offs_flag(rec)); ut_ad(n <= rec_get_n_fields_old(rec)); @@ -1264,16 +1257,16 @@ rec_1_get_field_start_offs( & ~REC_1BYTE_SQL_NULL_MASK); } -/********************************************************** +/******************************************************//** Returns the offset of nth field start if the record is stored in the 2-byte -offsets form. */ +offsets form. +@return offset of the start of the field */ UNIV_INLINE ulint rec_2_get_field_start_offs( /*=======================*/ - /* out: offset of the start of the field */ - const rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ { ut_ad(!rec_get_1byte_offs_flag(rec)); ut_ad(n <= rec_get_n_fields_old(rec)); @@ -1287,18 +1280,18 @@ rec_2_get_field_start_offs( & ~(REC_2BYTE_SQL_NULL_MASK | REC_2BYTE_EXTERN_MASK)); } -/********************************************************** +/******************************************************//** The following function is used to read the offset of the start of a data field in the record. The start of an SQL null field is the end offset of the previous non-null field, or 0, if none exists. If n is the number of the last -field + 1, then the end offset of the last field is returned. */ +field + 1, then the end offset of the last field is returned. +@return offset of the start of the field */ UNIV_INLINE ulint rec_get_field_start_offs( /*=====================*/ - /* out: offset of the start of the field */ - const rec_t* rec, /* in: record */ - ulint n) /* in: field index */ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: field index */ { ut_ad(rec); ut_ad(n <= rec_get_n_fields_old(rec)); @@ -1316,17 +1309,17 @@ rec_get_field_start_offs( return(rec_2_get_field_start_offs(rec, 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. */ +if the data type is of a fixed size. +@return field size in bytes */ UNIV_INLINE ulint rec_get_nth_field_size( /*===================*/ - /* out: field size in bytes */ - const rec_t* rec, /* in: record */ - ulint n) /* in: index of the field */ + const rec_t* rec, /*!< in: record */ + ulint n) /*!< in: index of the field */ { ulint os; ulint next_os; @@ -1339,7 +1332,7 @@ rec_get_nth_field_size( return(next_os - os); } -/*************************************************************** +/***********************************************************//** 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. @@ -1349,12 +1342,12 @@ UNIV_INLINE void rec_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 + 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 */ + ulint len) /*!< in: length of the data or UNIV_SQL_NULL */ { byte* data2; ulint len2; @@ -1383,32 +1376,32 @@ rec_set_nth_field( ut_memcpy(data2, data, len); } -/************************************************************** +/**********************************************************//** 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. */ +is the distance from record origin to record end in bytes. +@return size */ UNIV_INLINE ulint rec_get_data_size_old( /*==================*/ - /* out: size */ - const rec_t* rec) /* in: physical record */ + const rec_t* rec) /*!< in: physical record */ { ut_ad(rec); return(rec_get_field_start_offs(rec, rec_get_n_fields_old(rec))); } -/************************************************************** +/**********************************************************//** The following function sets the number of fields in offsets. */ UNIV_INLINE void rec_offs_set_n_fields( /*==================*/ - ulint* offsets, /* in/out: array returned by + ulint* offsets, /*!< in/out: array returned by rec_get_offsets() */ - ulint n_fields) /* in: number of fields */ + ulint n_fields) /*!< in: number of fields */ { ut_ad(offsets); ut_ad(n_fields > 0); @@ -1418,17 +1411,17 @@ rec_offs_set_n_fields( offsets[1] = n_fields; } -/************************************************************** +/**********************************************************//** 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. */ +is the distance from record origin to record end in bytes. +@return size */ UNIV_INLINE ulint rec_offs_data_size( /*===============*/ - /* out: size */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint size; @@ -1439,16 +1432,16 @@ rec_offs_data_size( return(size); } -/************************************************************** +/**********************************************************//** 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. */ +in bytes. +@return size */ UNIV_INLINE ulint rec_offs_extra_size( /*================*/ - /* out: size */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint size; ut_ad(rec_offs_validate(NULL, NULL, offsets)); @@ -1457,56 +1450,56 @@ rec_offs_extra_size( return(size); } -/************************************************************** -Returns the total size of a physical record. */ +/**********************************************************//** +Returns the total size of a physical record. +@return size */ UNIV_INLINE ulint rec_offs_size( /*==========*/ - /* out: size */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets)); } -/************************************************************** -Returns a pointer to the end of the record. */ +/**********************************************************//** +Returns a pointer to the end of the record. +@return pointer to end */ UNIV_INLINE byte* rec_get_end( /*========*/ - /* out: pointer to end */ - rec_t* rec, /* in: pointer to record */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + rec_t* rec, /*!< in: pointer to record */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ut_ad(rec_offs_validate(rec, NULL, offsets)); return(rec + rec_offs_data_size(offsets)); } -/************************************************************** -Returns a pointer to the start of the record. */ +/**********************************************************//** +Returns a pointer to the start of the record. +@return pointer to start */ UNIV_INLINE byte* rec_get_start( /*==========*/ - /* out: pointer to start */ - rec_t* rec, /* in: pointer to record */ - const ulint* offsets)/* in: array returned by rec_get_offsets() */ + rec_t* rec, /*!< in: pointer to record */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ut_ad(rec_offs_validate(rec, NULL, offsets)); return(rec - rec_offs_extra_size(offsets)); } -/******************************************************************* -Copies a physical record to a buffer. */ +/***************************************************************//** +Copies a physical record to a buffer. +@return pointer to the origin of the copy */ UNIV_INLINE rec_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() */ + void* buf, /*!< in: buffer */ + const rec_t* rec, /*!< in: physical record */ + const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ { ulint extra_len; ulint data_len; @@ -1523,17 +1516,17 @@ rec_copy( return((byte*)buf + extra_len); } -/************************************************************** +/**********************************************************//** Returns the extra size of an old-style physical record if we know its -data size and number of fields. */ +data size and number of fields. +@return extra size */ UNIV_INLINE ulint rec_get_converted_extra_size( /*=========================*/ - /* out: extra size */ - ulint data_size, /* in: data size */ - ulint n_fields, /* in: number of fields */ - ulint n_ext) /* in: number of externally stored columns */ + ulint data_size, /*!< in: data size */ + ulint n_fields, /*!< in: number of fields */ + ulint n_ext) /*!< in: number of externally stored columns */ { if (!n_ext && data_size <= REC_1BYTE_OFFS_LIMIT) { @@ -1543,17 +1536,17 @@ rec_get_converted_extra_size( return(REC_N_OLD_EXTRA_BYTES + 2 * n_fields); } -/************************************************************** +/**********************************************************//** The following function returns the size of a data tuple when converted to -a physical record. */ +a physical record. +@return size */ UNIV_INLINE ulint rec_get_converted_size( /*===================*/ - /* out: size */ - dict_index_t* index, /* in: record descriptor */ - const dtuple_t* dtuple, /* in: data tuple */ - ulint n_ext) /* in: number of externally stored columns */ + dict_index_t* index, /*!< in: record descriptor */ + const dtuple_t* dtuple, /*!< in: data tuple */ + ulint n_ext) /*!< in: number of externally stored columns */ { ulint data_size; ulint extra_size; @@ -1577,7 +1570,7 @@ rec_get_converted_size( dtuple->n_fields, NULL)); } - data_size = dtuple_get_data_size(dtuple); + data_size = dtuple_get_data_size(dtuple, 0); extra_size = rec_get_converted_extra_size( data_size, dtuple_get_n_fields(dtuple), n_ext); @@ -1585,22 +1578,23 @@ rec_get_converted_size( return(data_size + extra_size); } -/**************************************************************** +#ifndef UNIV_HOTBACKUP +/************************************************************//** Folds a prefix of a physical record to a ulint. Folds only existing fields, -that is, checks that we do not run out of the record. */ +that is, checks that we do not run out of the record. +@return the folded value */ UNIV_INLINE ulint rec_fold( /*=====*/ - /* out: the folded value */ - const rec_t* rec, /* in: the physical record */ - const ulint* offsets, /* in: array returned by + const rec_t* rec, /*!< in: the physical record */ + const ulint* offsets, /*!< in: array returned by rec_get_offsets() */ - ulint n_fields, /* in: number of complete + ulint n_fields, /*!< in: number of complete fields to fold */ - ulint n_bytes, /* in: number of bytes to fold + ulint n_bytes, /*!< in: number of bytes to fold in an incomplete last field */ - dulint tree_id) /* in: index tree id */ + dulint tree_id) /*!< in: index tree id */ { ulint i; const byte* data; @@ -1650,3 +1644,4 @@ rec_fold( return(fold); } +#endif /* !UNIV_HOTBACKUP */ |