InnoDB Plugin  1.0
Macros | Functions | Variables
rem0rec.h File Reference
#include "univ.i"
#include "data0data.h"
#include "rem0types.h"
#include "mtr0types.h"
#include "page0types.h"
#include "rem0rec.ic"
Include dependency graph for rem0rec.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#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_1BYTE_SQL_NULL_MASK   0x80UL
#define REC_2BYTE_SQL_NULL_MASK   0x8000UL
#define REC_2BYTE_EXTERN_MASK   0x4000UL
#define REC_OFFS_HEADER_SIZE   4
#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,__FILE__,__LINE__,heap)
#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_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_INLINE void rec_set_1byte_offs_flag (rec_t *rec, ibool flag))
UNIV_INLINE ulint rec_1_get_field_end_info (const rec_t *rec, ulint n))
UNIV_INLINE ulint rec_2_get_field_end_info (const rec_t *rec, ulint n))
UNIV_INLINE ulint rec_2_is_field_extern (const rec_t *rec, ulint n))
UNIV_INTERN ulint rec_get_n_extern_new (const rec_t *rec, const 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, const char *file, ulint line, mem_heap_t **heap)
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_INLINE void rec_offs_make_valid (const rec_t *rec, const dict_index_t *index, 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 const byte * rec_offs_any_null_extern (const rec_t *rec, 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 byte * rec_get_start (const rec_t *rec, const ulint *offsets))
UNIV_INLINE byte * rec_get_end (const rec_t *rec, const ulint *offsets))
UNIV_INLINE rec_t * rec_copy (void *buf, const rec_t *rec, const ulint *offsets))
UNIV_INTERN ulint rec_get_converted_size_temp (const dict_index_t *index, const dfield_t *fields, ulint n_fields, ulint *extra))
UNIV_INTERN void rec_init_offsets_temp (const rec_t *rec, const dict_index_t *index, ulint *offsets))
UNIV_INTERN void rec_convert_dtuple_to_temp (rec_t *rec, const dict_index_t *index, const dfield_t *fields, ulint n_fields))
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))
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))
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))
UNIV_INTERN trx_id_t rec_get_trx_id (const rec_t *rec, const dict_index_t *index))

Variables

UNIV_INTERN ulint warn_unused_result

Detailed Description

Record manager

Created 5/30/1994 Heikki Tuuri

Macro Definition Documentation

#define REC_1BYTE_SQL_NULL_MASK   0x80UL

SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records

#define REC_2BYTE_EXTERN_MASK   0x4000UL
In a 2-byte offset of ROW_FORMAT=REDUNDANT records, the second most

significant bit denotes that the tail of a field is stored off-page.

#define REC_2BYTE_SQL_NULL_MASK   0x8000UL

SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records

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

Function Documentation

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

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.

Returns
offset of the start of the field, SQL null flag ORed
Parameters
recin: record
nin: field index
UNIV_INLINE ulint rec_2_get_field_end_info ( const rec_t *  rec,
ulint  n 
)

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.

Returns
offset of the start of the field, SQL null flag and extern storage flag ORed
Parameters
recin: record
nin: field index
UNIV_INLINE ulint rec_2_is_field_extern ( const rec_t *  rec,
ulint  n 
)

Returns nonzero if the field is stored off-page.

Return values
0if the field is stored in-page
REC_2BYTE_EXTERN_MASKif the field is stored externally
Parameters
recin: record
nin: field index
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
Parameters
bufin: start address of the physical record
indexin: record descriptor
dtuplein: data tuple
n_extin: number of externally stored columns
UNIV_INTERN void rec_convert_dtuple_to_temp ( rec_t *  rec,
const dict_index_t index,
const dfield_t fields,
ulint  n_fields 
)

Builds a temporary file record out of a data tuple.

See Also
rec_init_offsets_temp()
Parameters
recout: record
indexin: record descriptor
fieldsin: array of data fields
n_fieldsin: number of fields
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
Parameters
bufin: buffer
recin: physical record
offsetsin: array returned by rec_get_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 
)

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
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.

Parameters
tupleout: data tuple
recin: physical record
indexin: record descriptor
n_fieldsin: number of fields to copy
heapin: memory heap
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

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.

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
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
Parameters
recin: physical record
UNIV_INLINE ulint rec_get_converted_extra_size ( ulint  data_size,
ulint  n_fields,
ulint  n_ext 
)

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
Parameters
indexin: record descriptor
dtuplein: data tuple
n_extin: number of externally stored columns
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
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
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
Parameters
indexin: record descriptor
fieldsin: array of data fields
n_fieldsin: number of data fields
extraout: extra size
UNIV_INTERN ulint rec_get_converted_size_temp ( const dict_index_t index,
const dfield_t fields,
ulint  n_fields,
ulint *  extra 
)

Determines the size of a data tuple prefix in a temporary file.

Returns
total size
Parameters
indexin: record descriptor
fieldsin: array of data fields
n_fieldsin: number of data fields
extraout: extra size
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
Parameters
recin: physical record
UNIV_INLINE ulint rec_get_deleted_flag ( const rec_t *  rec,
ulint  comp 
)

The following function tells if record is delete marked.

Returns
nonzero if delete marked
Parameters
recin: physical record
compin: nonzero=compact page format
UNIV_INLINE byte* rec_get_end ( const rec_t *  rec,
const ulint *  offsets 
)

Returns a pointer to the end of the record.

Returns
pointer to end
Parameters
recin: pointer to record
offsetsin: array returned by rec_get_offsets()
UNIV_INLINE ulint rec_get_heap_no_new ( const rec_t *  rec)

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

Returns
heap order number
Parameters
recin: physical record
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
Parameters
recin: physical record
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
Parameters
recin: physical record
compin: nonzero=compact page format
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
Parameters
recin: physical record
compin: nonzero=compact page format
UNIV_INTERN ulint rec_get_n_extern_new ( const rec_t *  rec,
const 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
Parameters
recin: compact physical record
indexin: record descriptor
nin: number of columns to scan
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
Parameters
recin: physical record
indexin: record descriptor
UNIV_INLINE ulint rec_get_n_fields_old ( const rec_t *  rec)

The following function is used to get the number of fields in an old-style record.

Returns
number of data fields
Parameters
recin: physical record
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
Parameters
recin: new-style physical record
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
Parameters
recin: old-style physical record
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
Parameters
recin: physical record
compin: nonzero=compact page format
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
Parameters
recin: physical record
compin: nonzero=compact page format
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
Parameters
recin: physical record
compin: nonzero=compact page format
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
Parameters
recin: physical record
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
Parameters
offsetsin: array returned by rec_get_offsets()
nin: index of the field
lenout: length of the field; UNIV_SQL_NULL if SQL null
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
Parameters
recin: record
nin: index of the field
lenout: length of the field; UNIV_SQL_NULL if SQL null
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
Parameters
recin: record
nin: index of the field
UNIV_INTERN ulint* rec_get_offsets_func ( const rec_t *  rec,
const dict_index_t index,
ulint *  offsets,
ulint  n_fields,
const char *  file,
ulint  line,
mem_heap_t **  heap 
)

The following function determines the offsets to each field in the record. It can reuse a previously allocated 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)
filein: file name where called
linein: line number where called
heapin/out: memory heap
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.

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
UNIV_INLINE byte* rec_get_start ( const rec_t *  rec,
const ulint *  offsets 
)

Returns a pointer to the start of the record.

Returns
pointer to start
Parameters
recin: pointer to record
offsetsin: array returned by rec_get_offsets()
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
Parameters
recin: physical record
UNIV_INTERN trx_id_t rec_get_trx_id ( const rec_t *  rec,
const dict_index_t index 
)

Reads the DB_TRX_ID of a clustered index record.

Returns
the value of DB_TRX_ID
Parameters
recin: record
indexin: clustered index
UNIV_INTERN void rec_init_offsets_temp ( const rec_t *  rec,
const dict_index_t index,
ulint *  offsets 
)

Determine the offset to each field in temporary file.

See Also
rec_convert_dtuple_to_temp()
Parameters
recin: temporary file record
indexin: record descriptor
offsetsin/out: array of offsets; in: n=rec_offs_n_fields(offsets)
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
Parameters
offsetsin: array returned by rec_get_offsets()
UNIV_INLINE const byte* rec_offs_any_null_extern ( const rec_t *  rec,
const ulint *  offsets 
)

Determine if the offsets are for a record containing null BLOB pointers.

Returns
first field containing a null BLOB pointer, or NULL if none found
Parameters
recin: record
offsetsin: rec_get_offsets(rec)
UNIV_INLINE ulint rec_offs_comp ( const ulint *  offsets)

Determine if the offsets are for a record in the new compact format.

Returns
nonzero if compact format
Parameters
offsetsin: array returned by rec_get_offsets()
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
Parameters
offsetsin: array returned by rec_get_offsets()
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
Parameters
offsetsin: array returned by rec_get_offsets()
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
Parameters
offsetsin: array for rec_get_offsets()
UNIV_INLINE void rec_offs_make_valid ( const rec_t *  rec,
const dict_index_t index,
ulint *  offsets 
)

Updates debug data in offsets, in order to avoid bogus rec_offs_validate() failures.

Parameters
recin: record
indexin: record descriptor
offsetsin: array returned by rec_get_offsets()
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
Parameters
offsetsin: array returned by rec_get_offsets()
UNIV_INLINE ulint rec_offs_n_fields ( const ulint *  offsets)

The following function returns the number of fields in a record.

Returns
number of fields
Parameters
offsetsin: array returned by rec_get_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
Parameters
offsetsin: array returned by rec_get_offsets()
nin: nth field
UNIV_INLINE ulint rec_offs_nth_size ( const ulint *  offsets,
ulint  n 
)

Gets the physical size of a field.

Returns
length of field
Parameters
offsetsin: array returned by rec_get_offsets()
nin: nth field
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
Parameters
offsetsin: array returned by rec_get_offsets()
nin: nth field
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.

Parameters
offsetsout: array for rec_get_offsets(), must be allocated
n_allocin: number of elements
UNIV_INLINE ulint rec_offs_size ( const ulint *  offsets)

Returns the total size of a physical record.

Returns
size
Parameters
offsetsin: array returned by rec_get_offsets()
UNIV_INLINE ibool rec_offs_validate ( const rec_t *  rec,
const dict_index_t index,
const ulint *  offsets 
)

Validates offsets returned by rec_get_offsets().

Returns
TRUE if valid
Parameters
recin: record or NULL
indexin: record descriptor or NULL
offsetsin: array returned by rec_get_offsets()
UNIV_INTERN void rec_print ( FILE *  file,
const rec_t *  rec,
const dict_index_t index 
)

Prints a physical record.

Parameters
filein: file where to print
recin: physical record
indexin: record descriptor
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.

Parameters
filein: file where to print
recin: physical record
offsetsin: array returned by rec_get_offsets()
UNIV_INTERN void rec_print_new ( FILE *  file,
const rec_t *  rec,
const ulint *  offsets 
)

Prints a physical record.

Parameters
filein: file where to print
recin: physical record
offsetsin: array returned by rec_get_offsets()
UNIV_INTERN void rec_print_old ( FILE *  file,
const rec_t *  rec 
)

Prints an old-style physical record.

Parameters
filein: file where to print
recin: physical record
UNIV_INLINE void rec_set_1byte_offs_flag ( rec_t *  rec,
ibool  flag 
)

The following function is used to set the 1-byte offsets flag.

Parameters
recin: physical record
flagin: TRUE if 1byte form
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.

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

The following function is used to set the deleted bit.

Parameters
recin: old-style physical record
flagin: nonzero if delete marked
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.

Parameters
recin/out: physical record
heap_noin: the heap number
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.

Parameters
recin: physical record
heap_noin: the heap number
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.)

Parameters
recin/out: physical record
bitsin: info bits
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.

Parameters
recin/out: new-style physical record
bitsin: info bits
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.

Parameters
recin: old-style physical record
bitsin: info bits
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.

Parameters
recin/out: new-style physical record
page_zipin/out: compressed page, or NULL
n_ownedin: the number of owned
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.

Parameters
recin: old-style physical record
n_ownedin: the number of owned
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.

Parameters
recin/out: new-style physical record
nextin: offset of the next record
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.

Parameters
recin: old-style physical record
nextin: offset of the next record
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.

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
lenin: length of the data or UNIV_SQL_NULL
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.

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

Validates the consistency of a physical record.

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