drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
dict0mem.h File Reference
#include "univ.i"
#include "dict0types.h"
#include "data0type.h"
#include "mem0mem.h"
#include "rem0types.h"
#include "btr0types.h"
#include "lock0types.h"
#include "que0types.h"
#include "sync0rw.h"
#include "ut0mem.h"
#include "ut0lst.h"
#include "ut0rnd.h"
#include "ut0byte.h"
#include "hash0hash.h"
#include "trx0types.h"
Include dependency graph for dict0mem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dict_col_struct
struct  dict_field_struct
struct  dict_index_struct
struct  dict_foreign_struct
struct  dict_table_struct

Macros

#define dict0mem_h
#define DICT_CLUSTERED   1
#define DICT_UNIQUE   2
#define DICT_UNIVERSAL   4
#define DICT_IBUF   8
#define DICT_TABLE_ORDINARY   1
#define DICT_TF_COMPACT
#define DICT_TF_ZSSIZE_SHIFT   1
#define DICT_TF_ZSSIZE_MASK   (15 << DICT_TF_ZSSIZE_SHIFT)
#define DICT_TF_ZSSIZE_MAX   (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 1)
#define DICT_TF_FORMAT_SHIFT   5 /* file format */
#define DICT_TF_FORMAT_MASK   ((~(~0 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT)
#define DICT_TF_FORMAT_51   0
#define DICT_TF_FORMAT_ZIP   1
#define DICT_TF_FORMAT_MAX   DICT_TF_FORMAT_ZIP
#define DICT_TF_FORMAT_MIN   DICT_TF_FORMAT_51
#define DICT_TF_BITS   6
#define DICT_TF2_SHIFT   DICT_TF_BITS
 Additional table flags.
#define DICT_TF2_TEMPORARY   1
#define DICT_TF2_BITS   (DICT_TF2_SHIFT + 1)
#define DICT_FK_MAX_RECURSIVE_LOAD   255
#define FK_MAX_CASCADE_DEL   255
#define DICT_MAX_INDEX_COL_LEN   REC_MAX_INDEX_COL_LEN
 DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum indexed column length (or indexed prefix length).
#define DICT_FOREIGN_ON_DELETE_CASCADE   1
#define DICT_FOREIGN_ON_DELETE_SET_NULL   2
#define DICT_FOREIGN_ON_UPDATE_CASCADE   4
#define DICT_FOREIGN_ON_UPDATE_SET_NULL   8
#define DICT_FOREIGN_ON_DELETE_NO_ACTION   16
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION   32

Functions

UNIV_INTERN dict_table_t * dict_mem_table_create (const char *name, ulint space, ulint n_cols, ulint flags)
UNIV_INTERN void dict_mem_table_free (dict_table_t *table)
UNIV_INTERN void dict_mem_table_add_col (dict_table_t *table, mem_heap_t *heap, const char *name, ulint mtype, ulint prtype, ulint len)
UNIV_INTERN void dict_mem_fill_column_struct (dict_col_t *column, ulint col_pos, ulint mtype, ulint prtype, ulint col_len)
UNIV_INLINE void dict_mem_fill_index_struct (dict_index_t *index, mem_heap_t *heap, const char *table_name, const char *index_name, ulint space, ulint type, ulint n_fields)
UNIV_INTERN dict_index_t * dict_mem_index_create (const char *table_name, const char *index_name, ulint space, ulint type, ulint n_fields)
UNIV_INTERN void dict_mem_index_add_field (dict_index_t *index, const char *name, ulint prefix_len)
UNIV_INTERN void dict_mem_index_free (dict_index_t *index)
UNIV_INTERN dict_foreign_t * dict_mem_foreign_create (void)
UNIV_INTERN void dict_mem_foreign_table_name_lookup_set (dict_foreign_t *foreign, ibool do_alloc)
UNIV_INTERN void dict_mem_referenced_table_name_lookup_set (dict_foreign_t *foreign, ibool do_alloc)

Detailed Description

Data dictionary memory object creation

Created 1/8/1996 Heikki Tuuri

Definition in file dict0mem.h.

Macro Definition Documentation

◆ dict0mem_h

#define dict0mem_h

Definition at line 28 of file dict0mem.h.

◆ DICT_CLUSTERED

#define DICT_CLUSTERED   1

Type flags of an index: OR'ing of the flags is allowed to define a combination of types clustered index

Definition at line 51 of file dict0mem.h.

◆ DICT_FK_MAX_RECURSIVE_LOAD

#define DICT_FK_MAX_RECURSIVE_LOAD   255

Tables could be chained together with Foreign key constraint. When first load the parent table, we would load all of its descedents. This could result in rescursive calls and out of stack error eventually. DICT_FK_MAX_RECURSIVE_LOAD defines the maximum number of recursive loads, when exceeded, the child table will not be loaded. It will be loaded when the foreign constraint check needs to be run.

Definition at line 122 of file dict0mem.h.

◆ DICT_FOREIGN_ON_DELETE_CASCADE

#define DICT_FOREIGN_ON_DELETE_CASCADE   1

The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that a foreign key constraint is enforced, therefore RESTRICT just means no flag ON DELETE CASCADE

Definition at line 457 of file dict0mem.h.

◆ DICT_FOREIGN_ON_DELETE_NO_ACTION

#define DICT_FOREIGN_ON_DELETE_NO_ACTION   16

ON DELETE NO ACTION

Definition at line 461 of file dict0mem.h.

◆ DICT_FOREIGN_ON_DELETE_SET_NULL

#define DICT_FOREIGN_ON_DELETE_SET_NULL   2

ON UPDATE SET NULL

Definition at line 458 of file dict0mem.h.

◆ DICT_FOREIGN_ON_UPDATE_CASCADE

#define DICT_FOREIGN_ON_UPDATE_CASCADE   4

ON DELETE CASCADE

Definition at line 459 of file dict0mem.h.

◆ DICT_FOREIGN_ON_UPDATE_NO_ACTION

#define DICT_FOREIGN_ON_UPDATE_NO_ACTION   32

ON UPDATE NO ACTION

Definition at line 462 of file dict0mem.h.

◆ DICT_FOREIGN_ON_UPDATE_SET_NULL

#define DICT_FOREIGN_ON_UPDATE_SET_NULL   8

ON UPDATE SET NULL

Definition at line 460 of file dict0mem.h.

◆ DICT_IBUF

#define DICT_IBUF   8

insert buffer tree

Definition at line 55 of file dict0mem.h.

◆ DICT_MAX_INDEX_COL_LEN

#define DICT_MAX_INDEX_COL_LEN   REC_MAX_INDEX_COL_LEN

DICT_MAX_INDEX_COL_LEN is measured in bytes and is the maximum indexed column length (or indexed prefix length).

It is set to 3*256, so that one can create a column prefix index on 256 characters of a TEXT or VARCHAR column also in the UTF-8 charset. In that charset, a character may take at most 3 bytes. This constant MUST NOT BE CHANGED, or the compatibility of InnoDB data files would be at risk!

Definition at line 308 of file dict0mem.h.

◆ DICT_TABLE_ORDINARY

#define DICT_TABLE_ORDINARY   1

Types for a table object ordinary table

Definition at line 59 of file dict0mem.h.

◆ DICT_TF2_BITS

#define DICT_TF2_BITS   (DICT_TF2_SHIFT + 1)

Total number of bits in table->flags.

Definition at line 111 of file dict0mem.h.

◆ DICT_TF2_SHIFT

#define DICT_TF2_SHIFT   DICT_TF_BITS

Additional table flags.

These flags will be stored in SYS_TABLES.MIX_LEN. All unused flags will be written as 0. The column may contain garbage for tables created with old versions of InnoDB that only implemented ROW_FORMAT=REDUNDANT. Shift value for table->flags.

Definition at line 106 of file dict0mem.h.

◆ DICT_TF2_TEMPORARY

#define DICT_TF2_TEMPORARY   1

TRUE for tables from CREATE TEMPORARY TABLE.

Definition at line 109 of file dict0mem.h.

◆ DICT_TF_BITS

#define DICT_TF_BITS   6

number of flag bits

Definition at line 93 of file dict0mem.h.

◆ DICT_TF_COMPACT

#define DICT_TF_COMPACT
Value:
1 /* Compact page format.
This must be set for
new file formats
(later than
DICT_TF_FORMAT_51). */

Table flags. All unused bits must be 0.

Definition at line 68 of file dict0mem.h.

◆ DICT_TF_FORMAT_51

#define DICT_TF_FORMAT_51   0

InnoDB/MySQL up to 5.1

Definition at line 82 of file dict0mem.h.

◆ DICT_TF_FORMAT_MASK

#define DICT_TF_FORMAT_MASK   ((~(~0 << (DICT_TF_BITS - DICT_TF_FORMAT_SHIFT))) << DICT_TF_FORMAT_SHIFT)

Definition at line 80 of file dict0mem.h.

◆ DICT_TF_FORMAT_MAX

#define DICT_TF_FORMAT_MAX   DICT_TF_FORMAT_ZIP

Maximum supported file format

Definition at line 87 of file dict0mem.h.

◆ DICT_TF_FORMAT_MIN

#define DICT_TF_FORMAT_MIN   DICT_TF_FORMAT_51

Minimum supported file format

Definition at line 90 of file dict0mem.h.

◆ DICT_TF_FORMAT_SHIFT

#define DICT_TF_FORMAT_SHIFT   5 /* file format */

File format

Definition at line 79 of file dict0mem.h.

◆ DICT_TF_FORMAT_ZIP

#define DICT_TF_FORMAT_ZIP   1

InnoDB plugin for 5.1: compressed tables, new BLOB treatment

Definition at line 83 of file dict0mem.h.

◆ DICT_TF_ZSSIZE_MASK

#define DICT_TF_ZSSIZE_MASK   (15 << DICT_TF_ZSSIZE_SHIFT)

Definition at line 73 of file dict0mem.h.

◆ DICT_TF_ZSSIZE_MAX

#define DICT_TF_ZSSIZE_MAX   (UNIV_PAGE_SIZE_SHIFT - PAGE_ZIP_MIN_SIZE_SHIFT + 1)

Definition at line 74 of file dict0mem.h.

◆ DICT_TF_ZSSIZE_SHIFT

#define DICT_TF_ZSSIZE_SHIFT   1

Compressed page size (0=uncompressed, up to 15 compressed sizes)

Definition at line 72 of file dict0mem.h.

◆ DICT_UNIQUE

#define DICT_UNIQUE   2

unique index

Definition at line 52 of file dict0mem.h.

◆ DICT_UNIVERSAL

#define DICT_UNIVERSAL   4

index which can contain records from any other index

Definition at line 53 of file dict0mem.h.

◆ FK_MAX_CASCADE_DEL

#define FK_MAX_CASCADE_DEL   255

Similarly, when tables are chained together with foreign key constraints with on cascading delete/update clause, delete from parent table could result in recursive cascading calls. This defines the maximum number of such cascading deletes/updates allowed. When exceeded, the delete from parent table will fail, and user has to drop excessive foreign constraint before proceeds.

Definition at line 130 of file dict0mem.h.

Function Documentation

◆ dict_mem_fill_column_struct()

UNIV_INTERN void dict_mem_fill_column_struct ( dict_col_t * column,
ulint col_pos,
ulint mtype,
ulint prtype,
ulint col_len )

This function populates a dict_col_t memory structure with supplied information. in: column length

This function populates a dict_col_t memory structure with supplied information.

Parameters
columnout: column struct to be filled
col_posin: column position
mtypein: main data type
prtypein: precise type
col_lenin: column length

Definition at line 220 of file dict0mem.cc.

◆ dict_mem_fill_index_struct()

UNIV_INLINE void dict_mem_fill_index_struct ( dict_index_t * index,
mem_heap_t * heap,
const char * table_name,
const char * index_name,
ulint space,
ulint type,
ulint n_fields )

This function poplulates a dict_index_t index memory structure with supplied information. in: number of fields

Parameters
indexout: index to be filled
heapin: memory heap
table_namein: table name
index_namein: index name
spacein: space where the index tree is placed, ignored if the index is of the clustered type
typein: DICT_UNIQUE, DICT_CLUSTERED, ... ORed

◆ dict_mem_foreign_create()

UNIV_INTERN dict_foreign_t * dict_mem_foreign_create ( void )

Creates and initializes a foreign constraint memory object.

Returns
own: foreign constraint struct

Definition at line 280 of file dict0mem.cc.

◆ dict_mem_foreign_table_name_lookup_set()

UNIV_INTERN void dict_mem_foreign_table_name_lookup_set ( dict_foreign_t * foreign,
ibool do_alloc )

Sets the foreign_table_name_lookup pointer based on the value of srv_lower_case_table_names. in: is an alloc needed

Sets the foreign_table_name_lookup pointer based on the value of srv_lower_case_table_names. If that is 0 or 1, foreign_table_name_lookup will point to foreign_table_name. If 2, then another string is allocated of the heap and set to lower case.

Parameters
foreignin/out: foreign struct
do_allocin: is an alloc needed

Definition at line 302 of file dict0mem.cc.

◆ dict_mem_index_add_field()

UNIV_INTERN void dict_mem_index_add_field ( dict_index_t * index,
const char * name,
ulint prefix_len )

Adds a field definition to an index. NOTE: does not take a copy of the column name if the field is a column. The memory occupied by the column name may be released only after publishing the index. in: 0 or the column prefix length in a MySQL index like INDEX (textcol(25))

Adds a field definition to an index. NOTE: does not take a copy of the column name if the field is a column. The memory occupied by the column name may be released only after publishing the index.

Parameters
indexin: index
namein: column name
prefix_lenin: 0 or the column prefix length in a MySQL index like INDEX (textcol(25))

Definition at line 355 of file dict0mem.cc.

◆ dict_mem_index_create()

UNIV_INTERN dict_index_t * dict_mem_index_create ( const char * table_name,
const char * index_name,
ulint space,
ulint type,
ulint n_fields )

Creates an index memory object.

Returns
own: index object in: number of fields

Creates an index memory object.

Returns
own: index object
Parameters
table_namein: table name
index_namein: index name
spacein: space where the index tree is placed, ignored if the index is of the clustered type
typein: DICT_UNIQUE, DICT_CLUSTERED, ... ORed
n_fieldsin: number of fields

Definition at line 250 of file dict0mem.cc.

◆ dict_mem_index_free()

UNIV_INTERN void dict_mem_index_free ( dict_index_t * index)

Frees an index memory object. in: index

Frees an index memory object.

Parameters
indexin: index

Definition at line 380 of file dict0mem.cc.

◆ dict_mem_referenced_table_name_lookup_set()

UNIV_INTERN void dict_mem_referenced_table_name_lookup_set ( dict_foreign_t * foreign,
ibool do_alloc )

Sets the reference_table_name_lookup pointer based on the value of srv_lower_case_table_names. in: is an alloc needed

Sets the referenced_table_name_lookup pointer based on the value of srv_lower_case_table_names. If that is 0 or 1, referenced_table_name_lookup will point to referenced_table_name. If 2, then another string is allocated of the heap and set to lower case.

Parameters
foreignin/out: foreign struct
do_allocin: is an alloc needed

Definition at line 329 of file dict0mem.cc.

◆ dict_mem_table_add_col()

UNIV_INTERN void dict_mem_table_add_col ( dict_table_t * table,
mem_heap_t * heap,
const char * name,
ulint mtype,
ulint prtype,
ulint len )

Adds a column definition to a table. in: precision

Adds a column definition to a table.

Parameters
tablein: table
heapin: temporary memory heap, or NULL
namein: column name, or NULL
mtypein: main datatype
prtypein: precise type
lenin: precision

Definition at line 177 of file dict0mem.cc.

◆ dict_mem_table_create()

UNIV_INTERN dict_table_t * dict_mem_table_create ( const char * name,
ulint space,
ulint n_cols,
ulint flags )

Creates a table memory object.

Returns
own: table object in: table flags

Creates a table memory object.

Returns
own: table object
Parameters
namein: table name
spacein: space where the clustered index of the table is placed; this parameter is ignored if the table is made a member of a cluster
n_colsin: number of columns
flagsin: table flags

Definition at line 58 of file dict0mem.cc.

◆ dict_mem_table_free()

UNIV_INTERN void dict_mem_table_free ( dict_table_t * table)

Free a table memory object. in: table

Free a table memory object.

Parameters
tablein: table

Definition at line 110 of file dict0mem.cc.