MySQL 8.0.31
Source Code Documentation
rem0wrec.h File Reference

Record manager wrapper declaration. More...

#include "rem/rec.h"

Go to the source code of this file.

Functions

byterec_get_nth_field (const dict_index_t *index, const rec_t *rec, const ulint *offsets, ulint n, ulint *len)
 Gets the value of the specified field in the record. More...
 
const byterec_get_nth_field_old (const dict_index_t *index, const rec_t *rec, ulint n, ulint *len)
 
ulint rec_get_nth_field_size (const dict_index_t *index, const rec_t *rec, ulint n)
 Gets the physical size of an old-style field. More...
 
ulint rec_get_nth_field_offs (const dict_index_t *index, const ulint *offsets, ulint n, ulint *len)
 The following function is used to get an offset to the nth data field in a record. More...
 
ulint rec_get_nth_field_offs_old (const dict_index_t *index, 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. More...
 
ulint rec_offs_nth_extern (const dict_index_t *index, const ulint *offsets, ulint n)
 Returns nonzero if the extern bit is set in nth field of rec. More...
 
void rec_offs_make_nth_extern (dict_index_t *index, ulint *offsets, ulint n)
 Mark the nth field as externally stored. More...
 
ulint rec_offs_nth_sql_null (const dict_index_t *index, const ulint *offsets, ulint n)
 Returns nonzero if the SQL NULL bit is set in nth field of rec. More...
 
ulint rec_offs_nth_default (const dict_index_t *index, const ulint *offsets, ulint n)
 Returns nonzero if the default bit is set in nth field of rec. More...
 
ulint rec_offs_nth_size (const dict_index_t *index, const ulint *offsets, ulint n)
 Gets the physical size of a field. More...
 
void rec_set_nth_field (const dict_index_t *index, 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. More...
 
ulint rec_2_is_field_extern (const dict_index_t *index, const rec_t *rec, ulint n)
 Returns nonzero if the field is stored off-page. More...
 
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. More...
 

Detailed Description

Record manager wrapper declaration.

Record manager wrapper implementation.

After INSTANT ADD/DROP feature, fields index on logical record might not be same as field index on physical record. So this wrapper is implemented which translates logical index to physical index. And then functions of low level record manager (rem0lrec.h) are called with physical index of the field.

Created 13/08/2021 Mayank Prasad

Created 13/08/2021 Mayank Prasad

Function Documentation

◆ rec_2_is_field_extern()

ulint rec_2_is_field_extern ( const dict_index_t index,
const rec_t rec,
ulint  n 
)

Returns nonzero if the field is stored off-page.

Parameters
[in]indexindex
[in]recrecord
[in]nfield index
Return values
0if the field is stored in-page
REC_2BYTE_EXTERN_MASKif the field is stored externally

◆ rec_get_data_size_old()

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

◆ rec_get_nth_field()

byte * rec_get_nth_field ( const dict_index_t index,
const rec_t rec,
const ulint offsets,
ulint  n,
ulint len 
)

Gets the value of the specified field in the record.

Parameters
[in]indexrecord descriptor
[in]recphysical record
[in]offsetsarray returned by rec_get_offsets()
[in]nindex of the field
[out]lenlength of the field, UNIV_SQL_NULL if SQL null
Returns
value of the field

◆ rec_get_nth_field_offs()

ulint rec_get_nth_field_offs ( const dict_index_t index,
const ulint offsets,
ulint  n,
ulint len 
)

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

Parameters
[in]indexrecord descriptor
[in]offsetsarray returned by rec_get_offsets()
[in]nindex of the field
[out]lenlength of the field; UNIV_SQL_NULL if SQL null; UNIV_SQL_ADD_COL_DEFAULT if it's default value and no value inlined
Returns
offset from the origin of rec

◆ rec_get_nth_field_offs_old()

ulint rec_get_nth_field_offs_old ( const dict_index_t index,
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.

Parameters
[in]indexrecord descriptor
[in]recrecord
[in]nindex of the field
[in]lenlength of the field;UNIV_SQL_NULL if SQL null
Returns
offset to the field

◆ rec_get_nth_field_old()

const byte * rec_get_nth_field_old ( const dict_index_t index,
const rec_t rec,
ulint  n,
ulint len 
)

◆ rec_get_nth_field_size()

ulint rec_get_nth_field_size ( const dict_index_t index,
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.

Parameters
[in]indexrecord descriptor
[in]recrecord
[in]nindex of the field
Returns
field size in bytes

◆ rec_offs_make_nth_extern()

void rec_offs_make_nth_extern ( dict_index_t index,
ulint offsets,
ulint  n 
)

Mark the nth field as externally stored.

Parameters
[in]indexrecord descriptor
[in]offsetsarray returned by rec_get_offsets()
[in]nnth field

◆ rec_offs_nth_default()

ulint rec_offs_nth_default ( const dict_index_t index,
const ulint offsets,
ulint  n 
)

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

Parameters
[in]indexrecord descriptor
[in]offsetsarray returned by rec_get_offsets()
[in]nnth field
Returns
nonzero if default bit is set

◆ rec_offs_nth_extern()

ulint rec_offs_nth_extern ( const dict_index_t index,
const ulint offsets,
ulint  n 
)

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

Parameters
[in]indexrecord descriptor
[in]offsetsarray returned by rec_get_offsets()
[in]nnth field
Returns
nonzero if externally stored

◆ rec_offs_nth_size()

ulint rec_offs_nth_size ( const dict_index_t index,
const ulint offsets,
ulint  n 
)

Gets the physical size of a field.

Parameters
[in]indexrecord descriptor
[in]offsetsarray returned by rec_get_offsets()
[in]nnth field
Returns
length of field

◆ rec_offs_nth_sql_null()

ulint rec_offs_nth_sql_null ( const dict_index_t index,
const ulint offsets,
ulint  n 
)

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

Parameters
[in]indexrecord descriptor
[in]offsetsarray returned by rec_get_offsets()
[in]nnth field
Returns
nonzero if SQL NULL

◆ rec_set_nth_field()

void rec_set_nth_field ( const dict_index_t index,
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
[in]indexrecord descriptor
[in]recrecord
[in]offsetsarray returned by rec_get_offsets()
[in]nindex number of the field
[in]lenlength 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.
[in]datapointer to the data if not SQL null