~drizzle-trunk/drizzle/development

641.2.2 by Monty Taylor
InnoDB Plugin 1.0.3
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., 59 Temple
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
17
*****************************************************************************/
18
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
19
/**************************************************//**
20
@file include/dict0load.h
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
21
Loads to the memory cache database object definitions
22
from dictionary tables
23
24
Created 4/24/1996 Heikki Tuuri
25
*******************************************************/
26
27
#ifndef dict0load_h
28
#define dict0load_h
29
30
#include "univ.i"
31
#include "dict0types.h"
32
#include "ut0byte.h"
33
#include "mem0mem.h"
34
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
35
/********************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
36
In a crash recovery we already have all the tablespace objects created.
37
This function compares the space id information in the InnoDB data dictionary
38
to what we already read with fil_load_single_table_tablespaces().
39
40
In a normal startup, we create the tablespace objects for every table in
41
InnoDB's data dictionary, if the corresponding .ibd file exists.
42
We also scan the biggest space id, and store it to fil_system. */
43
UNIV_INTERN
44
void
45
dict_check_tablespaces_and_store_max_id(
46
/*====================================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
47
	ibool	in_crash_recovery);	/*!< in: are we doing a crash recovery */
48
/********************************************************************//**
49
Finds the first table name in the given database.
50
@return own: table name, NULL if does not exist; the caller must free
51
the memory in the string! */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
52
UNIV_INTERN
53
char*
54
dict_get_first_table_name_in_db(
55
/*============================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
56
	const char*	name);	/*!< in: database name which ends to '/' */
57
/********************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
58
Loads a table definition and also all its index definitions, and also
59
the cluster definition if the table is a member in a cluster. Also loads
60
all foreign key constraints where the foreign key is in the table or where
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
61
a foreign key references columns in this table.
62
@return table, NULL if does not exist; if the table is stored in an
63
.ibd file, but the file does not exist, then we set the
64
ibd_file_missing flag TRUE in the table object we return */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
65
UNIV_INTERN
66
dict_table_t*
67
dict_load_table(
68
/*============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
69
	const char*	name);	/*!< in: table name in the
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
70
				databasename/tablename format */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
71
/***********************************************************************//**
72
Loads a table object based on the table id.
73
@return	table; NULL if table does not exist */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
74
UNIV_INTERN
75
dict_table_t*
76
dict_load_table_on_id(
77
/*==================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
78
	dulint	table_id);	/*!< in: table id */
79
/********************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
80
This function is called when the database is booted.
81
Loads system table index definitions except for the clustered index which
82
is added to the dictionary cache at booting before calling this function. */
83
UNIV_INTERN
84
void
85
dict_load_sys_table(
86
/*================*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
87
	dict_table_t*	table);	/*!< in: system table */
88
/***********************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
89
Loads foreign key constraints where the table is either the foreign key
90
holder or where the table is referenced by a foreign key. Adds these
91
constraints to the data dictionary. Note that we know that the dictionary
92
cache already contains all constraints where the other relevant table is
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
93
already in the dictionary cache.
94
@return	DB_SUCCESS or error code */
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
95
UNIV_INTERN
96
ulint
97
dict_load_foreigns(
98
/*===============*/
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
99
	const char*	table_name,	/*!< in: table name */
100
	ibool		check_charsets);/*!< in: TRUE=check charsets
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
101
					compatibility */
641.2.3 by Monty Taylor
InnoDB Plugin 1.0.4
102
/********************************************************************//**
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
103
Prints to the standard output information on all tables found in the data
104
dictionary system table. */
105
UNIV_INTERN
106
void
107
dict_print(void);
108
/*============*/
109
1556.1.3 by Brian Aker
First pass on a table function to see the contents of Innodb's
110
typedef void (*dict_print_callback)(void *ptr, const char *);
111
UNIV_INTERN void dict_print_with_callback(dict_print_callback, void *);
112
113
641.1.2 by Monty Taylor
Imported 1.0.1 with clean - with no changes.
114
115
#ifndef UNIV_NONINL
116
#include "dict0load.ic"
117
#endif
118
119
#endif