Drizzled Public API Documentation

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"

Go to the source code of this file.

Classes

struct  tab_node_struct
struct  ind_node_struct

Defines

#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)
UNIV_INTERN ind_node_tind_create_graph_create (dict_index_t *index, mem_heap_t *heap)
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 ulint dict_create_or_check_foreign_constraint_tables (void)
UNIV_INTERN ulint dict_create_add_foreigns_to_dictionary (ulint start_id, dict_table_t *table, trx_t *trx)

Detailed Description

Database object creation

Created 1/8/1996 Heikki Tuuri

Definition in file dict0crea.h.


Function Documentation

UNIV_INTERN ulint 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 in: transaction

Adds foreign key definitions to data dictionary tables in the database.

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

Definition at line 1488 of file dict0crea.cc.

References dict_table_get_low(), dict_table_struct::foreign_list, dict_sys_struct::mutex, ut_ad, UT_LIST_GET_FIRST, and UT_LIST_GET_NEXT.

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

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

Returns:
query thread to run next or NULL
Parameters:
thrin: query thread

Definition at line 1058 of file dict0crea.cc.

References dict_table_get_format(), DICT_TF_FORMAT_ZIP, trx_struct::error_state, FIL_NULL, dict_index_struct::id, ind_node_struct::index, dict_sys_struct::mutex, dict_index_struct::page, que_thr_struct::prev_node, que_node_get_parent(), que_node_get_type(), que_thr_struct::run_node, ind_node_struct::state, ind_node_struct::table, thr_get_trx(), trx_is_strict(), ut_a, and ut_ad.

UNIV_INTERN ulint dict_create_or_check_foreign_constraint_tables ( void  )

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

Returns:
DB_SUCCESS or error code

Definition at line 1193 of file dict0crea.cc.

References dict_table_get_low(), dict_table_struct::indexes, dict_sys_struct::mutex, trx_struct::op_info, pars_info_create(), que_eval_sql(), row_drop_table_for_mysql(), row_mysql_unlock_data_dictionary(), trx_allocate_for_mysql(), trx_commit_for_mysql(), trx_free_for_mysql(), ut_a, and UT_LIST_GET_LEN.

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

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

Returns:
query thread to run next or NULL
Parameters:
thrin: query thread

Definition at line 951 of file dict0crea.cc.

References tab_node_struct::col_no, trx_struct::error_state, tab_node_struct::heap, dict_sys_struct::mutex, que_thr_struct::prev_node, que_node_get_parent(), que_node_get_type(), que_thr_struct::run_node, tab_node_struct::state, tab_node_struct::table, thr_get_trx(), and ut_ad.

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

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

Parameters:
recin/out: record in the clustered index of SYS_INDEXES table
mtrin: mtr having the latch on the record page

Definition at line 680 of file dict0crea.cc.

References dict_table_is_comp(), FIL_NULL, MLOG_4BYTES, mtr_read_ulint(), dict_sys_struct::mutex, page_rec_write_index_page_no(), dict_sys_struct::sys_indexes, ut_a, and ut_ad.

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.

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

Returns:
new root page number, or FIL_NULL on failure
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.
mtrin: mtr having the latch on the record page. The mtr may be committed and restarted in this call.

Definition at line 744 of file dict0crea.cc.

References btr_block_get, BTR_MODIFY_LEAF, btr_pcur_get_rec(), dict_table_is_comp(), FIL_NULL, dict_index_struct::id, dict_table_struct::indexes, mach_read_from_4(), mach_read_from_8(), MLOG_4BYTES, mtr_commit(), mtr_read_ulint(), mtr_start(), dict_sys_struct::mutex, dict_table_struct::name, dict_index_struct::page, page_rec_write_index_page_no(), dict_sys_struct::sys_indexes, ut_a, ut_ad, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and ut_print_timestamp().

UNIV_INTERN ind_node_t* ind_create_graph_create ( dict_index_t index,
mem_heap_t heap 
)

Creates an index create graph.

Returns:
own: index create node in: heap where created

Creates an index create graph.

Returns:
own: index create node
Parameters:
indexin: index to create, built as a memory data structure
heapin: heap where created

Definition at line 914 of file dict0crea.cc.

References commit_node_create(), commit_node_struct::common, ins_node_struct::common, ind_node_struct::common, FIL_NULL, ind_node_struct::heap, ind_node_struct::index, ins_node_create(), mem_heap_alloc(), mem_heap_create, que_common_struct::parent, ind_node_struct::state, dict_sys_struct::sys_fields, dict_sys_struct::sys_indexes, and que_common_struct::type.

UNIV_INTERN tab_node_t* tab_create_graph_create ( dict_table_t table,
mem_heap_t heap 
)

Creates a table create graph.

Returns:
own: table create node in: heap where created

Creates a table create graph.

Returns:
own: table create node
Parameters:
tablein: table to create, built as a memory data structure
heapin: heap where created

Definition at line 878 of file dict0crea.cc.

References commit_node_create(), commit_node_struct::common, ins_node_struct::common, tab_node_struct::common, tab_node_struct::heap, ins_node_create(), mem_heap_alloc(), mem_heap_create, que_common_struct::parent, tab_node_struct::state, dict_sys_struct::sys_columns, dict_sys_struct::sys_tables, tab_node_struct::table, and que_common_struct::type.