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-1335  USA */
18 
19 #include "handler.h"
20 
21 /*
22   Data dictionary API.
23 */
24 
25 enum 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 
41 enum Table_type dd_frm_type(THD *thd, char *path, LEX_CSTRING *engine_name);
42 
dd_frm_is_view(THD * thd,char * path)43 static inline bool dd_frm_is_view(THD *thd, char *path)
44 {
45   return dd_frm_type(thd, path, NULL) == TABLE_TYPE_VIEW;
46 }
47 
48 bool dd_recreate_table(THD *thd, const char *db, const char *table_name);
49 
50 #endif // DATADICT_INCLUDED
51