MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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) __attribute__((nonnull))
UNIV_INTERN dberr_t dict_create_add_foreigns_to_dictionary (ulint start_id, dict_table_t *table, trx_t *trx) __attribute__((nonnull
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) __attribute__((nonnull

Variables

UNIV_INTERN dberr_t warn_unused_result

Detailed Description

Database object creation

Created 1/8/1996 Heikki Tuuri

Definition in file dict0crea.h.

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 ( ulint  start_id,
dict_table_t table,
trx_t trx 
)

Adds foreign key definitions to data dictionary tables in the database. We look at table->foreign_list, and also generate names to constraints that were not named by the user. A generated constraint has a name of the format databasename/tablename_ibfk_NUMBER, where the numbers start from 1, and are given locally for this table, that is, the number is not global, as in the old format constraints < 4.0.18 it used to be.

Returns
error code or DB_SUCCESS
Parameters
start_idin: if we are actually doing ALTER TABLE ADD CONSTRAINT, we want to generate constraint numbers which are bigger than in the table so far; we number the constraints from start_id + 1 up; start_id should be set to 0 if we are creating a new table, or if the table so far has no constraints for which the name was generated here
tablein: table
trxin: transaction
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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

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

Here is the caller graph for this function:

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

Here is the caller graph for this function: