InnoDB Plugin  1.0
Functions | Variables
data0data.ic File Reference
#include "mem0mem.h"
#include "ut0rnd.h"
Include dependency graph for data0data.ic:
This graph shows which files directly or indirectly include this file:

Functions

UNIV_INLINE dtype_tdfield_get_type (const dfield_t *field)
UNIV_INLINE void dfield_set_type (dfield_t *field, const dtype_t *type)
UNIV_INLINE void * dfield_get_data (const dfield_t *field)
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 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_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 ulint dtuple_get_n_fields (const dtuple_t *tuple)
UNIV_INLINE dfield_tdtuple_get_nth_field (const dtuple_t *tuple, ulint n)
UNIV_INLINE dtuple_tdtuple_create_from_mem (void *buf, ulint buf_size, ulint n_fields)
UNIV_INLINE dtuple_tdtuple_create (mem_heap_t *heap, ulint n_fields)
UNIV_INLINE dtuple_tdtuple_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_INLINE void dtuple_set_types_binary (dtuple_t *tuple, ulint n)
UNIV_INLINE ulint dtuple_fold (const dtuple_t *tuple, ulint n_fields, ulint n_bytes, index_id_t tree_id)
UNIV_INLINE void data_write_sql_null (byte *data, ulint len)
UNIV_INLINE ibool dtuple_contains_null (const dtuple_t *tuple)
UNIV_INLINE void dtuple_big_rec_free (big_rec_t *vector)

Variables

byte data_error

Detailed Description

SQL data field and tuple

Created 5/30/1994 Heikki Tuuri

Function Documentation

UNIV_INLINE void data_write_sql_null ( byte *  data,
ulint  len 
)

Writes an SQL null field full of zeros.

Parameters
datain: pointer to a buffer of size len
lenin: SQL null size in bytes
UNIV_INLINE void dfield_copy ( dfield_t field1,
const dfield_t field2 
)

Copies a data field to another.

Parameters
field1out: field to copy to
field2in: field to copy from
UNIV_INLINE void dfield_copy_data ( dfield_t field1,
const dfield_t field2 
)

Copies the data and len fields.

Parameters
field1out: field to copy to
field2in: 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.

Returns
TRUE if equal
Parameters
fieldin: field
lenin: data length or UNIV_SQL_NULL
datain: 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.

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
UNIV_INLINE void dfield_dup ( dfield_t field,
mem_heap_t heap 
)

Copies the data pointed to by a data field.

Parameters
fieldin/out: data field
heapin: memory heap where allocated
UNIV_INLINE void* dfield_get_data ( const dfield_t field)

Gets pointer to the data in a field.

Returns
pointer to data
Parameters
fieldin: field
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
Parameters
fieldin: field
UNIV_INLINE dtype_t* dfield_get_type ( const dfield_t field)

Gets pointer to the type struct of SQL data field.

Returns
pointer to the type struct
Parameters
fieldin: SQL data field
UNIV_INLINE ulint dfield_is_ext ( const dfield_t field)

Determines if a field is externally stored

Returns
nonzero if externally stored
Parameters
fieldin: field
UNIV_INLINE ulint dfield_is_null ( const dfield_t field)

Determines if a field is SQL NULL

Returns
nonzero if SQL null data
Parameters
fieldin: field
UNIV_INLINE void dfield_set_data ( dfield_t field,
const void *  data,
ulint  len 
)

Sets pointer to the data and length in a field.

Parameters
fieldin: field
datain: data
lenin: length or UNIV_SQL_NULL
UNIV_INLINE void dfield_set_ext ( dfield_t field)

Sets the "external storage" flag

Parameters
fieldin/out: field
UNIV_INLINE void dfield_set_len ( dfield_t field,
ulint  len 
)

Sets length in a field.

Parameters
fieldin: field
lenin: length or UNIV_SQL_NULL
UNIV_INLINE void dfield_set_null ( dfield_t field)

Sets a data field to SQL NULL.

Parameters
fieldin/out: field
UNIV_INLINE void dfield_set_type ( dfield_t field,
const dtype_t type 
)

Sets the type struct of SQL data field.

Parameters
fieldin: SQL data field
typein: pointer to data type struct
UNIV_INLINE void dtuple_big_rec_free ( big_rec_t vector)

Frees the memory in a big rec vector.

Parameters
vectorin, own: big rec vector; it is freed in this function
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
Parameters
tuplein: dtuple
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
Parameters
tuplein: tuple to copy from
heapin: 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.

Returns
own: created tuple
Parameters
heapin: memory heap where the tuple is created, DTUPLE_EST_ALLOC(n_fields) bytes will be allocated from this heap
n_fieldsin: 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.

Returns
created tuple (inside buf)
Parameters
bufin, out: buffer to use
buf_sizein: buffer size
n_fieldsin: 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.

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
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. Neither is possible space in externally stored parts of the field.

Returns
sum of data lengths
Parameters
tuplein: typed data tuple
compin: nonzero=ROW_FORMAT=COMPACT
UNIV_INLINE ulint dtuple_get_info_bits ( const dtuple_t tuple)

Gets info bits in a data tuple.

Returns
info bits
Parameters
tuplein: tuple
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 externally stored fields
Parameters
tuplein: tuple
UNIV_INLINE ulint dtuple_get_n_fields ( const dtuple_t tuple)

Gets number of fields in a data tuple.

Returns
number of fields
Parameters
tuplein: tuple
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.*
Parameters
tuplein: tuple
UNIV_INLINE dfield_t* dtuple_get_nth_field ( const dtuple_t tuple,
ulint  n 
)

Gets nth field of a tuple.

Returns
nth field
Parameters
tuplein: tuple
nin: index of field
UNIV_INLINE void dtuple_set_info_bits ( dtuple_t tuple,
ulint  info_bits 
)

Sets info bits in a data tuple.

Parameters
tuplein: tuple
info_bitsin: info bits
UNIV_INLINE void dtuple_set_n_fields_cmp ( dtuple_t tuple,
ulint  n_fields_cmp 
)

Sets number of fields used in record comparisons.

Parameters
tuplein: tuple
n_fields_cmpin: 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.

Parameters
tuplein: data tuple
nin: number of fields to set

Variable Documentation

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.