MySQL 8.0.39
Source Code Documentation
data0data.cc File Reference

SQL data field and tuple. More...

#include <sys/types.h>
#include <new>
#include "data0data.h"
#include "ha_prototypes.h"
#include "btr0cur.h"
#include "dict0dict.h"
#include "lob0lob.h"
#include "page0page.h"
#include "page0zip.h"
#include "rem0cmp.h"
#include "rem0rec.h"
#include "row0mysql.h"
#include "row0upd.h"

Functions

bool dtuple_coll_eq (const dtuple_t *tuple1, const dtuple_t *tuple2)
 Compare two data tuples. More...
 
void dtuple_set_n_fields (dtuple_t *tuple, ulint n_fields)
 Sets number of fields used in a tuple. More...
 
static bool dfield_check_typed_no_assert (const dfield_t *field)
 Checks that a data field is typed. More...
 
static bool dtuple_check_typed_no_assert (const dtuple_t *tuple)
 Checks that a data tuple is typed. More...
 
bool dfield_check_typed (const dfield_t *field)
 Checks that a data field is typed. More...
 
bool dtuple_check_typed (const dtuple_t *tuple)
 Checks that a data tuple is typed. More...
 
bool dtuple_validate (const dtuple_t *tuple)
 Validates the consistency of a tuple which must be complete, i.e, all fields must have been set. More...
 
void dfield_print_also_hex (const dfield_t *dfield)
 Pretty prints a dfield value according to its data type. More...
 
static void dfield_print_raw (FILE *f, const dfield_t *dfield)
 Print a dfield value using ut_print_buf. More...
 
void dtuple_print (FILE *f, const dtuple_t *tuple)
 The following function prints the contents of a tuple. More...
 
void dfield_print (std::ostream &o, const dfield_t *field, ulint n)
 Print the contents of a tuple. More...
 
void dtuple_print (std::ostream &o, const dtuple_t *tuple)
 Print the contents of a tuple. More...
 
big_rec_tdtuple_convert_big_rec (dict_index_t *index, upd_t *upd, dtuple_t *entry)
 Moves parts of long fields in entry to the big record vector so that the size of tuple drops below the maximum record size allowed in the database. More...
 
void dtuple_convert_back_big_rec (dtuple_t *entry, big_rec_t *vector)
 Puts back to entry the data stored in vector. More...
 
bool is_multi_value_clust_and_sec_equal (const byte *clust_field, uint64_t clust_len, const byte *sec_field, uint64_t sec_len, const dict_col_t *col)
 Compare a multi-value clustered index field with a secondary index field, to see if they are equal. More...
 

Variables

byte data_error
 Dummy variable to catch access to uninitialized fields. More...
 

Detailed Description

SQL data field and tuple.

Created 5/30/1994 Heikki Tuuri

Function Documentation

◆ dfield_check_typed()

bool dfield_check_typed ( const dfield_t field)

Checks that a data field is typed.

Asserts an error if not.

Returns
true if ok in: data field

◆ dfield_check_typed_no_assert()

static bool dfield_check_typed_no_assert ( const dfield_t field)
static

Checks that a data field is typed.

Parameters
[in]fieldData field.
Returns
true if ok

◆ dfield_print()

void dfield_print ( std::ostream &  o,
const dfield_t field,
ulint  n 
)

Print the contents of a tuple.

Parameters
[out]ooutput stream
[in]fieldarray of data fields
[in]nnumber of data fields

◆ dfield_print_also_hex()

void dfield_print_also_hex ( const dfield_t dfield)

Pretty prints a dfield value according to its data type.

Also the hex string is printed if a string contains non-printable characters. in: dfield

◆ dfield_print_raw()

static void dfield_print_raw ( FILE *  f,
const dfield_t dfield 
)
static

Print a dfield value using ut_print_buf.

Parameters
[in,out]fOutput stream.
[in]dfieldValue to print.

◆ dtuple_check_typed()

bool dtuple_check_typed ( const dtuple_t tuple)

Checks that a data tuple is typed.

Asserts an error if not.

Returns
true if ok in: tuple

◆ dtuple_check_typed_no_assert()

static bool dtuple_check_typed_no_assert ( const dtuple_t tuple)
static

Checks that a data tuple is typed.

Parameters
[in]tupleTuple to check.
Returns
true if ok

◆ dtuple_coll_eq()

bool dtuple_coll_eq ( const dtuple_t tuple1,
const dtuple_t tuple2 
)

Compare two data tuples.

Parameters
[in]tuple1first data tuple
[in]tuple2second data tuple
Returns
whether tuple1==tuple2

◆ dtuple_convert_back_big_rec()

void dtuple_convert_back_big_rec ( dtuple_t entry,
big_rec_t vector 
)

Puts back to entry the data stored in vector.

Note that to ensure the fields in entry can accommodate the data, vector must have been created from entry with dtuple_convert_big_rec.

Parameters
[in]entryEntry whose data was put to vector.
[in]vectorBig rec vector; it is freed in this function

◆ dtuple_convert_big_rec()

big_rec_t * dtuple_convert_big_rec ( dict_index_t index,
upd_t upd,
dtuple_t entry 
)

Moves parts of long fields in entry to the big record vector so that the size of tuple drops below the maximum record size allowed in the database.

Moves data only from those fields which are not necessary to determine uniquely the insertion place of the tuple in the index.

Parameters
[in,out]indexIndex that owns the record.
[in,out]updUpdate vector.
[in,out]entryIndex entry.
Returns
own: created big record vector, NULL if we are not able to shorten the entry enough, i.e., if there are too many fixed-length or short fields in entry or the index is clustered

◆ dtuple_print() [1/2]

void dtuple_print ( FILE *  f,
const dtuple_t tuple 
)

The following function prints the contents of a tuple.

Parameters
[in,out]fOutput stream.
[in]tupleTuple to print.

◆ dtuple_print() [2/2]

void dtuple_print ( std::ostream &  o,
const dtuple_t tuple 
)

Print the contents of a tuple.

Parameters
[out]ooutput stream
[in]tupledata tuple

◆ dtuple_set_n_fields()

void dtuple_set_n_fields ( dtuple_t tuple,
ulint  n_fields 
)

Sets number of fields used in a tuple.

Normally this is set in dtuple_create, but if you want later to set it smaller, you can use this.

Parameters
[in]tupleTuple.
[in]n_fieldsNumber of fields.

◆ dtuple_validate()

bool dtuple_validate ( const dtuple_t tuple)

Validates the consistency of a tuple which must be complete, i.e, all fields must have been set.

Returns
true if ok in: tuple

◆ is_multi_value_clust_and_sec_equal()

bool is_multi_value_clust_and_sec_equal ( const byte clust_field,
uint64_t  clust_len,
const byte sec_field,
uint64_t  sec_len,
const dict_col_t col 
)

Compare a multi-value clustered index field with a secondary index field, to see if they are equal.

If the clustered index field is the array, then equal means it contains the secondary index field

Parameters
[in]clust_fieldclustered index field
[in]clust_lenclustered index field length
[in]sec_fieldsecondary index field
[in]sec_lensecondary index field length
[in]colthe column tied to this field
Returns
true if they are equal, otherwise false

Variable Documentation

◆ data_error

byte data_error

Dummy variable to catch access to uninitialized fields.

In the debug version, dtuple_create() will make all fields of dtuple_t point to data_error.