1#ifndef DATADICT_INCLUDED
2#define DATADICT_INCLUDED
3/* Copyright (c) 2010, Oracle and/or its affiliates.
4 Copyright (c) 2017 MariaDB corporation.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; version 2 of the License.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
18
19#include "handler.h"
20
21/*
22 Data dictionary API.
23*/
24
25enum Table_type
26{
27 TABLE_TYPE_UNKNOWN,
28 TABLE_TYPE_NORMAL, /* Normal table */
29 TABLE_TYPE_SEQUENCE,
30 TABLE_TYPE_VIEW
31};
32
33/*
34 Take extra care when using dd_frm_type() - it only checks the .frm file,
35 and it won't work for any engine that supports discovery.
36
37 Prefer to use ha_table_exists() instead.
38 To check whether it's an frm of a view, use dd_frm_is_view().
39*/
40
41enum Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name,
42 bool *is_sequence);
43
44static inline bool dd_frm_is_view(THD *thd, char *path)
45{
46 bool not_used2;
47 return dd_frm_type(thd, path, NULL, &not_used2) == TABLE_TYPE_VIEW;
48}
49
50bool dd_recreate_table(THD *thd, const char *db, const char *table_name,
51 const char *path = NULL);
52
53#endif // DATADICT_INCLUDED
54