1 /*****************************************************************************
2 
3 Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License, version 2.0,
7 as published by the Free Software Foundation.
8 
9 This program is also distributed with certain software (including
10 but not limited to OpenSSL) that is licensed under separate terms,
11 as designated in a particular file or component or in included license
12 documentation.  The authors of MySQL hereby grant you an additional
13 permission to link the program and your derivative works with the
14 separately licensed software that they have included with MySQL.
15 
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 GNU General Public License, version 2.0, for more details.
20 
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
24 
25 *****************************************************************************/
26 
27 /**************************************************//**
28 @file include/row0import.h
29 Header file for import tablespace functions.
30 
31 Created 2012-02-08 by Sunny Bains
32 *******************************************************/
33 
34 #ifndef row0import_h
35 #define row0import_h
36 
37 #include "univ.i"
38 #include "db0err.h"
39 #include "dict0types.h"
40 
41 // Forward declarations
42 struct trx_t;
43 struct dict_table_t;
44 struct row_prebuilt_t;
45 
46 /*****************************************************************//**
47 Imports a tablespace. The space id in the .ibd file must match the space id
48 of the table in the data dictionary.
49 @return	error code or DB_SUCCESS */
50 UNIV_INTERN
51 dberr_t
52 row_import_for_mysql(
53 /*=================*/
54 	dict_table_t*	table,		/*!< in/out: table */
55 	row_prebuilt_t*	prebuilt)	/*!< in: prebuilt struct
56 						in MySQL */
57 	MY_ATTRIBUTE((nonnull, warn_unused_result));
58 
59 /*****************************************************************//**
60 Update the DICT_TF2_DISCARDED flag in SYS_TABLES.
61 @return DB_SUCCESS or error code. */
62 UNIV_INTERN
63 dberr_t
64 row_import_update_discarded_flag(
65 /*=============================*/
66 	trx_t*		trx,			/*!< in/out: transaction that
67 						covers the update */
68 	table_id_t	table_id,		/*!< in: Table for which we want
69 						to set the root table->flags2 */
70 	bool		discarded,		/*!< in: set MIX_LEN column bit
71 						to discarded, if true */
72 	bool		dict_locked)		/*!< in: Set to true if the
73 						caller already owns the
74 						dict_sys_t:: mutex. */
75 	MY_ATTRIBUTE((nonnull, warn_unused_result));
76 
77 /*****************************************************************//**
78 Update the (space, root page) of a table's indexes from the values
79 in the data dictionary.
80 @return DB_SUCCESS or error code */
81 UNIV_INTERN
82 dberr_t
83 row_import_update_index_root(
84 /*=========================*/
85 	trx_t*			trx,		/*!< in/out: transaction that
86 						covers the update */
87 	const dict_table_t*	table,		/*!< in: Table for which we want
88 						to set the root page_no */
89 	bool			reset,		/*!< in: if true then set to
90 						FIL_NUL */
91 	bool			dict_locked)	/*!< in: Set to true if the
92 						caller already owns the
93 						dict_sys_t:: mutex. */
94 	MY_ATTRIBUTE((nonnull, warn_unused_result));
95 #ifndef UNIV_NONINL
96 #include "row0import.ic"
97 #endif
98 
99 #endif /* row0import_h */
100