1
/******************************************************
2
Database object creation
6
Created 1/8/1996 Heikki Tuuri
7
*******************************************************/
13
#include "dict0types.h"
14
#include "dict0dict.h"
15
#include "que0types.h"
16
#include "row0types.h"
19
/*************************************************************************
20
Creates the default clustered index for a table: the records are ordered
24
dict_create_default_index(
25
/*======================*/
26
dict_table_t* table, /* in: table */
27
trx_t* trx); /* in: transaction handle */
28
/*************************************************************************
29
Creates a table create graph. */
32
tab_create_graph_create(
33
/*====================*/
34
/* out, own: table create node */
35
dict_table_t* table, /* in: table to create, built as a memory data
37
mem_heap_t* heap); /* in: heap where created */
38
/*************************************************************************
39
Creates an index create graph. */
42
ind_create_graph_create(
43
/*====================*/
44
/* out, own: index create node */
45
dict_index_t* index, /* in: index to create, built as a memory data
47
mem_heap_t* heap); /* in: heap where created */
48
/***************************************************************
49
Creates a table. This is a high-level function used in SQL execution graphs. */
52
dict_create_table_step(
53
/*===================*/
54
/* out: query thread to run next or NULL */
55
que_thr_t* thr); /* in: query thread */
56
/***************************************************************
57
Creates an index. This is a high-level function used in SQL execution
61
dict_create_index_step(
62
/*===================*/
63
/* out: query thread to run next or NULL */
64
que_thr_t* thr); /* in: query thread */
65
/***********************************************************************
66
Drops the index tree associated with a row in SYS_INDEXES table. */
71
rec_t* rec, /* in: record in the clustered index of SYS_INDEXES
73
mtr_t* mtr); /* in: mtr having the latch on the record page */
76
/* Table create node structure */
78
struct tab_node_struct{
79
que_common_t common; /* node type: QUE_NODE_TABLE_CREATE */
80
dict_table_t* table; /* table to create, built as a memory data
81
structure with dict_mem_... functions */
82
ins_node_t* tab_def; /* child node which does the insert of
83
the table definition; the row to be inserted
84
is built by the parent node */
85
ins_node_t* col_def; /* child node which does the inserts of
86
the column definitions; the row to be inserted
87
is built by the parent node */
88
commit_node_t* commit_node;
89
/* child node which performs a commit after
90
a successful table creation */
91
/*----------------------*/
92
/* Local storage for this graph node */
93
ulint state; /* node execution state */
94
ulint col_no; /* next column definition to insert */
95
mem_heap_t* heap; /* memory heap used as auxiliary storage */
98
/* Table create node states */
99
#define TABLE_BUILD_TABLE_DEF 1
100
#define TABLE_BUILD_COL_DEF 2
101
#define TABLE_COMMIT_WORK 3
102
#define TABLE_ADD_TO_CACHE 4
103
#define TABLE_COMPLETED 5
105
/* Index create node struct */
107
struct ind_node_struct{
108
que_common_t common; /* node type: QUE_NODE_INDEX_CREATE */
109
dict_index_t* index; /* index to create, built as a memory data
110
structure with dict_mem_... functions */
111
ins_node_t* ind_def; /* child node which does the insert of
112
the index definition; the row to be inserted
113
is built by the parent node */
114
ins_node_t* field_def; /* child node which does the inserts of
115
the field definitions; the row to be inserted
116
is built by the parent node */
117
commit_node_t* commit_node;
118
/* child node which performs a commit after
119
a successful index creation */
120
/*----------------------*/
121
/* Local storage for this graph node */
122
ulint state; /* node execution state */
123
dict_table_t* table; /* table which owns the index */
124
dtuple_t* ind_row;/* index definition row built */
125
ulint field_no;/* next field definition to insert */
126
mem_heap_t* heap; /* memory heap used as auxiliary storage */
129
/* Index create node states */
130
#define INDEX_BUILD_INDEX_DEF 1
131
#define INDEX_BUILD_FIELD_DEF 2
132
#define INDEX_CREATE_INDEX_TREE 3
133
#define INDEX_COMMIT_WORK 4
134
#define INDEX_ADD_TO_CACHE 5
137
#include "dict0crea.ic"