Drizzled Public API Documentation

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"

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_TABLE_ORDINARY   1
#define DICT_TF_BITS   6
#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_CLUSTERED   1
#define DICT_UNIQUE   2
#define DICT_UNIVERSAL   4
#define DICT_IBUF   8
#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_TF2_SHIFT   DICT_TF_BITS
 Additional table flags.
#define DICT_TF2_TEMPORARY   1
#define DICT_TF2_BITS   (DICT_TF2_SHIFT + 1)
#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_tdict_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_tdict_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_tdict_mem_foreign_create (void)

Detailed Description

Data dictionary memory object creation

Created 1/8/1996 Heikki Tuuri

Definition in file dict0mem.h.

Macro Definition Documentation

#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.

Referenced by btr_create(), create_clustered_index_when_no_primary(), create_index(), dict_boot(), ibuf_init_at_db_start(), mlog_parse_index(), and pars_create_index().

#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.

Referenced by convert_error_code_to_mysql(), and row_mysql_handle_errors().

#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 418 of file dict0mem.h.

Referenced by dict_print_info_on_foreign_key_in_create_format(), dict_print_info_on_foreign_keys(), and ha_innobase::get_foreign_key_list().

#define DICT_FOREIGN_ON_DELETE_NO_ACTION   16
#define DICT_FOREIGN_ON_DELETE_SET_NULL   2
#define DICT_FOREIGN_ON_UPDATE_CASCADE   4
#define DICT_FOREIGN_ON_UPDATE_NO_ACTION   32
#define DICT_FOREIGN_ON_UPDATE_SET_NULL   8
#define DICT_IBUF   8

insert buffer tree

Definition at line 55 of file dict0mem.h.

Referenced by btr_create(), and ibuf_init_at_db_start().

#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 288 of file dict0mem.h.

Referenced by dict_index_add_col(), dtuple_convert_back_big_rec(), dtuple_convert_big_rec(), and row_create_index_for_mysql().

#define DICT_TABLE_ORDINARY   1

Types for a table object ordinary table

Definition at line 59 of file dict0mem.h.

#define DICT_TF2_BITS   (DICT_TF2_SHIFT + 1)

Total number of bits in table->flags.

Definition at line 111 of file dict0mem.h.

Referenced by dict_load_table_low(), and dict_mem_table_create().

#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.

Referenced by dict_load_table(), dict_load_table_low(), InnobaseEngine::doCreateTable(), and row_drop_table_for_mysql().

#define DICT_TF2_TEMPORARY   1

TRUE for tables from CREATE TEMPORARY TABLE.

Definition at line 109 of file dict0mem.h.

Referenced by dict_check_tablespaces_and_store_max_id(), dict_load_table(), InnobaseEngine::doCreateTable(), row_drop_table_for_mysql(), and row_mysql_drop_temp_tables().

#define DICT_TF_BITS   6
#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.

Referenced by convert_error_code_to_mysql(), dict_ind_init(), dict_load_table(), dict_load_table_low(), InnobaseEngine::doCreateTable(), fil_create_new_single_table_tablespace(), fil_open_single_table_tablespace(), fil_space_create(), mlog_parse_index(), and row_import_tablespace_for_mysql().

#define DICT_TF_FORMAT_51   0

InnoDB/MySQL up to 5.1

Definition at line 82 of file dict0mem.h.

Referenced by dict_index_add_to_cache().

#define DICT_TF_FORMAT_MIN   DICT_TF_FORMAT_51

Minimum supported file format

Definition at line 90 of file dict0mem.h.

Referenced by innobase_init(), trx_sys_file_format_init(), trx_sys_file_format_max_check(), and trx_sys_file_format_tag_init().

#define DICT_TF_FORMAT_SHIFT   5 /* file format */

File format

Definition at line 79 of file dict0mem.h.

Referenced by InnobaseEngine::doCreateTable().

#define DICT_TF_FORMAT_ZIP   1
#define DICT_TF_ZSSIZE_SHIFT   1

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

Definition at line 72 of file dict0mem.h.

Referenced by InnobaseEngine::doCreateTable(), and fil_create_new_single_table_tablespace().

#define DICT_UNIQUE   2

unique index

Definition at line 52 of file dict0mem.h.

Referenced by create_index(), dict_boot(), and pars_create_index().

#define DICT_UNIVERSAL   4
#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.

Referenced by row_update_cascade_for_mysql().

Function Documentation

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 215 of file dict0mem.cc.

References dict_col_set_mbminmaxlen(), dtype_get_mblen(), dict_col_struct::ind, dict_col_struct::len, dict_col_struct::mtype, dict_col_struct::ord_part, and dict_col_struct::prtype.

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

Referenced by dict_load_index_low(), and dict_mem_index_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 275 of file dict0mem.cc.

References dict_foreign_struct::heap, mem_heap_create, and mem_heap_zalloc().

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 296 of file dict0mem.cc.

References dict_index_struct::n_def, dict_field_struct::name, dict_field_struct::prefix_len, and ut_ad.

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 245 of file dict0mem.cc.

References dict_mem_fill_index_struct(), mem_heap_create, mem_heap_zalloc(), and ut_ad.

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 321 of file dict0mem.cc.

References dict_index_struct::heap, mem_heap_free, and ut_ad.

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 172 of file dict0mem.cc.

References dict_table_struct::col_names, dict_table_struct::heap, mem_heap_zalloc(), dict_table_struct::n_cols, dict_table_struct::n_def, and ut_ad.

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 53 of file dict0mem.cc.

References dict_table_struct::autoinc, dict_table_struct::autoinc_lock, dict_table_struct::autoinc_mutex, dict_table_struct::cols, DICT_TF2_BITS, dict_table_struct::flags, dict_table_struct::heap, lock_get_size(), mem_heap_alloc(), mem_heap_create, mem_heap_zalloc(), dict_table_struct::n_cols, dict_table_struct::n_waiting_or_granted_auto_inc_locks, dict_table_struct::name, dict_table_struct::space, ut_a, ut_ad, ut_d, and ut_malloc().

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 105 of file dict0mem.cc.

References dict_table_struct::autoinc_mutex, dict_table_struct::cached, dict_table_struct::heap, mem_heap_free, dict_table_struct::name, ut_ad, ut_d, and ut_free().