1 /* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License as published by
5    the Free Software Foundation; version 2 of the License.
6 
7    This program is distributed in the hope that it will be useful,
8    but WITHOUT ANY WARRANTY; without even the implied warranty of
9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10    GNU General Public License for more details.
11 
12    You should have received a copy of the GNU General Public License
13    along with this program; if not, write to the Free Software
14    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1335  USA */
15 
16 #ifndef SQL_DB_INCLUDED
17 #define SQL_DB_INCLUDED
18 
19 #include "hash.h"                               /* HASH */
20 
21 class THD;
22 
23 int mysql_create_db(THD *thd, const LEX_CSTRING *db, DDL_options_st options,
24                     const Schema_specification_st *create);
25 bool mysql_alter_db(THD *thd, const LEX_CSTRING *db,
26                     const Schema_specification_st *create);
27 bool mysql_rm_db(THD *thd, const LEX_CSTRING *db, bool if_exists);
28 bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db);
29 uint mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name,
30                      bool force_switch);
31 
32 bool mysql_opt_change_db(THD *thd,
33                          const LEX_CSTRING *new_db_name,
34                          LEX_STRING *saved_db_name,
35                          bool force_switch,
36                          bool *cur_db_changed);
37 bool my_dboptions_cache_init(void);
38 void my_dboptions_cache_free(void);
39 bool check_db_dir_existence(const char *db_name);
40 bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create);
41 bool load_db_opt_by_name(THD *thd, const char *db_name,
42                          Schema_specification_st *db_create_info);
VectorToSCFPattern__anon17d48c6b0111::VectorToSCFPattern43 CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name);
44 bool my_dbopt_init(void);
45 void my_dbopt_cleanup(void);
46 
47 const char *normalize_db_name(const char *db, char *buffer,
48                               size_t buffer_size);
49 
50 #define MY_DB_OPT_FILE "db.opt"
51 
52 #endif /* SQL_DB_INCLUDED */
53