mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Implementing pre_create option test and setting of default values.
Currently, only TABLE_TYPE is tested, and if wrong or unspecified, is replaced by the default value DOS. - Test on type was moved from create to pre_create - pre_create is now called unconditionally and must return true on error and false otherwise. - Warnings are produced if the table type was changed. - The errors have specific error messages (instead of being warnings with an error message telling that a table must have columns) Modified: ha_connect.cc ha_connect.h handler.h sql_table.cc
This commit is contained in:
@ -4134,7 +4134,6 @@ bool mysql_create_table_no_lock(THD *thd,
|
||||
db, table_name, internal_tmp_table));
|
||||
|
||||
|
||||
/* Check for duplicate fields and check type of table to create */
|
||||
if (check_engine(thd, db, table_name, create_info))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
@ -4152,6 +4151,17 @@ bool mysql_create_table_no_lock(THD *thd,
|
||||
mem_alloc_error(sizeof(handler));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
/* Let handlers test and update create table definition. */
|
||||
if (file->pre_create(thd, create_info, alter_info))
|
||||
DBUG_RETURN(TRUE); // Error message was created in pre_create
|
||||
|
||||
/* Check for duplicate fields and check type of table to create */
|
||||
if (!alter_info->create_list.elements)
|
||||
{
|
||||
my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
|
||||
MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
partition_info *part_info= thd->work_part_info;
|
||||
|
||||
@ -4314,14 +4324,6 @@ bool mysql_create_table_no_lock(THD *thd,
|
||||
}
|
||||
#endif
|
||||
|
||||
// Added by O. Bertrand
|
||||
if (!alter_info->create_list.elements &&
|
||||
file->pre_create(thd, create_info, alter_info))
|
||||
{
|
||||
my_message(ER_TABLE_MUST_HAVE_COLUMNS, ER(ER_TABLE_MUST_HAVE_COLUMNS),
|
||||
MYF(0));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (mysql_prepare_create_table(thd, create_info, alter_info,
|
||||
internal_tmp_table,
|
||||
&db_options, file,
|
||||
|
Reference in New Issue
Block a user