~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/dict0crea.h

  • Committer: Brian Aker
  • Date: 2009-08-17 01:44:23 UTC
  • mto: This revision was merged to the branch mainline in revision 1118.
  • Revision ID: brian@gaz-20090817014423-jxi2qonsumm8mndf
Remove SQL level reference for DELAY (just now done correctly by default in
engine).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
4
 
 
5
 
This program is free software; you can redistribute it and/or modify it under
6
 
the terms of the GNU General Public License as published by the Free Software
7
 
Foundation; version 2 of the License.
8
 
 
9
 
This program is distributed in the hope that it will be useful, but WITHOUT
10
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
 
 
13
 
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file include/dict0crea.h
21
 
Database object creation
22
 
 
23
 
Created 1/8/1996 Heikki Tuuri
24
 
*******************************************************/
25
 
 
26
 
#ifndef dict0crea_h
27
 
#define dict0crea_h
28
 
 
29
 
#include "univ.i"
30
 
#include "dict0types.h"
31
 
#include "dict0dict.h"
32
 
#include "que0types.h"
33
 
#include "row0types.h"
34
 
#include "mtr0mtr.h"
35
 
 
36
 
/*********************************************************************//**
37
 
Creates a table create graph.
38
 
@return own: table create node */
39
 
UNIV_INTERN
40
 
tab_node_t*
41
 
tab_create_graph_create(
42
 
/*====================*/
43
 
        dict_table_t*   table,  /*!< in: table to create, built as a memory data
44
 
                                structure */
45
 
        mem_heap_t*     heap);  /*!< in: heap where created */
46
 
/*********************************************************************//**
47
 
Creates an index create graph.
48
 
@return own: index create node */
49
 
UNIV_INTERN
50
 
ind_node_t*
51
 
ind_create_graph_create(
52
 
/*====================*/
53
 
        dict_index_t*   index,  /*!< in: index to create, built as a memory data
54
 
                                structure */
55
 
        mem_heap_t*     heap);  /*!< in: heap where created */
56
 
/***********************************************************//**
57
 
Creates a table. This is a high-level function used in SQL execution graphs.
58
 
@return query thread to run next or NULL */
59
 
UNIV_INTERN
60
 
que_thr_t*
61
 
dict_create_table_step(
62
 
/*===================*/
63
 
        que_thr_t*      thr);   /*!< in: query thread */
64
 
/***********************************************************//**
65
 
Creates an index. This is a high-level function used in SQL execution
66
 
graphs.
67
 
@return query thread to run next or NULL */
68
 
UNIV_INTERN
69
 
que_thr_t*
70
 
dict_create_index_step(
71
 
/*===================*/
72
 
        que_thr_t*      thr);   /*!< in: query thread */
73
 
/*******************************************************************//**
74
 
Truncates the index tree associated with a row in SYS_INDEXES table.
75
 
@return new root page number, or FIL_NULL on failure */
76
 
UNIV_INTERN
77
 
ulint
78
 
dict_truncate_index_tree(
79
 
/*=====================*/
80
 
        dict_table_t*   table,  /*!< in: the table the index belongs to */
81
 
        ulint           space,  /*!< in: 0=truncate,
82
 
                                nonzero=create the index tree in the
83
 
                                given tablespace */
84
 
        btr_pcur_t*     pcur,   /*!< in/out: persistent cursor pointing to
85
 
                                record in the clustered index of
86
 
                                SYS_INDEXES table. The cursor may be
87
 
                                repositioned in this call. */
88
 
        mtr_t*          mtr);   /*!< in: mtr having the latch
89
 
                                on the record page. The mtr may be
90
 
                                committed and restarted in this call. */
91
 
/*******************************************************************//**
92
 
Drops the index tree associated with a row in SYS_INDEXES table. */
93
 
UNIV_INTERN
94
 
void
95
 
dict_drop_index_tree(
96
 
/*=================*/
97
 
        rec_t*  rec,    /*!< in/out: record in the clustered index
98
 
                        of SYS_INDEXES table */
99
 
        mtr_t*  mtr);   /*!< in: mtr having the latch on the record page */
100
 
/****************************************************************//**
101
 
Creates the foreign key constraints system tables inside InnoDB
102
 
at database creation or database start if they are not found or are
103
 
not of the right form.
104
 
@return DB_SUCCESS or error code */
105
 
UNIV_INTERN
106
 
ulint
107
 
dict_create_or_check_foreign_constraint_tables(void);
108
 
/*================================================*/
109
 
/********************************************************************//**
110
 
Adds foreign key definitions to data dictionary tables in the database. We
111
 
look at table->foreign_list, and also generate names to constraints that were
112
 
not named by the user. A generated constraint has a name of the format
113
 
databasename/tablename_ibfk_<number>, where the numbers start from 1, and are
114
 
given locally for this table, that is, the number is not global, as in the
115
 
old format constraints < 4.0.18 it used to be.
116
 
@return error code or DB_SUCCESS */
117
 
UNIV_INTERN
118
 
ulint
119
 
dict_create_add_foreigns_to_dictionary(
120
 
/*===================================*/
121
 
        ulint           start_id,/*!< in: if we are actually doing ALTER TABLE
122
 
                                ADD CONSTRAINT, we want to generate constraint
123
 
                                numbers which are bigger than in the table so
124
 
                                far; we number the constraints from
125
 
                                start_id + 1 up; start_id should be set to 0 if
126
 
                                we are creating a new table, or if the table
127
 
                                so far has no constraints for which the name
128
 
                                was generated here */
129
 
        dict_table_t*   table,  /*!< in: table */
130
 
        trx_t*          trx);   /*!< in: transaction */
131
 
 
132
 
/* Table create node structure */
133
 
 
134
 
struct tab_node_struct{
135
 
        que_common_t    common; /*!< node type: QUE_NODE_TABLE_CREATE */
136
 
        dict_table_t*   table;  /*!< table to create, built as a memory data
137
 
                                structure with dict_mem_... functions */
138
 
        ins_node_t*     tab_def; /* child node which does the insert of
139
 
                                the table definition; the row to be inserted
140
 
                                is built by the parent node  */
141
 
        ins_node_t*     col_def; /* child node which does the inserts of
142
 
                                the column definitions; the row to be inserted
143
 
                                is built by the parent node  */
144
 
        commit_node_t*  commit_node;
145
 
                                /* child node which performs a commit after
146
 
                                a successful table creation */
147
 
        /*----------------------*/
148
 
        /* Local storage for this graph node */
149
 
        ulint           state;  /*!< node execution state */
150
 
        ulint           col_no; /*!< next column definition to insert */
151
 
        mem_heap_t*     heap;   /*!< memory heap used as auxiliary storage */
152
 
};
153
 
 
154
 
/* Table create node states */
155
 
#define TABLE_BUILD_TABLE_DEF   1
156
 
#define TABLE_BUILD_COL_DEF     2
157
 
#define TABLE_COMMIT_WORK       3
158
 
#define TABLE_ADD_TO_CACHE      4
159
 
#define TABLE_COMPLETED         5
160
 
 
161
 
/* Index create node struct */
162
 
 
163
 
struct ind_node_struct{
164
 
        que_common_t    common; /*!< node type: QUE_NODE_INDEX_CREATE */
165
 
        dict_index_t*   index;  /*!< index to create, built as a memory data
166
 
                                structure with dict_mem_... functions */
167
 
        ins_node_t*     ind_def; /* child node which does the insert of
168
 
                                the index definition; the row to be inserted
169
 
                                is built by the parent node  */
170
 
        ins_node_t*     field_def; /* child node which does the inserts of
171
 
                                the field definitions; the row to be inserted
172
 
                                is built by the parent node  */
173
 
        commit_node_t*  commit_node;
174
 
                                /* child node which performs a commit after
175
 
                                a successful index creation */
176
 
        /*----------------------*/
177
 
        /* Local storage for this graph node */
178
 
        ulint           state;  /*!< node execution state */
179
 
        ulint           page_no;/* root page number of the index */
180
 
        dict_table_t*   table;  /*!< table which owns the index */
181
 
        dtuple_t*       ind_row;/* index definition row built */
182
 
        ulint           field_no;/* next field definition to insert */
183
 
        mem_heap_t*     heap;   /*!< memory heap used as auxiliary storage */
184
 
};
185
 
 
186
 
/* Index create node states */
187
 
#define INDEX_BUILD_INDEX_DEF   1
188
 
#define INDEX_BUILD_FIELD_DEF   2
189
 
#define INDEX_CREATE_INDEX_TREE 3
190
 
#define INDEX_COMMIT_WORK       4
191
 
#define INDEX_ADD_TO_CACHE      5
192
 
 
193
 
#ifndef UNIV_NONINL
194
 
#include "dict0crea.ic"
195
 
#endif
196
 
 
197
 
#endif