1 /* Copyright (c) 2006, 2011, 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, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 #ifndef SQL_DB_INCLUDED
24 #define SQL_DB_INCLUDED
25 
26 #include "hash.h"                               /* HASH */
27 
28 class THD;
29 typedef struct charset_info_st CHARSET_INFO;
30 typedef struct st_ha_create_information HA_CREATE_INFO;
31 typedef struct st_mysql_lex_string LEX_STRING;
32 
33 int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
34 bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
35 bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
36 bool mysql_upgrade_db(THD *thd, LEX_STRING *old_db);
37 bool mysql_change_db(THD *thd, const LEX_STRING *new_db_name,
38                      bool force_switch);
39 
40 bool mysql_opt_change_db(THD *thd,
41                          const LEX_STRING *new_db_name,
42                          LEX_STRING *saved_db_name,
43                          bool force_switch,
44                          bool *cur_db_changed);
45 bool my_dboptions_cache_init(void);
46 void my_dboptions_cache_free(void);
47 bool check_db_dir_existence(const char *db_name);
48 bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create);
49 bool load_db_opt_by_name(THD *thd, const char *db_name,
50                          HA_CREATE_INFO *db_create_info);
51 const CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name);
52 bool my_dbopt_init(void);
53 void my_dbopt_cleanup(void);
54 
55 #define MY_DB_OPT_FILE "db.opt"
56 
57 #endif /* SQL_DB_INCLUDED */
58