38
38
#include <drizzled/replication_services.h>
39
39
#include <drizzled/message/schema.pb.h>
40
40
#include "drizzled/sql_table.h"
41
#include "drizzled/plugin/storage_engine.h"
41
42
#include "drizzled/plugin/info_schema_table.h"
42
43
#include "drizzled/global_charset_info.h"
43
44
#include "drizzled/pthread_globals.h"
62
63
TableList **dropped_tables);
63
64
static void mysql_change_db_impl(Session *session, LEX_STRING *new_db_name);
66
Return default database collation.
68
@param session Thread context.
69
@param db_name Database name.
71
@return CHARSET_INFO object. The operation always return valid character
72
set, even if the database does not exist.
75
const CHARSET_INFO *get_default_db_collation(const char *db_name)
79
get_database_metadata(db_name, db);
81
/* If for some reason the db.opt file lacks a collation,
82
we just return the default */
84
if (db.has_collation())
86
const string buffer= db.collation();
87
const CHARSET_INFO* cs= get_charset_by_name(buffer.c_str());
91
errmsg_printf(ERRMSG_LVL_ERROR,
92
_("Error while loading database options: '%s':"),db_name);
93
errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_UNKNOWN_COLLATION), buffer.c_str());
95
return default_charset_info;
101
return default_charset_info;
104
66
/* path is path to database, not schema file */
105
67
static int write_schema_file(const char *path, const message::Schema &db)
910
db_default_cl= get_default_db_collation(new_db_file_name.str);
872
db_default_cl= plugin::StorageEngine::getSchemaCollation(new_db_file_name.str);
912
874
mysql_change_db_impl(session, &new_db_file_name);
913
875
free(new_db_file_name.str);