MySQL 9.1.0
Source Code Documentation
rem0lrec.h File Reference

Record manager. More...

#include "rem0rec.h"

Go to the source code of this file.

Functions

static void rec_set_nth_field_sql_null_low (rec_t *rec, ulint n)
 Set nth field value to SQL NULL. More...
 
static ulint rec_offs_nth_sql_null_low (const ulint *offsets, ulint n)
 Returns nonzero if the SQL NULL bit is set in nth field of rec. More...
 
static ulint rec_get_field_start_offs_low (const rec_t *rec, ulint n)
 Read the offset of the start of a data field in the record. More...
 
static ulint rec_1_get_field_start_offs_low (const rec_t *rec, ulint n)
 Returns the offset of nth field start if the record is stored in the 1-byte offsets form. More...
 
static ulint rec_1_get_field_end_info_low (const rec_t *rec, ulint n)
 Returns the offset of nth field end if the record is stored in the 1-byte offsets form. More...
 
static void rec_1_set_field_end_info_low (rec_t *rec, ulint n, ulint info)
 Sets the field end info for the nth field if the record is stored in the 1-byte format. More...
 
static ulint rec_2_get_field_start_offs_low (const rec_t *rec, ulint n)
 Returns the offset of nth field start if the record is stored in the 2-byte offsets form. More...
 
static ulint rec_2_get_field_end_info_low (const rec_t *rec, ulint n)
 Returns the offset of nth field end if the record is stored in the 2-byte offsets form. More...
 
static void rec_2_set_field_end_info_low (rec_t *rec, ulint n, ulint info)
 Sets the field end info for the nth field if the record is stored in the 2-byte format. More...
 
static void rec_set_nth_field_null_bit_low (rec_t *rec, ulint i, bool val)
 Sets the value of the ith field SQL null bit of an old-style record. More...
 
static ulint rec_get_nth_field_size_low (const rec_t *rec, ulint n)
 Gets the physical size of an old-style field. More...
 
static ulint rec_get_nth_field_offs_old_low (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...
 
static void rec_offs_make_nth_extern_low (ulint *offsets, const ulint n)
 Mark the nth field as externally stored. More...
 
static ulint rec_offs_nth_default_low (const ulint *offsets, ulint n)
 Returns nonzero if the default bit is set in nth field of rec. More...
 
static ulint rec_offs_nth_size_low (const ulint *offsets, ulint n)
 Gets the physical size of a field. More...
 
static void rec_set_nth_field_low (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...
 

Detailed Description

Record manager.

This file contains low level functions which deals with physical index of fields in a physical record.

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

Created 13/08/2021 Mayank Prasad

Function Documentation

◆ rec_1_get_field_end_info_low()

static ulint rec_1_get_field_end_info_low ( const rec_t rec,
ulint  n 
)
inlinestatic

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.

Parameters
[in]recrecord
[in]nindex of the field
Returns
offset of the start of the field, SQL null flag ORed

◆ rec_1_get_field_start_offs_low()

static ulint rec_1_get_field_start_offs_low ( const rec_t rec,
ulint  n 
)
inlinestatic

Returns the offset of nth field start if the record is stored in the 1-byte offsets form.

Parameters
[in]recrecord
[in]nindex of the field
Returns
offset of the start of the field

◆ rec_1_set_field_end_info_low()

static void rec_1_set_field_end_info_low ( rec_t rec,
ulint  n,
ulint  info 
)
inlinestatic

Sets the field end info for the nth field if the record is stored in the 1-byte format.

Parameters
[in,out]recrecord
[in]nindex of the field
[in]infovalue to set

◆ rec_2_get_field_end_info_low()

static ulint rec_2_get_field_end_info_low ( const rec_t rec,
ulint  n 
)
inlinestatic

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.

Parameters
[in]recrecord
[in]nindex of the field
Returns
offset of the start of the field, SQL null flag and extern storage flag ORed

◆ rec_2_get_field_start_offs_low()

static ulint rec_2_get_field_start_offs_low ( const rec_t rec,
ulint  n 
)
inlinestatic

Returns the offset of nth field start if the record is stored in the 2-byte offsets form.

Parameters
[in]recrecord
[in]nindex of the field
Returns
offset of the start of the field

◆ rec_2_set_field_end_info_low()

static void rec_2_set_field_end_info_low ( rec_t rec,
ulint  n,
ulint  info 
)
inlinestatic

Sets the field end info for the nth field if the record is stored in the 2-byte format.

Parameters
[in]recrecord
[in]nindex of the field
[out]infoend info

◆ rec_get_field_start_offs_low()

static ulint rec_get_field_start_offs_low ( const rec_t rec,
ulint  n 
)
inlinestatic

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.

Parameters
[in]recrecord
[in]nindex of the field
Returns
offset of the start of the field

◆ rec_get_nth_field_offs_old_low()

static ulint rec_get_nth_field_offs_old_low ( const rec_t rec,
ulint  n,
ulint len 
)
inlinestatic

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

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

◆ rec_get_nth_field_size_low()

static ulint rec_get_nth_field_size_low ( const rec_t rec,
ulint  n 
)
inlinestatic

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]recrecord
[in]nindex of the field
Returns
field size in bytes

◆ rec_offs_make_nth_extern_low()

static void rec_offs_make_nth_extern_low ( ulint offsets,
const ulint  n 
)
inlinestatic

Mark the nth field as externally stored.

Parameters
[in]offsetsarray returned by rec_get_offsets()
[in]nindex of the field

◆ rec_offs_nth_default_low()

static ulint rec_offs_nth_default_low ( const ulint offsets,
ulint  n 
)
inlinestatic

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

Parameters
[in]offsetsarray returned by rec_get_offsets()
[in]nindex of the field
Returns
nonzero if default bit is set

◆ rec_offs_nth_size_low()

static ulint rec_offs_nth_size_low ( const ulint offsets,
ulint  n 
)
inlinestatic

Gets the physical size of a field.

Parameters
[in]offsetsarray returned by rec_get_offsets()
[in]nindex of the field
Returns
length of field

◆ rec_offs_nth_sql_null_low()

static ulint rec_offs_nth_sql_null_low ( const ulint offsets,
ulint  n 
)
inlinestatic

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

Parameters
[in]offsetsarray returned by rec_get_offsets()
[in]nindex of the field.
Returns
nonzero if SQL NULL

◆ rec_set_nth_field_low()

static void rec_set_nth_field_low ( rec_t rec,
const ulint offsets,
ulint  n,
const void *  data,
ulint  len 
)
inlinestatic

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]recrecord
[in]offsetsarray returned by rec_get_offsets()
[in]nindex of the field
[in]datapointer to the data if not SQL null
[in]lenlength of the data or UNIV_SQL_NULL

◆ rec_set_nth_field_null_bit_low()

static void rec_set_nth_field_null_bit_low ( rec_t rec,
ulint  i,
bool  val 
)
inlinestatic

Sets the value of the ith field SQL null bit of an old-style record.

Parameters
[in]recrecord
[in]iindex of the field
[in]valvalue to set

◆ rec_set_nth_field_sql_null_low()

static void rec_set_nth_field_sql_null_low ( rec_t rec,
ulint  n 
)
inlinestatic

Set nth field value to SQL NULL.

Parameters
[in,out]recrecord
[in]nindex of the field.