Debian Codegraph @

storage/innobase/include/dict0crea.h

raw symbols SCIP
1 /*****************************************************************************
2
3 Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
4 Copyright (c) 2017, 2021, MariaDB Corporation.
5
6 This program is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free Software
8 Foundation; version 2 of the License.
9
10 This program is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License along with
15 this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
17
18 *****************************************************************************/
19
20 /**************************************************//**
21 @file include/dict0crea.h
22 Database object creation
23
24 Created 1/8/1996 Heikki Tuuri
25 *******************************************************/
26
27 #ifndef dict0crea_h
28 #define dict0crea_hcxx . . $ `storage/innobase/include/dict0crea.h:28:9`!
29
30 #include "dict0dict.h"cxx . . $ `<file>/storage/innobase/include/dict0dict.h`/
31 #include "que0types.h"cxx . . $ `<file>/storage/innobase/include/que0types.h`/
32 #include "row0types.h"cxx . . $ `<file>/storage/innobase/include/row0types.h`/
33 #include "mtr0mtr.h"cxx . . $ `<file>/storage/innobase/include/mtr0mtr.h`/
34 #include "fil0crypt.h"cxx . . $ `<file>/storage/innobase/include/fil0crypt.h`/
35
36 /*********************************************************************//**
37 Creates a table create graph.
38 @return own: table create node */
39 tab_node_tcxx . . $ tab_node_t#*
40 tab_create_graph_createcxx . . $ tab_create_graph_create(51e7eccadda805aa).(
41 /*====================*/
42 dict_table_tcxx . . $ dict_table_t#* table, /*!< in: table to create, built as
43 a memory data structure */
44 mem_heap_tcxx . . $ mem_heap_t#* heap); /*!< in: heap where created */
45
46 /** Creates an index create graph.
47 @param[in] index index to create, built as a memory data structure
48 @param[in] table table name
49 @param[in,out] heap heap where created
50 @param[in] mode encryption mode (for creating a table)
51 @param[in] key_id encryption key identifier (for creating a table)
52 @param[in] add_v new virtual columns added in the same clause with
53 add index
54 @return own: index create node */
55 ind_node_tcxx . . $ ind_node_t#*
56 ind_create_graph_createcxx . . $ ind_create_graph_create(80ce9ceaea2fe0b3).(
57 dict_index_tcxx . . $ dict_index_t#* index,
58 const char* table,
59 mem_heap_tcxx . . $ mem_heap_t#* heap,
60 fil_encryption_tcxx . . $ fil_encryption_t# mode,
61 uint32_tcxx . . $ uint32_t# key_id,
62 const dict_add_v_col_tcxx . . $ dict_add_v_col_t#* add_v = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!);
63
64 /***********************************************************//**
65 Creates a table. This is a high-level function used in SQL execution graphs.
66 @return query thread to run next or NULL */
67 que_thr_tcxx . . $ que_thr_t#*
68 dict_create_table_stepcxx . . $ dict_create_table_step(e73e5dc3217c6744).(
69 /*===================*/
70 que_thr_tcxx . . $ que_thr_t#* thr); /*!< in: query thread */
71
72 /***********************************************************//**
73 Creates an index. This is a high-level function used in SQL execution
74 graphs.
75 @return query thread to run next or NULL */
76 que_thr_tcxx . . $ que_thr_t#*
77 dict_create_index_stepcxx . . $ dict_create_index_step(e73e5dc3217c6744).(
78 /*===================*/
79 que_thr_tcxx . . $ que_thr_t#* thr); /*!< in: query thread */
80
81 /***************************************************************//**
82 Builds an index definition but doesn't update sys_table.
83 @return DB_SUCCESS or error code */
84 void
85 dict_build_index_defcxx . . $ dict_build_index_def(2607dc9ffe2ddf27).(
86 /*=================*/
87 const dict_table_tcxx . . $ dict_table_t#* table, /*!< in: table */
88 dict_index_tcxx . . $ dict_index_t#* index, /*!< in/out: index */
89 trx_tcxx . . $ trx_t#* trx); /*!< in/out: InnoDB transaction
90 handle */
91
92 /** Drop the index tree associated with a row in SYS_INDEXES table.
93 @param[in,out] pcur persistent cursor on rec
94 @param[in,out] trx dictionary transaction
95 @param[in,out] mtr mini-transaction
96 @return tablespace ID to drop (if this is the clustered index)
97 @retval 0 if no tablespace is to be dropped */
98 uint32_tcxx . . $ uint32_t# dict_drop_index_treecxx . . $ dict_drop_index_tree(853be89b3dedbb79).(btr_pcur_tcxx . . $ btr_pcur_t# *pcur, trx_tcxx . . $ trx_t# *trx, mtr_tcxx . . $ mtr_t# *mtr)
99 MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((nonnull(1,3), warn_unused_result));
100
101 /***************************************************************//**
102 Creates an index tree for the index if it is not a member of a cluster.
103 Don't update SYSTEM TABLES.
104 @return error code */
105 dberr_tcxx . . $ dberr_t#
106 dict_create_index_tree_in_memcxx . . $ dict_create_index_tree_in_mem(755a948055ab7b2f).(
107 /*==========================*/
108 dict_index_tcxx . . $ dict_index_t#* index, /*!< in/out: index */
109 trx_tcxx . . $ trx_t#* trx); /*!< in: InnoDB transaction handle */
110
111 /********************************************************************//**
112 Generate a foreign key constraint name when it was not named by the user.
113 A generated constraint has a name of the format dbname/tablename_ibfk_NUMBER,
114 where the numbers start from 1, and are given locally for this table, that is,
115 the number is not global, as it used to be before MySQL 4.0.18. */
116 UNIV_INLINEcxx . . $ `storage/innobase/include/univ.i:168:9`!
117 dberr_tcxx . . $ dberr_t#
118 dict_create_add_foreign_idcxx . . $ dict_create_add_foreign_id(2c2ce346ec77c6d2).(
119 /*=======================*/
120 ulintcxx . . $ ulint#* id_nr, /*!< in/out: number to use in id
121 generation; incremented if used */
122 const char* name, /*!< in: table name */
123 dict_foreign_tcxx . . $ dict_foreign_t#* foreign); /*!< in/out: foreign key */
124
125 /** Adds the given set of foreign key objects to the dictionary tables
126 in the database. This function does not modify the dictionary cache. The
127 caller must ensure that all foreign key objects contain a valid constraint
128 name in foreign->id.
129 @param[in] local_fk_set set of foreign key objects, to be added to
130 the dictionary tables
131 @param[in] table table to which the foreign key objects in
132 local_fk_set belong to
133 @param[in,out] trx transaction
134 @return error code or DB_SUCCESS */
135 dberr_tcxx . . $ dberr_t#
136 dict_create_add_foreigns_to_dictionarycxx . . $ dict_create_add_foreigns_to_dictionary(a6d64f13a9c71426).(
137 /*===================================*/
138 const dict_foreign_setcxx . . $ dict_foreign_set#& local_fk_set,
139 const dict_table_tcxx . . $ dict_table_t#* table,
140 trx_tcxx . . $ trx_t#* trx)
141 MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((nonnull, warn_unused_result));
142
143 /** Check if a foreign constraint is on columns server as base columns
144 of any stored column. This is to prevent creating SET NULL or CASCADE
145 constraint on such columns
146 @param[in] local_fk_set set of foreign key objects, to be added to
147 the dictionary tables
148 @param[in] table table to which the foreign key objects in
149 local_fk_set belong to
150 @return true if yes, otherwise, false */
151 bool
152 dict_foreigns_has_s_base_colcxx . . $ dict_foreigns_has_s_base_col(cca5e26f7a87daed).(
153 const dict_foreign_setcxx . . $ dict_foreign_set#& local_fk_set,
154 const dict_table_tcxx . . $ dict_table_t#* table);
155
156 /********************************************************************//**
157 Add a foreign key definition to the data dictionary tables.
158 @return error code or DB_SUCCESS */
159 dberr_tcxx . . $ dberr_t#
160 dict_create_add_foreign_to_dictionarycxx . . $ dict_create_add_foreign_to_dictionary(c92cda3044b865cd).(
161 /*==================================*/
162 const char* name, /*!< in: table name */
163 const dict_foreign_tcxx . . $ dict_foreign_t#* foreign,/*!< in: foreign key */
164 trx_tcxx . . $ trx_t#* trx) /*!< in/out: dictionary transaction */
165 MY_ATTRIBUTEcxx . . $ `storage/innobase/include/univ.i:162:11`!((nonnull, warn_unused_result));
166
167 /* Table create node structure */
168 struct tab_node_tcxx . . $ tab_node_t#{
169 que_common_tcxx . . $ que_common_t# commoncxx . . $ tab_node_t#common.; /*!< node type: QUE_NODE_TABLE_CREATE */
170 dict_table_tcxx . . $ dict_table_t#* tablecxx . . $ tab_node_t#table.; /*!< table to create, built as a
171 memory data structure with
172 dict_mem_... functions */
173 ins_node_tcxx . . $ ins_node_t#* tab_defcxx . . $ tab_node_t#tab_def.; /*!< child node which does the insert of
174 the table definition; the row to be
175 inserted is built by the parent node */
176 ins_node_tcxx . . $ ins_node_t#* col_defcxx . . $ tab_node_t#col_def.; /*!< child node which does the inserts
177 of the column definitions; the row to
178 be inserted is built by the parent
179 node */
180 ins_node_tcxx . . $ ins_node_t#* v_col_defcxx . . $ tab_node_t#v_col_def.; /*!< child node which does the inserts
181 of the sys_virtual row definitions;
182 the row to be inserted is built by
183 the parent node */
184 /*----------------------*/
185 /* Local storage for this graph node */
186 ulintcxx . . $ ulint# statecxx . . $ tab_node_t#state.; /*!< node execution state */
187 ulintcxx . . $ ulint# col_nocxx . . $ tab_node_t#col_no.; /*!< next column definition to insert */
188 ulintcxx . . $ ulint# base_col_nocxx . . $ tab_node_t#base_col_no.; /*!< next base column to insert */
189 mem_heap_tcxx . . $ mem_heap_t#* heapcxx . . $ tab_node_t#heap.; /*!< memory heap used as auxiliary
190 storage */
191 };
192
193 /* Table create node states */
194 #define TABLE_BUILD_TABLE_DEFcxx . . $ `storage/innobase/include/dict0crea.h:194:9`! 1
195 #define TABLE_BUILD_COL_DEFcxx . . $ `storage/innobase/include/dict0crea.h:195:9`! 2
196 #define TABLE_BUILD_V_COL_DEFcxx . . $ `storage/innobase/include/dict0crea.h:196:9`! 3
197 #define TABLE_ADD_TO_CACHEcxx . . $ `storage/innobase/include/dict0crea.h:197:9`! 4
198 #define TABLE_COMPLETEDcxx . . $ `storage/innobase/include/dict0crea.h:198:9`! 5
199
200 /* Index create node struct */
201
202 struct ind_node_tcxx . . $ ind_node_t#{
203 que_common_tcxx . . $ que_common_t# commoncxx . . $ ind_node_t#common.; /*!< node type: QUE_NODE_INDEX_CREATE */
204 dict_index_tcxx . . $ dict_index_t#* indexcxx . . $ ind_node_t#index.; /*!< index to create, built as a
205 memory data structure with
206 dict_mem_... functions */
207 const char* table_namecxx . . $ ind_node_t#table_name.; /*!< table name */
208 ins_node_tcxx . . $ ins_node_t#* ind_defcxx . . $ ind_node_t#ind_def.; /*!< child node which does the insert of
209 the index definition; the row to be
210 inserted is built by the parent node */
211 ins_node_tcxx . . $ ins_node_t#* field_defcxx . . $ ind_node_t#field_def.; /*!< child node which does the inserts
212 of the field definitions; the row to
213 be inserted is built by the parent
214 node */
215 /*----------------------*/
216 /* Local storage for this graph node */
217 ulintcxx . . $ ulint# statecxx . . $ ind_node_t#state.; /*!< node execution state */
218 uint32_tcxx . . $ uint32_t# page_nocxx . . $ ind_node_t#page_no.; /* root page number of the index */
219 dtuple_tcxx . . $ dtuple_t#* ind_rowcxx . . $ ind_node_t#ind_row.; /* index definition row built */
220 ulintcxx . . $ ulint# field_nocxx . . $ ind_node_t#field_no.; /* next field definition to insert */
221 mem_heap_tcxx . . $ mem_heap_t#* heapcxx . . $ ind_node_t#heap.; /*!< memory heap used as auxiliary
222 storage */
223 uint key_idcxx . . $ ind_node_t#key_id.; /*!< encryption key_id */
224 fil_encryption_tcxx . . $ fil_encryption_t# modecxx . . $ ind_node_t#mode.; /*!< encryption mode */
225 const dict_add_v_col_tcxx . . $ dict_add_v_col_t#*
226 add_vcxx . . $ ind_node_t#add_v.; /*!< new virtual columns that being
227 added along with an add index call */
228 };
229
230 /** Compose a column number for a virtual column, stored in the "POS" field
231 of Sys_columns. The column number includes both its virtual column sequence
232 (the "nth" virtual column) and its actual column position in original table
233 @param[in] v_pos virtual column sequence
234 @param[in] col_pos column position in original table definition
235 @return composed column position number */
236 UNIV_INLINEcxx . . $ `storage/innobase/include/univ.i:168:9`!
237 ulintcxx . . $ ulint#
238 dict_create_v_col_poscxx . . $ dict_create_v_col_pos(80bad76eed2d2579).(
239 ulintcxx . . $ ulint# v_pos,
240 ulintcxx . . $ ulint# col_pos);
241
242 /** Get the column number for a virtual column (the column position in
243 original table), stored in the "POS" field of Sys_columns
244 @param[in] pos virtual column position
245 @return column position in original table */
246 UNIV_INLINEcxx . . $ `storage/innobase/include/univ.i:168:9`!
247 ulintcxx . . $ ulint#
248 dict_get_v_col_mysql_poscxx . . $ dict_get_v_col_mysql_pos(ecdaa1632f49f591).(
249 ulintcxx . . $ ulint# pos);
250
251 /** Get a virtual column sequence (the "nth" virtual column) for a
252 virtual column, stord in the "POS" field of Sys_columns
253 @param[in] pos virtual column position
254 @return virtual column sequence */
255 UNIV_INLINEcxx . . $ `storage/innobase/include/univ.i:168:9`!
256 ulintcxx . . $ ulint#
257 dict_get_v_col_poscxx . . $ dict_get_v_col_pos(ecdaa1632f49f591).(
258 ulintcxx . . $ ulint# pos);
259
260 /* Index create node states */
261 #define INDEX_BUILD_INDEX_DEFcxx . . $ `storage/innobase/include/dict0crea.h:261:9`! 1
262 #define INDEX_BUILD_FIELD_DEFcxx . . $ `storage/innobase/include/dict0crea.h:262:9`! 2
263 #define INDEX_CREATE_INDEX_TREEcxx . . $ `storage/innobase/include/dict0crea.h:263:9`! 3
264 #define INDEX_ADD_TO_CACHEcxx . . $ `storage/innobase/include/dict0crea.h:264:9`! 4
265
266 #include "dict0crea.inl"cxx . . $ `<file>/storage/innobase/include/dict0crea.inl`/
267
268 #endif