InnoDB Plugin
1.0
|
#include "univ.i"
#include "data0types.h"
#include "data0type.h"
#include "mem0mem.h"
#include "dict0types.h"
#include "data0data.ic"
Go to the source code of this file.
Data Structures | |
struct | dfield_t |
struct | dtuple_t |
struct | big_rec_field_t |
struct | big_rec_t |
Macros | |
#define | DTUPLE_EST_ALLOC(n_fields) (sizeof(dtuple_t) + (n_fields) * sizeof(dfield_t)) |
#define | DATA_TUPLE_MAGIC_N 65478679 |
Functions | |
UNIV_INLINE dtype_t * | dfield_get_type (const dfield_t *field)) |
UNIV_INLINE void * | dfield_get_data (const dfield_t *field)) |
UNIV_INLINE void | dfield_set_type (dfield_t *field, const 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)) |
UNIV_INLINE 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 dfield_t * | dtuple_get_nth_field (const dtuple_t *tuple, ulint n) |
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_from_mem (void *buf, ulint buf_size, ulint n_fields)) |
UNIV_INLINE dtuple_t * | dtuple_create (mem_heap_t *heap, 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)) |
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 ibool | dtuple_validate (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)) |
SQL data field and tuple
Created 5/30/1994 Heikki Tuuri
#define DATA_TUPLE_MAGIC_N 65478679 |
Value of dtuple_t::magic_n
UNIV_INLINE void data_write_sql_null | ( | byte * | data, |
ulint | len | ||
) |
Writes an SQL null field full of zeros.
data | in: pointer to a buffer of size len |
len | in: SQL null size in bytes |
Checks that a data field is typed. Asserts an error if not.
field | in: data field |
Copies a data field to another.
field1 | out: field to copy to |
field2 | in: field to copy from |
Copies the data and len fields.
field1 | out: field to copy to |
field2 | in: field to copy from |
UNIV_INLINE 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.
field | in: field |
len | in: data length or UNIV_SQL_NULL |
data | in: data |
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.
field1 | in: field |
field2 | in: field |
len | in: maximum prefix to compare, or 0 to compare the whole field length |
UNIV_INLINE void dfield_dup | ( | dfield_t * | field, |
mem_heap_t * | heap | ||
) |
Copies the data pointed to by a data field.
field | in/out: data field |
heap | in: memory heap where allocated |
UNIV_INLINE void* dfield_get_data | ( | const dfield_t * | field | ) |
Gets pointer to the data in a field.
field | in: field |
UNIV_INLINE ulint dfield_get_len | ( | const dfield_t * | field | ) |
Gets length of field data.
field | in: field |
Gets pointer to the type struct of SQL data field.
field | in: SQL data field |
UNIV_INLINE ulint dfield_is_ext | ( | const dfield_t * | field | ) |
Determines if a field is externally stored
field | in: field |
UNIV_INLINE ulint dfield_is_null | ( | const dfield_t * | field | ) |
Determines if a field is SQL NULL
field | in: field |
UNIV_INTERN void dfield_print | ( | const dfield_t * | dfield | ) |
Pretty prints a dfield value according to its data type.
dfield | in: dfield |
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.
dfield | in: dfield |
UNIV_INLINE void dfield_set_data | ( | dfield_t * | field, |
const void * | data, | ||
ulint | len | ||
) |
Sets pointer to the data and length in a field.
field | in: field |
data | in: data |
len | in: length or UNIV_SQL_NULL |
UNIV_INLINE void dfield_set_ext | ( | dfield_t * | field | ) |
Sets the "external storage" flag
field | in/out: field |
UNIV_INLINE void dfield_set_len | ( | dfield_t * | field, |
ulint | len | ||
) |
Sets length in a field.
field | in: field |
len | in: length or UNIV_SQL_NULL |
UNIV_INLINE void dfield_set_null | ( | dfield_t * | field | ) |
Sets a data field to SQL NULL.
field | in/out: field |
Sets the type struct of SQL data field.
field | in: SQL data field |
type | in: pointer to data type struct |
UNIV_INLINE void dtuple_big_rec_free | ( | big_rec_t * | vector | ) |
Frees the memory in a big rec vector.
vector | in, own: big rec vector; it is freed in this function |
Checks that a data tuple is typed. Asserts an error if not.
tuple | in: tuple |
Checks that a data tuple is typed.
tuple | in: tuple |
Compare two data tuples, respecting the collation of character fields.
tuple1 | in: tuple 1 |
tuple2 | in: tuple 2 |
Checks if a dtuple contains an SQL null value.
tuple | in: dtuple |
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.
index | in: index |
entry | in: entry whose data was put to vector |
vector | in, own: big rec vector; it is freed in this function |
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.
index | in: index |
entry | in/out: index entry |
n_ext | in/out: number of externally stored columns |
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.
tuple | in: tuple to copy from |
heap | in: memory heap where the tuple is created |
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.
heap | in: memory heap where the tuple is created, DTUPLE_EST_ALLOC(n_fields) bytes will be allocated from this heap |
n_fields | in: number of fields |
UNIV_INLINE dtuple_t* dtuple_create_from_mem | ( | void * | buf, |
ulint | buf_size, | ||
ulint | n_fields | ||
) |
Creates a data tuple from an already allocated chunk of memory. The size of the chunk must be at least DTUPLE_EST_ALLOC(n_fields). The default value for number of fields used in record comparisons for this tuple is n_fields.
buf | in, out: buffer to use |
buf_size | in: buffer size |
n_fields | in: number of fields |
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.
tuple | in: the tuple |
n_fields | in: number of complete fields to fold |
n_bytes | in: number of bytes to fold in an incomplete last field |
tree_id | in: index tree id |
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.
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. Neither is possible space in externally stored parts of the field.
tuple | in: typed data tuple |
comp | in: nonzero=ROW_FORMAT=COMPACT |
UNIV_INLINE ulint dtuple_get_info_bits | ( | const dtuple_t * | tuple | ) |
Gets info bits in a data tuple.
tuple | in: tuple |
UNIV_INLINE ulint dtuple_get_n_ext | ( | const dtuple_t * | tuple | ) |
Computes the number of externally stored fields in a data tuple.
Computes the number of externally stored fields in a data tuple.
tuple | in: tuple |
UNIV_INLINE ulint dtuple_get_n_fields | ( | const dtuple_t * | tuple | ) |
Gets number of fields in a data tuple.
tuple | in: tuple |
UNIV_INLINE ulint dtuple_get_n_fields_cmp | ( | const dtuple_t * | tuple | ) |
Gets number of fields used in record comparisons.
tuple | in: tuple |
Gets nth field of a tuple.
Gets nth field of a tuple.
tuple | in: tuple |
n | in: index of field |
UNIV_INTERN void dtuple_print | ( | FILE * | f, |
const dtuple_t * | tuple | ||
) |
The following function prints the contents of a tuple.
f | in: output stream |
tuple | in: tuple |
UNIV_INLINE void dtuple_set_info_bits | ( | dtuple_t * | tuple, |
ulint | info_bits | ||
) |
Sets info bits in a data tuple.
tuple | in: tuple |
info_bits | in: info bits |
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.
tuple | in: tuple |
n_fields | in: number of fields |
UNIV_INLINE void dtuple_set_n_fields_cmp | ( | dtuple_t * | tuple, |
ulint | n_fields_cmp | ||
) |
Gets number of fields used in record comparisons.
Sets number of fields used in record comparisons.
tuple | in: tuple |
n_fields_cmp | in: number of fields used in comparisons in rem0cmp.* |
UNIV_INLINE void dtuple_set_types_binary | ( | dtuple_t * | tuple, |
ulint | n | ||
) |
Sets types of fields binary in a tuple.
tuple | in: data tuple |
n | in: number of fields to set |