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-1301 USA */
15
16#ifndef SQL_DB_INCLUDED
17#define SQL_DB_INCLUDED
18
19#include "hash.h" /* HASH */
20
21class THD;
22
23int mysql_create_db(THD *thd, const LEX_CSTRING *db,
24 const DDL_options_st &options,
25 const Schema_specification_st *create);
26bool mysql_alter_db(THD *thd, const LEX_CSTRING *db,
27 const Schema_specification_st *create);
28bool mysql_rm_db(THD *thd, const LEX_CSTRING *db, bool if_exists);
29bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db);
30bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name,
31 bool force_switch);
32
33bool mysql_opt_change_db(THD *thd,
34 const LEX_CSTRING *new_db_name,
35 LEX_STRING *saved_db_name,
36 bool force_switch,
37 bool *cur_db_changed);
38bool my_dboptions_cache_init(void);
39void my_dboptions_cache_free(void);
40bool check_db_dir_existence(const char *db_name);
41bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create);
42bool load_db_opt_by_name(THD *thd, const char *db_name,
43 Schema_specification_st *db_create_info);
44CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name);
45bool my_dbopt_init(void);
46void my_dbopt_cleanup(void);
47
48const char *normalize_db_name(const char *db, char *buffer,
49 size_t buffer_size);
50
51#define MY_DB_OPT_FILE "db.opt"
52
53#endif /* SQL_DB_INCLUDED */
54