| 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 | |
| 21 | class THD; |
| 22 | |
| 23 | int mysql_create_db(THD *thd, const LEX_CSTRING *db, |
| 24 | const DDL_options_st &options, |
| 25 | const Schema_specification_st *create); |
| 26 | bool mysql_alter_db(THD *thd, const LEX_CSTRING *db, |
| 27 | const Schema_specification_st *create); |
| 28 | bool mysql_rm_db(THD *thd, const LEX_CSTRING *db, bool if_exists); |
| 29 | bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db); |
| 30 | bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, |
| 31 | bool force_switch); |
| 32 | |
| 33 | bool 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); |
| 38 | bool my_dboptions_cache_init(void); |
| 39 | void my_dboptions_cache_free(void); |
| 40 | bool check_db_dir_existence(const char *db_name); |
| 41 | bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create); |
| 42 | bool load_db_opt_by_name(THD *thd, const char *db_name, |
| 43 | Schema_specification_st *db_create_info); |
| 44 | CHARSET_INFO *get_default_db_collation(THD *thd, const char *db_name); |
| 45 | bool my_dbopt_init(void); |
| 46 | void my_dbopt_cleanup(void); |
| 47 | |
| 48 | const 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 | |