MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dict0dict.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved.
4 Copyright (c) 2012, Facebook Inc.
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, Suite 500, Boston, MA 02110-1335 USA
17 
18 *****************************************************************************/
19 
20 /**************************************************/
27 #ifndef dict0dict_h
28 #define dict0dict_h
29 
30 #include "univ.i"
31 #include "db0err.h"
32 #include "dict0types.h"
33 #include "dict0mem.h"
34 #include "data0type.h"
35 #include "data0data.h"
36 #include "mem0mem.h"
37 #include "rem0types.h"
38 #include "ut0mem.h"
39 #include "ut0lst.h"
40 #include "hash0hash.h"
41 #include "ut0rnd.h"
42 #include "ut0byte.h"
43 #include "trx0types.h"
44 #include "row0types.h"
45 
46 #ifndef UNIV_HOTBACKUP
47 # include "sync0sync.h"
48 # include "sync0rw.h"
49 /******************************************************************/
51 UNIV_INTERN
52 void
54 /*============*/
55  char* a)
56  __attribute__((nonnull));
57 /********************************************************************/
60 UNIV_INTERN
61 ulint
63 /*=================*/
64  const char* name)
66  __attribute__((nonnull, warn_unused_result));
67 /*********************************************************************/
72 UNIV_INTERN
73 char*
75 /*======================*/
76  const char* name,
77  const char* database_name,
78  ulint database_name_len,
79  const char* table_name,
80  ulint table_name_len,
82  mem_heap_t* heap);
83 /*********************************************************************/
85 UNIV_INTERN
86 void
88 /*==============*/
89  dict_foreign_t* foreign);
90 /*********************************************************************/
95 UNIV_INTERN
96 ulint
98 /*==============================*/
101 /********************************************************************/
104 UNIV_INTERN
105 const char*
107 /*================*/
108  const char* name)
110  __attribute__((nonnull, warn_unused_result));
111 
121 };
122 
123 /**********************************************************************/
126 UNIV_INTERN
129 /*==================*/
130  table_id_t table_id,
131  ibool dict_locked,
132  dict_table_op_t table_op)
133  __attribute__((warn_unused_result));
134 /********************************************************************/
136 UNIV_INTERN
137 void
139 /*=============*/
141  ibool dict_locked,
142  ibool try_drop)
145  __attribute__((nonnull));
146 /**********************************************************************/
148 UNIV_INTERN
149 void
150 dict_init(void);
151 /*===========*/
152 /********************************************************************/
158 UNIV_INTERN
159 void
161 /*=========================*/
162 /*********************************************************************/
165 UNIV_INLINE
166 ulint
168 /*==================*/
169  const dict_col_t* col)
170  __attribute__((nonnull, warn_unused_result));
171 /*********************************************************************/
174 UNIV_INLINE
175 ulint
177 /*==================*/
178  const dict_col_t* col)
179  __attribute__((nonnull, warn_unused_result));
180 /*********************************************************************/
182 UNIV_INLINE
183 void
185 /*=====================*/
186  dict_col_t* col,
187  ulint mbminlen,
189  ulint mbmaxlen)
191  __attribute__((nonnull));
192 /*********************************************************************/
194 UNIV_INLINE
195 void
197 /*===============*/
198  const dict_col_t* col,
199  dtype_t* type)
200  __attribute__((nonnull));
201 /**********************************************************************/
206 UNIV_INLINE
207 ulint
209 /*==========================*/
211  const dict_col_t* col)
213  __attribute__((nonnull, warn_unused_result));
214 #endif /* !UNIV_HOTBACKUP */
215 #ifdef UNIV_DEBUG
216 /*********************************************************************/
219 UNIV_INLINE
220 ibool
221 dict_col_type_assert_equal(
222 /*=======================*/
223  const dict_col_t* col,
224  const dtype_t* type)
225  __attribute__((nonnull, warn_unused_result));
226 #endif /* UNIV_DEBUG */
227 #ifndef UNIV_HOTBACKUP
228 /***********************************************************************/
231 UNIV_INLINE
232 ulint
234 /*==================*/
235  const dict_col_t* col)
236  __attribute__((nonnull, warn_unused_result));
237 /***********************************************************************/
240 UNIV_INLINE
241 ulint
243 /*==================*/
244  const dict_col_t* col)
245  __attribute__((nonnull, warn_unused_result));
246 /***********************************************************************/
249 UNIV_INLINE
250 ulint
252 /*====================*/
253  const dict_col_t* col,
254  ulint comp)
255  __attribute__((nonnull, warn_unused_result));
256 /***********************************************************************/
260 UNIV_INLINE
261 ulint
263 /*=======================*/
264  const dict_col_t* col,
265  ulint comp)
266  __attribute__((nonnull, warn_unused_result));
267 /*********************************************************************/
270 UNIV_INLINE
271 ulint
273 /*============*/
274  const dict_col_t* col)
275  __attribute__((nonnull, warn_unused_result));
276 /*********************************************************************/
278 UNIV_INLINE
279 ulint
281 /*===================*/
282  const dict_col_t* col,
283  const dict_index_t* clust_index)
284  __attribute__((nonnull, warn_unused_result));
285 /****************************************************************/
289 UNIV_INTERN
290 ibool
292 /*======================*/
293  const char* name)
294  __attribute__((nonnull, warn_unused_result));
295 /********************************************************************/
297 UNIV_INTERN
298 void
300 /*====================*/
302  __attribute__((nonnull));
303 /********************************************************************/
305 UNIV_INTERN
306 void
308 /*==========================*/
310  ib_uint64_t value)
311  __attribute__((nonnull));
312 /********************************************************************/
316 UNIV_INTERN
317 ib_uint64_t
319 /*====================*/
320  const dict_table_t* table)
321  __attribute__((nonnull, warn_unused_result));
322 /********************************************************************/
325 UNIV_INTERN
326 void
328 /*=================================*/
329 
331  ib_uint64_t value)
332  __attribute__((nonnull));
333 /********************************************************************/
335 UNIV_INTERN
336 void
338 /*======================*/
340  __attribute__((nonnull));
341 #endif /* !UNIV_HOTBACKUP */
342 /**********************************************************************/
344 UNIV_INTERN
345 void
347 /*==========================*/
349  mem_heap_t* heap)
350  __attribute__((nonnull));
351 #ifndef UNIV_HOTBACKUP
352 /**********************************************************************/
354 UNIV_INTERN
355 void
357 /*====================*/
359  ibool can_be_evicted,
360  mem_heap_t* heap)
361  __attribute__((nonnull));
362 /**********************************************************************/
364 UNIV_INTERN
365 void
367 /*=========================*/
369  __attribute__((nonnull));
370 /**********************************************************************/
373 UNIV_INTERN
374 dberr_t
376 /*=======================*/
378  const char* new_name,
379  ibool rename_also_foreigns)
383  __attribute__((nonnull, warn_unused_result));
384 /**********************************************************************/
386 UNIV_INTERN
387 void
389 /*=========================*/
392  __attribute__((nonnull));
393 /**********************************************************************/
396 UNIV_INTERN
397 void
399 /*==========================*/
401  table_id_t new_id)
402  __attribute__((nonnull));
403 /**********************************************************************/
405 UNIV_INTERN
406 void
408 /*===========================*/
409  dict_foreign_t* foreign)
410  __attribute__((nonnull));
411 /**********************************************************************/
417 UNIV_INTERN
418 dberr_t
420 /*======================*/
421  dict_foreign_t* foreign,
423  const char** col_names,
426  bool check_charsets,
429  dict_err_ignore_t ignore_err)
431  __attribute__((nonnull(1), warn_unused_result));
432 /*********************************************************************/
437 UNIV_INTERN
440 /*=================================*/
443  __attribute__((nonnull, warn_unused_result));
444 /*********************************************************************/
447 UNIV_INTERN
448 ibool
450 /*====================================*/
451  const dict_table_t* table)
452  __attribute__((nonnull, warn_unused_result));
453 /**********************************************************************/
457 UNIV_INTERN
458 bool
460 /*=======================*/
462  const char** col_names,
465  const dict_index_t* index)
466  __attribute__((nonnull(1,3), warn_unused_result));
467 /**********************************************************************/
470 UNIV_INTERN
471 ibool
473 /*=========================*/
474  THD* thd,
475  const char* str,
476  const char* keyword)
477  __attribute__((nonnull, warn_unused_result));
478 /*********************************************************************/
484 UNIV_INTERN
487 /*==============================*/
490  __attribute__((nonnull, warn_unused_result));
491 /*********************************************************************/
499 UNIV_INTERN
500 dberr_t
502 /*============================*/
503  trx_t* trx,
504  const char* sql_string,
512  size_t sql_length,
513  const char* name,
516  ibool reject_fks)
519  __attribute__((nonnull, warn_unused_result));
520 /**********************************************************************/
524 UNIV_INTERN
525 dberr_t
527 /*================================*/
528  mem_heap_t* heap,
530  trx_t* trx,
532  ulint* n,
534  const char*** constraints_to_drop)
536  __attribute__((nonnull, warn_unused_result));
537 /**********************************************************************/
543 UNIV_INTERN
546 /*====================*/
547  const char* table_name,
548  ibool dict_locked,
549  ibool try_drop,
553  ignore_err)
555  __attribute__((nonnull, warn_unused_result));
556 
557 /*********************************************************************/
562 UNIV_INTERN
565 /*====================*/
566  const dict_table_t* table,
567  const char** col_names,
570  const char** columns,
571  ulint n_cols,
572  const dict_index_t* types_idx,
576  bool check_charsets,
580  ulint check_null)
584  __attribute__((nonnull(1,3), warn_unused_result));
585 /**********************************************************************/
589 UNIV_INTERN
590 const char*
592 /*====================*/
593  const dict_table_t* table,
594  ulint col_nr)
595  __attribute__((nonnull, warn_unused_result));
596 /**********************************************************************/
598 UNIV_INTERN
599 void
601 /*=============*/
603  __attribute__((nonnull));
604 /**********************************************************************/
606 UNIV_INTERN
607 void
609 /*============================*/
610  ibool create_table_format,
614  FILE* file,
615  trx_t* trx,
617  __attribute__((nonnull));
618 /**********************************************************************/
621 UNIV_INTERN
622 void
624 /*============================================*/
625  FILE* file,
626  trx_t* trx,
627  dict_foreign_t* foreign,
628  ibool add_newline)
629  __attribute__((nonnull(1,3)));
630 /********************************************************************/
632 UNIV_INTERN
633 void
635 /*==================*/
636  FILE* file,
637  const trx_t* trx,
638  const dict_index_t* index)
639  __attribute__((nonnull(1,3)));
640 /*********************************************************************/
645 UNIV_INTERN
646 bool
648 /*====================*/
649  const dict_table_t* table,
650  const char** col_names,
653  const char** columns,
654  ulint n_cols,
655  const dict_index_t* index,
656  const dict_index_t* types_idx,
660  bool check_charsets,
664  ulint check_null)
668  __attribute__((nonnull(1,3), warn_unused_result));
669 #ifdef UNIV_DEBUG
670 /********************************************************************/
673 UNIV_INLINE
675 dict_table_get_first_index(
676 /*=======================*/
677  const dict_table_t* table)
678  __attribute__((nonnull, warn_unused_result));
679 /********************************************************************/
682 UNIV_INLINE
684 dict_table_get_last_index(
685 /*=======================*/
686  const dict_table_t* table)
687  __attribute__((nonnull, warn_unused_result));
688 /********************************************************************/
691 UNIV_INLINE
693 dict_table_get_next_index(
694 /*======================*/
695  const dict_index_t* index)
696  __attribute__((nonnull, warn_unused_result));
697 #else /* UNIV_DEBUG */
698 # define dict_table_get_first_index(table) UT_LIST_GET_FIRST((table)->indexes)
699 # define dict_table_get_last_index(table) UT_LIST_GET_LAST((table)->indexes)
700 # define dict_table_get_next_index(index) UT_LIST_GET_NEXT(indexes, index)
701 #endif /* UNIV_DEBUG */
702 #endif /* !UNIV_HOTBACKUP */
703 
704 /* Skip corrupted index */
705 #define dict_table_skip_corrupt_index(index) \
706  while (index && dict_index_is_corrupted(index)) { \
707  index = dict_table_get_next_index(index); \
708  }
709 
710 /* Get the next non-corrupt index */
711 #define dict_table_next_uncorrupted_index(index) \
712 do { \
713  index = dict_table_get_next_index(index); \
714  dict_table_skip_corrupt_index(index); \
715 } while (0)
716 
717 /********************************************************************/
720 UNIV_INLINE
721 ulint
723 /*================*/
724  const dict_index_t* index)
725  __attribute__((nonnull, pure, warn_unused_result));
726 /********************************************************************/
729 UNIV_INLINE
730 ulint
732 /*=================*/
733  const dict_index_t* index)
734  __attribute__((nonnull, pure, warn_unused_result));
735 /********************************************************************/
738 UNIV_INLINE
739 ulint
741 /*===============*/
742  const dict_index_t* index)
743  __attribute__((nonnull, pure, warn_unused_result));
744 /********************************************************************/
747 UNIV_INLINE
748 ulint
750 /*======================*/
751  const dict_index_t* index)
752  __attribute__((nonnull, pure, warn_unused_result));
753 
754 /************************************************************************
755 Gets the all the FTS indexes for the table. NOTE: must not be called for
756 tables which do not have an FTS-index. */
757 UNIV_INTERN
758 ulint
760 /*===========================*/
761  /* out: number of indexes collected */
762  dict_table_t* table, /* in: table */
763  ib_vector_t* indexes)/* out: vector for collecting FTS indexes */
764  __attribute__((nonnull));
765 /********************************************************************/
769 UNIV_INLINE
770 ulint
772 /*=======================*/
773  const dict_table_t* table)
774  __attribute__((nonnull, pure, warn_unused_result));
775 /********************************************************************/
778 UNIV_INLINE
779 ulint
781 /*======================*/
782  const dict_table_t* table)
783  __attribute__((nonnull, pure, warn_unused_result));
784 /********************************************************************/
788 UNIV_INLINE
789 ulint
791 /*==================*/
792  const dict_table_t* table)
793  __attribute__((nonnull, pure, warn_unused_result));
794 /********************************************************************/
797 UNIV_INLINE
798 ib_uint64_t
800 /*==================*/
801  const dict_table_t* table)
802  __attribute__((nonnull, warn_unused_result));
803 /********************************************************************/
807 UNIV_INLINE
808 void
810 /*==================*/
812  __attribute__((nonnull));
813 /********************************************************************/
817 UNIV_INLINE
818 void
820 /*==================*/
822  __attribute__((nonnull));
823 #ifdef UNIV_DEBUG
824 /********************************************************************/
827 UNIV_INLINE
828 dict_col_t*
829 dict_table_get_nth_col(
830 /*===================*/
831  const dict_table_t* table,
832  ulint pos)
833  __attribute__((nonnull, warn_unused_result));
834 /********************************************************************/
837 UNIV_INLINE
838 dict_col_t*
839 dict_table_get_sys_col(
840 /*===================*/
841  const dict_table_t* table,
842  ulint sys)
843  __attribute__((nonnull, warn_unused_result));
844 #else /* UNIV_DEBUG */
845 #define dict_table_get_nth_col(table, pos) \
846 ((table)->cols + (pos))
847 #define dict_table_get_sys_col(table, sys) \
848 ((table)->cols + (table)->n_cols + (sys) - DATA_N_SYS_COLS)
849 #endif /* UNIV_DEBUG */
850 /********************************************************************/
853 UNIV_INLINE
854 ulint
856 /*======================*/
857  const dict_table_t* table,
858  ulint sys)
859  __attribute__((nonnull, warn_unused_result));
860 #ifndef UNIV_HOTBACKUP
861 /********************************************************************/
864 UNIV_INLINE
865 ulint
867 /*====================*/
868  const dict_index_t* index)
869  __attribute__((nonnull, warn_unused_result));
870 #endif /* !UNIV_HOTBACKUP */
871 /********************************************************************/
874 UNIV_INLINE
875 ibool
877 /*===============*/
878  const dict_table_t* table)
879  __attribute__((nonnull, warn_unused_result));
880 /********************************************************************/
883 UNIV_INLINE
884 ulint
886 /*==================*/
887  const dict_table_t* table)
888  __attribute__((nonnull, warn_unused_result));
889 /********************************************************************/
892 UNIV_INLINE
893 ulint
895 /*===============*/
896  ulint flags)
897  __attribute__((warn_unused_result));
898 /********************************************************************/
900 UNIV_INLINE
901 void
903 /*========*/
904  ulint* flags,
905  rec_format_t format,
906  ulint zip_ssize,
907  bool remote_path)
908  __attribute__((nonnull));
909 /********************************************************************/
920 UNIV_INLINE
921 ulint
923 /*=================*/
924  ulint flags)
925  __attribute__((const));
926 /********************************************************************/
929 UNIV_INLINE
930 ulint
932 /*=================*/
933  ulint flags)
934  __attribute__((const));
935 /********************************************************************/
938 UNIV_INLINE
939 ulint
941 /*================*/
942  const dict_table_t* table)
943  __attribute__((nonnull, warn_unused_result));
944 #ifndef UNIV_HOTBACKUP
945 /*********************************************************************/
949 UNIV_INLINE
950 void
952 /*======================*/
954  __attribute__((nonnull));
955 /*********************************************************************/
957 UNIV_INLINE
958 void
960 /*========================*/
962  __attribute__((nonnull));
963 /********************************************************************/
967 UNIV_INTERN
968 ibool
970 /*============================*/
971  const dict_table_t* table,
972  ulint n)
973  __attribute__((nonnull, warn_unused_result));
974 /*******************************************************************/
977 UNIV_INLINE
978 ibool
980 /*=====================*/
982  __attribute__((nonnull, warn_unused_result));
983 /*******************************************************************/
987 UNIV_INTERN
988 void
990 /*==================*/
991  dtuple_t* tuple,
992  const dict_table_t* table)
993  __attribute__((nonnull));
994 /********************************************************************
995 Wait until all the background threads of the given table have exited, i.e.,
996 bg_threads == 0. Note: bg_threads_mutex must be reserved when
997 calling this. */
998 UNIV_INTERN
999 void
1000 dict_table_wait_for_bg_threads_to_exit(
1001 /*===================================*/
1002  dict_table_t* table, /* in: table */
1003  ulint delay) /* in: time in microseconds to wait between
1004  checks of bg_threads. */
1005  __attribute__((nonnull));
1006 /**********************************************************************/
1011 UNIV_INTERN
1012 dict_index_t*
1014 /*======================*/
1015  index_id_t id)
1016  __attribute__((warn_unused_result));
1017 /**********************************************************************/
1022 UNIV_INTERN
1023 ulint
1025 /*====================*/
1026  ulint max_tables,
1027  ulint pct_check);
1028 /**********************************************************************/
1031 UNIV_INTERN
1032 dberr_t
1034 /*====================*/
1035  dict_table_t* table,
1036  dict_index_t* index,
1038  ulint page_no,
1039  ibool strict)
1042  __attribute__((nonnull, warn_unused_result));
1043 /**********************************************************************/
1045 UNIV_INTERN
1046 void
1048 /*=========================*/
1049  dict_table_t* table,
1050  dict_index_t* index)
1051  __attribute__((nonnull));
1052 #endif /* !UNIV_HOTBACKUP */
1053 /********************************************************************/
1057 UNIV_INLINE
1058 ulint
1060 /*====================*/
1061  const dict_index_t* index)
1064  __attribute__((nonnull, warn_unused_result));
1065 /********************************************************************/
1071 UNIV_INLINE
1072 ulint
1074 /*====================*/
1075  const dict_index_t* index)
1077  __attribute__((nonnull, warn_unused_result));
1078 /********************************************************************/
1083 UNIV_INLINE
1084 ulint
1086 /*============================*/
1087  const dict_index_t* index)
1089  __attribute__((nonnull, warn_unused_result));
1090 /********************************************************************/
1096 UNIV_INLINE
1097 ulint
1099 /*======================================*/
1100  const dict_index_t* index)
1102  __attribute__((nonnull, warn_unused_result));
1103 #ifdef UNIV_DEBUG
1104 /********************************************************************/
1107 UNIV_INLINE
1108 dict_field_t*
1109 dict_index_get_nth_field(
1110 /*=====================*/
1111  const dict_index_t* index,
1112  ulint pos)
1113  __attribute__((nonnull, warn_unused_result));
1114 #else /* UNIV_DEBUG */
1115 # define dict_index_get_nth_field(index, pos) ((index)->fields + (pos))
1116 #endif /* UNIV_DEBUG */
1117 /********************************************************************/
1120 UNIV_INLINE
1121 const dict_col_t*
1123 /*===================*/
1124  const dict_index_t* index,
1125  ulint pos)
1126  __attribute__((nonnull, warn_unused_result));
1127 /********************************************************************/
1130 UNIV_INLINE
1131 ulint
1133 /*======================*/
1134  const dict_index_t* index,
1135  ulint pos)
1136  __attribute__((nonnull, warn_unused_result));
1137 /********************************************************************/
1141 UNIV_INLINE
1142 ulint
1144 /*=======================*/
1145  const dict_index_t* index,
1146  ulint n)
1147  __attribute__((nonnull, warn_unused_result));
1148 /********************************************************************/
1152 UNIV_INTERN
1153 ulint
1155 /*=================================*/
1156  const dict_index_t* index,
1157  ulint n,
1158  ibool inc_prefix)
1160  __attribute__((nonnull, warn_unused_result));
1161 /********************************************************************/
1164 UNIV_INTERN
1165 ibool
1167 /*==============================*/
1168  const dict_index_t* index,
1169  ulint n)
1170  __attribute__((nonnull, warn_unused_result));
1171 /********************************************************************/
1178 UNIV_INTERN
1179 ulint
1181 /*=========================*/
1182  const dict_index_t* index,
1183  const dict_index_t* index2,
1184  ulint n)
1185  __attribute__((nonnull, warn_unused_result));
1186 /********************************************************************/
1189 UNIV_INTERN
1190 ulint
1192 /*=======================*/
1193  const dict_table_t* table,
1194  ulint n)
1195  __attribute__((nonnull, warn_unused_result));
1196 /********************************************************************/
1199 UNIV_INLINE
1200 ulint
1202 /*=======================*/
1203  const dict_index_t* index,
1204  ulint type)
1205  __attribute__((nonnull, warn_unused_result));
1206 /*******************************************************************/
1208 UNIV_INTERN
1209 void
1211 /*===============*/
1212  dict_index_t* index,
1213  const dict_table_t* table,
1214  dict_col_t* col,
1215  ulint prefix_len)
1216  __attribute__((nonnull));
1217 #ifndef UNIV_HOTBACKUP
1218 /*******************************************************************/
1220 UNIV_INTERN
1221 void
1223 /*==================*/
1224  dtuple_t* tuple,
1225  const dict_index_t* index,
1226  ulint n_fields)
1228  __attribute__((nonnull));
1229 #endif /* !UNIV_HOTBACKUP */
1230 /*********************************************************************/
1233 UNIV_INLINE
1234 const dict_col_t*
1236 /*===============*/
1237  const dict_field_t* field)
1238  __attribute__((nonnull, warn_unused_result));
1239 #ifndef UNIV_HOTBACKUP
1240 /**********************************************************************/
1244 UNIV_INTERN
1245 dict_index_t*
1247 /*===========================*/
1248  index_id_t index_id)
1249  __attribute__((warn_unused_result));
1250 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
1251 /**********************************************************************/
1254 UNIV_INTERN
1255 dict_index_t*
1256 dict_index_get_if_in_cache(
1257 /*=======================*/
1258  index_id_t index_id)
1259  __attribute__((warn_unused_result));
1260 #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
1261 #ifdef UNIV_DEBUG
1262 /**********************************************************************/
1266 UNIV_INTERN
1267 ibool
1268 dict_index_check_search_tuple(
1269 /*==========================*/
1270  const dict_index_t* index,
1271  const dtuple_t* tuple)
1272  __attribute__((nonnull, warn_unused_result));
1274 enum check_name {
1276  CHECK_ALL_COMPLETE,
1278  CHECK_ABORTED_OK,
1280  CHECK_PARTIAL_OK
1281 };
1282 /**********************************************************************/
1284 UNIV_INTERN
1285 void
1286 dict_table_check_for_dup_indexes(
1287 /*=============================*/
1288  const dict_table_t* table,
1290  enum check_name check)
1292  __attribute__((nonnull));
1293 #endif /* UNIV_DEBUG */
1294 /**********************************************************************/
1297 UNIV_INTERN
1298 dtuple_t*
1300 /*======================*/
1301  const dict_index_t* index,
1302  const rec_t* rec,
1304  ulint page_no,
1306  mem_heap_t* heap,
1308  ulint level)
1310  __attribute__((nonnull, warn_unused_result));
1311 /**********************************************************************/
1315 UNIV_INTERN
1316 rec_t*
1318 /*=============================*/
1319  const dict_index_t* index,
1320  const rec_t* rec,
1322  ulint* n_fields,
1323  byte** buf,
1325  ulint* buf_size)
1326  __attribute__((nonnull, warn_unused_result));
1327 /**********************************************************************/
1330 UNIV_INTERN
1331 dtuple_t*
1333 /*========================*/
1334  dict_index_t* index,
1335  rec_t* rec,
1336  ulint n_fields,
1337  mem_heap_t* heap)
1338  __attribute__((nonnull, warn_unused_result));
1339 /*********************************************************************/
1342 UNIV_INLINE
1343 ulint
1345 /*=================*/
1346  const dict_index_t* index)
1347  __attribute__((nonnull, warn_unused_result));
1348 /*********************************************************************/
1350 UNIV_INLINE
1351 void
1353 /*=================*/
1354  dict_index_t* index,
1355  ulint space)
1356  __attribute__((nonnull));
1357 /*********************************************************************/
1360 UNIV_INLINE
1361 ulint
1363 /*================*/
1364  const dict_index_t* tree)
1365  __attribute__((nonnull, warn_unused_result));
1366 /*********************************************************************/
1369 UNIV_INLINE
1370 rw_lock_t*
1372 /*================*/
1373  dict_index_t* index)
1374  __attribute__((nonnull, warn_unused_result));
1375 /********************************************************************/
1380 UNIV_INLINE
1381 ulint
1383 /*==============================*/
1384 
1385 /* Online index creation @{ */
1386 /********************************************************************/
1389 UNIV_INLINE
1392 /*=========================*/
1393  const dict_index_t* index)
1394  __attribute__((nonnull, warn_unused_result));
1395 /********************************************************************/
1397 UNIV_INLINE
1398 void
1400 /*=========================*/
1401  dict_index_t* index,
1402  enum online_index_status status)
1403  __attribute__((nonnull));
1404 /********************************************************************/
1412 UNIV_INLINE
1413 bool
1415 /*=====================*/
1416  const dict_index_t* index)
1417  __attribute__((nonnull, warn_unused_result));
1418 /*********************************************************************/
1420 UNIV_INTERN
1421 ulint
1423 /*========================*/
1424  const dict_index_t* index)
1425  __attribute__((nonnull, warn_unused_result));
1426 /********************************************************************/
1428 UNIV_INTERN
1429 void
1431 /*============================*/
1432 /********************************************************************/
1434 UNIV_INTERN
1435 void
1437 /*===========================*/
1438 /**********************************************************************/
1442 UNIV_INTERN
1443 void
1445 /*==================*/
1446  const dict_table_t* table,
1447  ulint latch_mode)
1449  __attribute__((nonnull));
1450 /**********************************************************************/
1452 UNIV_INTERN
1453 void
1455 /*====================*/
1456  const dict_table_t* table,
1457  ulint latch_mode)
1459  __attribute__((nonnull));
1460 /********************************************************************/
1463 UNIV_INTERN
1464 ibool
1466 /*=====================*/
1467  const char* name1,
1469  const char* name2)
1471  __attribute__((nonnull, warn_unused_result));
1472 /*********************************************************************/
1474 UNIV_INTERN
1475 void
1477 /*=========================*/
1478  dict_table_t* table,
1479  dict_index_t* index)
1480  __attribute__((nonnull));
1481 /**********************************************************************/
1484 UNIV_INTERN
1485 dict_index_t*
1487 /*=========================*/
1488  dict_table_t* table,
1489  const char* name)
1490  __attribute__((nonnull, warn_unused_result));
1491 /**********************************************************************/
1495 UNIV_INTERN
1496 dict_index_t*
1498 /*====================================*/
1499  dict_table_t* table,
1500  const char* name)
1501  __attribute__((nonnull, warn_unused_result));
1502 /***************************************************************
1503 Check whether a column exists in an FTS index. */
1504 UNIV_INLINE
1505 ulint
1506 dict_table_is_fts_column(
1507 /*=====================*/
1508  /* out: ULINT_UNDEFINED if no match else
1509  the offset within the vector */
1510  ib_vector_t* indexes,/* in: vector containing only FTS indexes */
1511  ulint col_no) /* in: col number to search for */
1512  __attribute__((nonnull, warn_unused_result));
1513 /**********************************************************************/
1515 UNIV_INTERN
1516 void
1518 /*================================*/
1519  dict_table_t* table)
1520  __attribute__((nonnull));
1521 /**********************************************************************/
1523 UNIV_INTERN
1524 void
1526 /*================================*/
1527  dict_table_t* table)
1528  __attribute__((nonnull));
1529 /**********************************************************************/
1531 UNIV_INTERN
1532 void
1534 /*=============*/
1535  dict_table_t* table)
1536  __attribute__((nonnull));
1537 
1541 #define MAX_NUM_FK_COLUMNS 500
1542 
1543 /* Buffers for storing detailed information about the latest foreign key
1544 and unique key errors */
1545 extern FILE* dict_foreign_err_file;
1546 extern ib_mutex_t dict_foreign_err_mutex; /* mutex protecting the buffers */
1547 
1549 extern dict_sys_t* dict_sys;
1552 
1553 /* Dictionary system struct */
1554 struct dict_sys_t{
1572  ulint size;
1580  /*=============================*/
1581  UT_LIST_BASE_NODE_T(dict_table_t)
1584  UT_LIST_BASE_NODE_T(dict_table_t)
1587 };
1588 #endif /* !UNIV_HOTBACKUP */
1589 
1594 
1595 /**********************************************************************/
1597 UNIV_INTERN
1598 void
1599 dict_ind_init(void);
1600 /*===============*/
1601 
1602 /* Auxiliary structs for checking a table definition @{ */
1603 
1604 /* This struct is used to specify the name and type that a column must
1605 have when checking a table's schema. */
1607  const char* name; /* column name */
1608  ulint mtype; /* required column main type */
1609  ulint prtype_mask; /* required column precise type mask;
1610  if this is non-zero then all the
1611  bits it has set must also be set
1612  in the column's prtype */
1613  ulint len; /* required column length */
1614 };
1615 
1616 /* This struct is used for checking whether a given table exists and
1617 whether it has a predefined schema (number of columns and columns names
1618 and types) */
1620  const char* table_name; /* the name of the table whose
1621  structure we are checking */
1622  ulint n_cols; /* the number of columns the
1623  table must have */
1624  dict_col_meta_t* columns; /* metadata for the columns;
1625  this array has n_cols
1626  elements */
1627  ulint n_foreign; /* number of foreign keys this
1628  table has, pointing to other
1629  tables (where this table is
1630  FK child) */
1631  ulint n_referenced; /* number of foreign keys other
1632  tables have, pointing to this
1633  table (where this table is
1634  parent) */
1635 };
1636 /* @} */
1637 
1638 /*********************************************************************/
1645 UNIV_INTERN
1646 dberr_t
1648 /*====================*/
1649  dict_table_schema_t* req_schema,
1651  char* errstr,
1655  size_t errstr_sz)
1656  __attribute__((nonnull, warn_unused_result));
1657 /* @} */
1658 
1659 /*********************************************************************/
1664 UNIV_INTERN
1665 void
1666 dict_fs2utf8(
1667 /*=========*/
1668  const char* db_and_table,
1670  char* db_utf8,
1671  size_t db_utf8_size,
1672  char* table_utf8,
1673  size_t table_utf8_size)
1674  __attribute__((nonnull));
1675 
1676 /**********************************************************************/
1678 UNIV_INTERN
1679 void
1680 dict_close(void);
1681 /*============*/
1682 #ifndef UNIV_HOTBACKUP
1683 /**********************************************************************/
1686 UNIV_INLINE
1687 ulint
1689 /*====================*/
1690  const dict_table_t* table)
1691  __attribute__((nonnull, warn_unused_result));
1692 
1693 /**********************************************************************/
1696 UNIV_INLINE
1697 ulint
1699 /*====================*/
1700  const dict_index_t* index)
1701  __attribute__((nonnull, warn_unused_result));
1702 
1703 #endif /* !UNIV_HOTBACKUP */
1704 /**********************************************************************/
1707 UNIV_INTERN
1708 void
1710 /*===============*/
1711  dict_index_t* index,
1712  trx_t* trx,
1713  const char* ctx)
1714  UNIV_COLD __attribute__((nonnull));
1715 
1716 /**********************************************************************/
1720 UNIV_INTERN
1721 void
1723 /*================================*/
1724  dict_index_t* index,
1725  dict_table_t* table)
1726  __attribute__((nonnull));
1727 
1728 /**********************************************************************/
1732 UNIV_INTERN
1733 ibool
1735 /*========================*/
1736  ulint space_id);
1738 /********************************************************************/
1741 UNIV_INLINE
1742 bool
1744 /*=============*/
1745  ulint flags)
1746  __attribute__((warn_unused_result));
1747 
1748 /********************************************************************/
1751 UNIV_INLINE
1752 bool
1754 /*====================*/
1755  const dict_table_t* table)
1756  __attribute__((nonnull, pure, warn_unused_result));
1757 
1758 /********************************************************************/
1761 UNIV_INLINE
1762 bool
1764 /*====================*/
1765  const dict_table_t* table)
1766  __attribute__((nonnull, pure, warn_unused_result));
1767 
1768 #ifndef UNIV_HOTBACKUP
1769 /*********************************************************************/
1772 UNIV_INTERN
1773 void
1775 /*===================*/
1776  dict_index_t* index)
1777  __attribute__((nonnull));
1778 /*********************************************************************/
1781 UNIV_INTERN
1782 void
1784 /*===================*/
1785  dict_index_t* index)
1786  __attribute__((nonnull));
1787 /*********************************************************************/
1790 UNIV_INTERN
1791 ulint
1793 /*=================================*/
1794  dict_index_t* index)
1796  __attribute__((nonnull, warn_unused_result));
1797 /*************************************************************/
1800 UNIV_INTERN
1801 const char*
1803 /*=========================*/
1804  ulint table_flag);
1806 #endif /* !UNIV_HOTBACKUP */
1807 
1808 #ifndef UNIV_NONINL
1809 #include "dict0dict.ic"
1810 #endif
1811 
1812 #endif