InnoDB Plugin  1.0
Data Structures | Macros | Functions
dict0crea.h File Reference
#include "univ.i"
#include "dict0types.h"
#include "dict0dict.h"
#include "que0types.h"
#include "row0types.h"
#include "mtr0mtr.h"
#include "dict0crea.ic"
Include dependency graph for dict0crea.h:

Go to the source code of this file.

Data Structures

struct  tab_node_t
struct  ind_node_t

Macros

#define TABLE_BUILD_TABLE_DEF   1
#define TABLE_BUILD_COL_DEF   2
#define TABLE_COMMIT_WORK   3
#define TABLE_ADD_TO_CACHE   4
#define TABLE_COMPLETED   5
#define INDEX_BUILD_INDEX_DEF   1
#define INDEX_BUILD_FIELD_DEF   2
#define INDEX_CREATE_INDEX_TREE   3
#define INDEX_COMMIT_WORK   4
#define INDEX_ADD_TO_CACHE   5

Functions

UNIV_INTERN tab_node_ttab_create_graph_create (dict_table_t *table, mem_heap_t *heap, bool commit)
UNIV_INTERN ind_node_tind_create_graph_create (dict_index_t *index, mem_heap_t *heap, bool commit)
UNIV_INTERN que_thr_tdict_create_table_step (que_thr_t *thr)
UNIV_INTERN que_thr_tdict_create_index_step (que_thr_t *thr)
UNIV_INTERN ulint dict_truncate_index_tree (dict_table_t *table, ulint space, btr_pcur_t *pcur, mtr_t *mtr)
UNIV_INTERN void dict_drop_index_tree (rec_t *rec, mtr_t *mtr)
UNIV_INTERN dberr_t dict_create_or_check_foreign_constraint_tables (void)
UNIV_INLINE dberr_t dict_create_add_foreign_id (ulint *id_nr, const char *name, dict_foreign_t *foreign))
UNIV_INTERN dberr_t dict_create_add_foreigns_to_dictionary (const dict_foreign_set &local_fk_set, const dict_table_t *table, trx_t *trx))
UNIV_INTERN dberr_t dict_create_or_check_sys_tablespace (void)
UNIV_INTERN dberr_t dict_create_add_tablespace_to_dictionary (ulint space, const char *name, ulint flags, const char *path, trx_t *trx, bool commit)
UNIV_INTERN dberr_t dict_create_add_foreign_to_dictionary (const char *name, const dict_foreign_t *foreign, trx_t *trx))

Detailed Description

Database object creation

Created 1/8/1996 Heikki Tuuri

Function Documentation

UNIV_INLINE dberr_t dict_create_add_foreign_id ( ulint *  id_nr,
const char *  name,
dict_foreign_t foreign 
)

Generate a foreign key constraint name when it was not named by the user. A generated constraint has a name of the format dbname/tablename_ibfk_NUMBER, where the numbers start from 1, and are given locally for this table, that is, the number is not global, as it used to be before MySQL 4.0.18.

Parameters
id_nrin/out: number to use in id generation; incremented if used
namein: table name
foreignin/out: foreign key
UNIV_INTERN dberr_t dict_create_add_foreign_to_dictionary ( const char *  name,
const dict_foreign_t foreign,
trx_t trx 
)

Add a foreign key definition to the data dictionary tables.

Returns
error code or DB_SUCCESS
Parameters
namein: table name
foreignin: foreign key
trxin/out: dictionary transaction
UNIV_INTERN dberr_t dict_create_add_foreigns_to_dictionary ( const dict_foreign_set &  local_fk_set,
const dict_table_t table,
trx_t trx 
)
Adds the given set of foreign key objects to the dictionary tables

in the database. This function does not modify the dictionary cache. The caller must ensure that all foreign key objects contain a valid constraint name in foreign->id.

Parameters
[in]local_fk_setset of foreign key objects, to be added to the dictionary tables
[in]tabletable to which the foreign key objects in local_fk_set belong to
[in,out]trxtransaction
Returns
error code or DB_SUCCESS
UNIV_INTERN dberr_t dict_create_add_tablespace_to_dictionary ( ulint  space,
const char *  name,
ulint  flags,
const char *  path,
trx_t trx,
bool  commit 
)

Add a single tablespace definition to the data dictionary tables in the database.

Returns
error code or DB_SUCCESS in: if true then commit the transaction
Parameters
spacein: tablespace id
namein: tablespace name
flagsin: tablespace flags
pathin: tablespace path
trxin: transaction
UNIV_INTERN que_thr_t* dict_create_index_step ( que_thr_t thr)

Creates an index. This is a high-level function used in SQL execution graphs.

Returns
query thread to run next or NULL in: query thread
UNIV_INTERN dberr_t dict_create_or_check_foreign_constraint_tables ( void  )

Creates the foreign key constraints system tables inside InnoDB at server bootstrap or server start if they are not found or are not of the right form.

Returns
DB_SUCCESS or error code
UNIV_INTERN dberr_t dict_create_or_check_sys_tablespace ( void  )

Creates the tablespaces and datafiles system tables inside InnoDB at server bootstrap or server start if they are not found or are not of the right form.

Returns
DB_SUCCESS or error code
UNIV_INTERN que_thr_t* dict_create_table_step ( que_thr_t thr)

Creates a table. This is a high-level function used in SQL execution graphs.

Returns
query thread to run next or NULL in: query thread
UNIV_INTERN void dict_drop_index_tree ( rec_t *  rec,
mtr_t mtr 
)

Drops the index tree associated with a row in SYS_INDEXES table. in: mtr having the latch on the record page

Parameters
recin/out: record in the clustered index of SYS_INDEXES table
UNIV_INTERN ulint dict_truncate_index_tree ( dict_table_t table,
ulint  space,
btr_pcur_t pcur,
mtr_t mtr 
)

Truncates the index tree associated with a row in SYS_INDEXES table.

Returns
new root page number, or FIL_NULL on failure in: mtr having the latch on the record page. The mtr may be committed and restarted in this call.
Parameters
tablein: the table the index belongs to
spacein: 0=truncate, nonzero=create the index tree in the given tablespace
pcurin/out: persistent cursor pointing to record in the clustered index of SYS_INDEXES table. The cursor may be repositioned in this call.
UNIV_INTERN ind_node_t* ind_create_graph_create ( dict_index_t index,
mem_heap_t heap,
bool  commit 
)

Creates an index create graph.

Returns
own: index create node in: true if the commit node should be added to the query graph
Parameters
indexin: index to create, built as a memory data structure
heapin: heap where created
UNIV_INTERN tab_node_t* tab_create_graph_create ( dict_table_t table,
mem_heap_t heap,
bool  commit 
)

Creates a table create graph.

Returns
own: table create node in: true if the commit node should be added to the query graph
Parameters
tablein: table to create, built as a memory data structure
heapin: heap where created