~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-12-18 18:24:57 UTC
  • mfrom: (1999.6.3 trunk)
  • Revision ID: brian@tangent.org-20101218182457-yi1wd0so2hml1k1w
Merge in Lee's copyright header fix

Show diffs side-by-side

added added

removed removed

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