mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0
into dl145b.mysql.com:/home/ndbdev/tomas/mysql-5.1
This commit is contained in:
@ -39,6 +39,8 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
|
||||
uint order_num, ORDER *order,
|
||||
ha_rows *copied,ha_rows *deleted);
|
||||
static bool prepare_blob_field(THD *thd, create_field *sql_field);
|
||||
static bool check_engine(THD *thd, const char *table_name,
|
||||
enum db_type *new_engine);
|
||||
|
||||
|
||||
/*
|
||||
@ -268,7 +270,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
else
|
||||
{
|
||||
char *end;
|
||||
db_type table_type= get_table_type(path);
|
||||
db_type table_type= get_table_type(thd, path);
|
||||
*(end=fn_ext(path))=0; // Remove extension for delete
|
||||
error= ha_delete_table(thd, table_type, path, table->table_name,
|
||||
!dont_log_query);
|
||||
@ -1490,7 +1492,6 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
KEY *key_info_buffer;
|
||||
handler *file;
|
||||
bool error= TRUE;
|
||||
enum db_type new_db_type;
|
||||
DBUG_ENTER("mysql_create_table");
|
||||
|
||||
/* Check for duplicate fields and check type of table to create */
|
||||
@ -1500,16 +1501,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
|
||||
MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if ((new_db_type= ha_checktype(create_info->db_type)) !=
|
||||
create_info->db_type)
|
||||
{
|
||||
create_info->db_type= new_db_type;
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WARN_USING_OTHER_HANDLER,
|
||||
ER(ER_WARN_USING_OTHER_HANDLER),
|
||||
ha_get_storage_engine(new_db_type),
|
||||
table_name);
|
||||
}
|
||||
if (check_engine(thd, table_name, &create_info->db_type))
|
||||
DBUG_RETURN(TRUE);
|
||||
db_options= create_info->table_options;
|
||||
if (create_info->row_type == ROW_TYPE_DYNAMIC)
|
||||
db_options|=HA_OPTION_PACK_RECORD;
|
||||
@ -3126,16 +3119,9 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
old_db_type= table->s->db_type;
|
||||
if (create_info->db_type == DB_TYPE_DEFAULT)
|
||||
create_info->db_type= old_db_type;
|
||||
if ((new_db_type= ha_checktype(create_info->db_type)) !=
|
||||
create_info->db_type)
|
||||
{
|
||||
create_info->db_type= new_db_type;
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WARN_USING_OTHER_HANDLER,
|
||||
ER(ER_WARN_USING_OTHER_HANDLER),
|
||||
ha_get_storage_engine(new_db_type),
|
||||
new_name);
|
||||
}
|
||||
if (check_engine(thd, new_name, &create_info->db_type))
|
||||
DBUG_RETURN(TRUE);
|
||||
new_db_type= create_info->db_type;
|
||||
if (create_info->row_type == ROW_TYPE_NOT_USED)
|
||||
create_info->row_type= table->s->row_type;
|
||||
|
||||
@ -4135,3 +4121,24 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
|
||||
table->table=0;
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
static bool check_engine(THD *thd, const char *table_name,
|
||||
enum db_type *new_engine)
|
||||
{
|
||||
enum db_type req_engine= *new_engine;
|
||||
bool no_substitution=
|
||||
test(thd->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION);
|
||||
if ((*new_engine=
|
||||
ha_checktype(thd, req_engine, no_substitution, 1)) == DB_TYPE_UNKNOWN)
|
||||
return TRUE;
|
||||
|
||||
if (req_engine != *new_engine)
|
||||
{
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_WARN_USING_OTHER_HANDLER,
|
||||
ER(ER_WARN_USING_OTHER_HANDLER),
|
||||
ha_get_storage_engine(*new_engine),
|
||||
table_name);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user