drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
data0data.h File Reference
#include "univ.i"
#include "data0types.h"
#include "data0type.h"
#include "mem0mem.h"
#include "dict0types.h"
Include dependency graph for data0data.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dfield_struct
struct  dtuple_struct
struct  big_rec_field_struct
struct  big_rec_struct

Macros

#define data0data_h
#define dfield_get_type(field)
#define dfield_get_data(field)
#define dtuple_get_nth_field(tuple, n)

Typedefs

typedef struct big_rec_struct big_rec_t
typedef struct big_rec_field_struct big_rec_field_t

Functions

UNIV_INLINE void dfield_set_type (dfield_t *field, dtype_t *type)
UNIV_INLINE ulint dfield_get_len (const dfield_t *field)
UNIV_INLINE void dfield_set_len (dfield_t *field, ulint len)
UNIV_INLINE ulint dfield_is_null (const dfield_t *field)
UNIV_INLINE ulint dfield_is_ext (const dfield_t *field)
UNIV_INLINE void dfield_set_ext (dfield_t *field)
UNIV_INLINE void dfield_set_data (dfield_t *field, const void *data, ulint len)
UNIV_INLINE void dfield_set_null (dfield_t *field)
UNIV_INLINE void data_write_sql_null (byte *data, ulint len)
UNIV_INLINE void dfield_copy_data (dfield_t *field1, const dfield_t *field2)
UNIV_INLINE void dfield_copy (dfield_t *field1, const dfield_t *field2)
UNIV_INLINE void dfield_dup (dfield_t *field, mem_heap_t *heap)
UNIV_INLINE ibool dfield_datas_are_binary_equal (const dfield_t *field1, const dfield_t *field2, ulint len) __attribute__((nonnull
UNIV_INTERN ibool dfield_data_is_binary_equal (const dfield_t *field, ulint len, const byte *data)
UNIV_INLINE ulint dtuple_get_n_fields (const dtuple_t *tuple)
UNIV_INLINE ulint dtuple_get_info_bits (const dtuple_t *tuple)
UNIV_INLINE void dtuple_set_info_bits (dtuple_t *tuple, ulint info_bits)
UNIV_INLINE ulint dtuple_get_n_fields_cmp (const dtuple_t *tuple)
UNIV_INLINE void dtuple_set_n_fields_cmp (dtuple_t *tuple, ulint n_fields_cmp)
UNIV_INLINE dtuple_t * dtuple_create (mem_heap_t *heap, ulint n_fields)
UNIV_INLINE const dtuple_t * dtuple_from_fields (dtuple_t *tuple, const dfield_t *fields, ulint n_fields)
UNIV_INTERN void dtuple_set_n_fields (dtuple_t *tuple, ulint n_fields)
UNIV_INLINE dtuple_t * dtuple_copy (const dtuple_t *tuple, mem_heap_t *heap)
UNIV_INLINE ulint dtuple_get_data_size (const dtuple_t *tuple, ulint comp)
UNIV_INLINE ulint dtuple_get_n_ext (const dtuple_t *tuple)
UNIV_INTERN int dtuple_coll_cmp (const dtuple_t *tuple1, const dtuple_t *tuple2)
UNIV_INLINE ulint dtuple_fold (const dtuple_t *tuple, ulint n_fields, ulint n_bytes, index_id_t tree_id) __attribute__((pure))
UNIV_INLINE void dtuple_set_types_binary (dtuple_t *tuple, ulint n)
UNIV_INLINE ibool dtuple_contains_null (const dtuple_t *tuple)
UNIV_INTERN ibool dfield_check_typed (const dfield_t *field)
UNIV_INTERN ibool dtuple_check_typed (const dtuple_t *tuple)
UNIV_INTERN ibool dtuple_check_typed_no_assert (const dtuple_t *tuple)
UNIV_INTERN void dfield_print (const dfield_t *dfield)
UNIV_INTERN void dfield_print_also_hex (const dfield_t *dfield)
UNIV_INTERN void dtuple_print (FILE *f, const dtuple_t *tuple)
UNIV_INTERN big_rec_t * dtuple_convert_big_rec (dict_index_t *index, dtuple_t *entry, ulint *n_ext)
UNIV_INTERN void dtuple_convert_back_big_rec (dict_index_t *index, dtuple_t *entry, big_rec_t *vector)
UNIV_INLINE void dtuple_big_rec_free (big_rec_t *vector)

Variables

UNIV_INLINE ibool warn_unused_result

Detailed Description

SQL data field and tuple

Created 5/30/1994 Heikki Tuuri

Definition in file data0data.h.

Macro Definition Documentation

◆ data0data_h

#define data0data_h

Definition at line 28 of file data0data.h.

◆ dfield_get_data

#define dfield_get_data ( field)
Value:
((field)->data)

Definition at line 60 of file data0data.h.

◆ dfield_get_type

#define dfield_get_type ( field)
Value:
(&(field)->type)

Definition at line 59 of file data0data.h.

◆ dtuple_get_nth_field

#define dtuple_get_nth_field ( tuple,
n )
Value:
((tuple)->fields + (n))

Definition at line 200 of file data0data.h.

Typedef Documentation

◆ big_rec_field_t

A slot for a field in a big rec vector

Definition at line 468 of file data0data.h.

◆ big_rec_t

typedef struct big_rec_struct big_rec_t

Storage for overflow data in a big record, that is, a clustered index record which needs external storage of data fields

Definition at line 39 of file data0data.h.

Function Documentation

◆ data_write_sql_null()

UNIV_INLINE void data_write_sql_null ( byte * data,
ulint len )

Writes an SQL null field full of zeros. in: SQL null size in bytes

Parameters
datain: pointer to a buffer of size len

◆ dfield_check_typed()

UNIV_INTERN ibool 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_copy()

UNIV_INLINE void dfield_copy ( dfield_t * field1,
const dfield_t * field2 )

Copies a data field to another. in: field to copy from

Parameters
field1out: field to copy to

◆ dfield_copy_data()

UNIV_INLINE void dfield_copy_data ( dfield_t * field1,
const dfield_t * field2 )

Copies the data and len fields. in: field to copy from

Parameters
field1out: field to copy to

◆ dfield_data_is_binary_equal()

UNIV_INTERN ibool dfield_data_is_binary_equal ( const dfield_t * field,
ulint len,
const byte * data )

Tests if dfield data length and content is equal to the given.

Returns
TRUE if equal in: data

Tests if dfield data length and content is equal to the given.

Returns
TRUE if equal
Parameters
fieldin: field
lenin: data length or UNIV_SQL_NULL
datain: data

Definition at line 61 of file data0data.cc.

◆ dfield_datas_are_binary_equal()

UNIV_INLINE ibool dfield_datas_are_binary_equal ( const dfield_t * field1,
const dfield_t * field2,
ulint len )

Tests if two data fields are equal. If len==0, tests the data length and content for equality. If len>0, tests the first len bytes of the content for equality.

Returns
TRUE if both fields are NULL or if they are equal
Parameters
field1in: field
field2in: field
lenin: maximum prefix to compare, or 0 to compare the whole field length

◆ dfield_dup()

UNIV_INLINE void dfield_dup ( dfield_t * field,
mem_heap_t * heap )

Copies the data pointed to by a data field. in: memory heap where allocated

Parameters
fieldin/out: data field

◆ dfield_get_len()

UNIV_INLINE ulint dfield_get_len ( const dfield_t * field)

Gets length of field data.

Returns
length of data; UNIV_SQL_NULL if SQL null data in: field

◆ dfield_is_ext()

UNIV_INLINE ulint dfield_is_ext ( const dfield_t * field)

Determines if a field is externally stored

Returns
nonzero if externally stored in: field

◆ dfield_is_null()

UNIV_INLINE ulint dfield_is_null ( const dfield_t * field)

Determines if a field is SQL NULL

Returns
nonzero if SQL null data in: field

◆ dfield_print()

UNIV_INTERN void dfield_print ( const dfield_t * dfield)

Pretty prints a dfield value according to its data type. in: dfield

Pretty prints a dfield value according to its data type.

Parameters
dfieldin: dfield

Definition at line 305 of file data0data.cc.

◆ dfield_print_also_hex()

UNIV_INTERN 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

Pretty prints a dfield value according to its data type. Also the hex string is printed if a string contains non-printable characters.

Parameters
dfieldin: dfield

Definition at line 346 of file data0data.cc.

◆ dfield_set_data()

UNIV_INLINE void dfield_set_data ( dfield_t * field,
const void * data,
ulint len )

Sets pointer to the data and length in a field. in: length or UNIV_SQL_NULL

Parameters
fieldin: field
datain: data

◆ dfield_set_ext()

UNIV_INLINE void dfield_set_ext ( dfield_t * field)

Sets the "external storage" flag in/out: field

◆ dfield_set_len()

UNIV_INLINE void dfield_set_len ( dfield_t * field,
ulint len )

Sets length in a field. in: length or UNIV_SQL_NULL

Parameters
fieldin: field

◆ dfield_set_null()

UNIV_INLINE void dfield_set_null ( dfield_t * field)

Sets a data field to SQL NULL. in/out: field

◆ dfield_set_type()

UNIV_INLINE void dfield_set_type ( dfield_t * field,
dtype_t * type )

Sets the type struct of SQL data field. in: pointer to data type struct

Parameters
fieldin: SQL data field

◆ dtuple_big_rec_free()

UNIV_INLINE void dtuple_big_rec_free ( big_rec_t * vector)

Frees the memory in a big rec vector. in, own: big rec vector; it is freed in this function

◆ dtuple_check_typed()

UNIV_INTERN ibool 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()

UNIV_INTERN ibool dtuple_check_typed_no_assert ( const dtuple_t * tuple)

Checks that a data tuple is typed.

Returns
TRUE if ok in: tuple

Checks that a data tuple is typed.

Returns
TRUE if ok
Parameters
tuplein: tuple

Definition at line 170 of file data0data.cc.

◆ dtuple_coll_cmp()

UNIV_INTERN int dtuple_coll_cmp ( const dtuple_t * tuple1,
const dtuple_t * tuple2 )

Compare two data tuples, respecting the collation of character fields.

Returns
1, 0 , -1 if tuple1 is greater, equal, less, respectively, than tuple2 in: tuple 2

Compare two data tuples, respecting the collation of character fields.

Returns
1, 0 , -1 if tuple1 is greater, equal, less, respectively, than tuple2
Parameters
tuple1in: tuple 1
tuple2in: tuple 2

Definition at line 91 of file data0data.cc.

◆ dtuple_contains_null()

UNIV_INLINE ibool dtuple_contains_null ( const dtuple_t * tuple)

Checks if a dtuple contains an SQL null value.

Returns
TRUE if some field is SQL null in: dtuple

◆ dtuple_convert_back_big_rec()

UNIV_INTERN void dtuple_convert_back_big_rec ( dict_index_t * index,
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. in, own: big rec vector; it is freed in this function

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
indexin: index
entryin: entry whose data was put to vector
vectorin, own: big rec vector; it is freed in this function

Definition at line 768 of file data0data.cc.

◆ dtuple_convert_big_rec()

UNIV_INTERN big_rec_t * dtuple_convert_big_rec ( dict_index_t * index,
dtuple_t * entry,
ulint * n_ext )

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.

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 in/out: number of externally stored columns

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.

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
Parameters
indexin: index
entryin/out: index entry
n_extin/out: number of externally stored columns

Definition at line 566 of file data0data.cc.

◆ dtuple_copy()

UNIV_INLINE dtuple_t * dtuple_copy ( const dtuple_t * tuple,
mem_heap_t * heap )

Copies a data tuple to another. This is a shallow copy; if a deep copy is desired, dfield_dup() will have to be invoked on each field.

Returns
own: copy of tuple in: memory heap where the tuple is created
Parameters
tuplein: tuple to copy from

◆ dtuple_create()

UNIV_INLINE dtuple_t * dtuple_create ( mem_heap_t * heap,
ulint n_fields )

Creates a data tuple to a memory heap. The default value for number of fields used in record comparisons for this tuple is n_fields.

Returns
own: created tuple in: number of fields
Parameters
heapin: memory heap where the tuple is created

◆ dtuple_fold()

UNIV_INLINE ulint dtuple_fold ( const dtuple_t * tuple,
ulint n_fields,
ulint n_bytes,
index_id_t tree_id )

Folds a prefix given as the number of fields of a tuple.

Returns
the folded value
Parameters
tuplein: the tuple
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

◆ dtuple_from_fields()

UNIV_INLINE const dtuple_t * dtuple_from_fields ( dtuple_t * tuple,
const dfield_t * fields,
ulint n_fields )

Wrap data fields in a tuple. The default value for number of fields used in record comparisons for this tuple is n_fields.

Returns
data tuple in: number of fields
Parameters
tuplein: storage for data tuple
fieldsin: fields

◆ dtuple_get_data_size()

UNIV_INLINE ulint dtuple_get_data_size ( const dtuple_t * tuple,
ulint comp )

The following function returns the sum of data lengths of a tuple. The space occupied by the field structs or the tuple struct is not counted.

Returns
sum of data lens in: nonzero=ROW_FORMAT=COMPACT
Parameters
tuplein: typed data tuple

◆ dtuple_get_info_bits()

UNIV_INLINE ulint dtuple_get_info_bits ( const dtuple_t * tuple)

Gets info bits in a data tuple.

Returns
info bits in: tuple

◆ dtuple_get_n_ext()

UNIV_INLINE ulint dtuple_get_n_ext ( const dtuple_t * tuple)

Computes the number of externally stored fields in a data tuple.

Returns
number of fields in: tuple

◆ dtuple_get_n_fields()

UNIV_INLINE ulint dtuple_get_n_fields ( const dtuple_t * tuple)

Gets number of fields in a data tuple.

Returns
number of fields in: tuple

◆ dtuple_get_n_fields_cmp()

UNIV_INLINE ulint dtuple_get_n_fields_cmp ( const dtuple_t * tuple)

Gets number of fields used in record comparisons.

Returns
number of fields used in comparisons in rem0cmp.* in: tuple

◆ dtuple_print()

UNIV_INTERN void dtuple_print ( FILE * f,
const dtuple_t * tuple )

The following function prints the contents of a tuple. in: tuple

The following function prints the contents of a tuple.

Parameters
fin: output stream
tuplein: tuple

Definition at line 532 of file data0data.cc.

◆ dtuple_set_info_bits()

UNIV_INLINE void dtuple_set_info_bits ( dtuple_t * tuple,
ulint info_bits )

Sets info bits in a data tuple. in: info bits

Parameters
tuplein: tuple

◆ dtuple_set_n_fields()

UNIV_INTERN 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. in: number of 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
tuplein: tuple
n_fieldsin: number of fields

Definition at line 132 of file data0data.cc.

◆ dtuple_set_n_fields_cmp()

UNIV_INLINE void dtuple_set_n_fields_cmp ( dtuple_t * tuple,
ulint n_fields_cmp )

Gets number of fields used in record comparisons. in: number of fields used in comparisons in rem0cmp.*

Parameters
tuplein: tuple

◆ dtuple_set_types_binary()

UNIV_INLINE void dtuple_set_types_binary ( dtuple_t * tuple,
ulint n )

Sets types of fields binary in a tuple. in: number of fields to set

Parameters
tuplein: data tuple

Variable Documentation

◆ warn_unused_result

UNIV_INLINE ibool warn_unused_result

Definition at line 170 of file data0data.h.