This is a pre-requisite task for:
MDEV-5359 CREATE OR REPLACE, CREATE IF NOT EXISTS, DROP IF EXISTS
- DDL options like IF EXISTS and IF NOT EXISTS that are processed before passing information to the handler (for table creation) and are not needed for the handler itself.
- Schema specifications (e.g. default character set). This part is needed as a standalone structure, because it is passed to mysql_create_db and mysql_rm_db who don't need the rest of HA_CREATE_INFO. Currently the entire HA_CREATE_INFO is initialized before passing to the schema DDL routines. Also, this part is enough for mysqld_show_create_db. Currently the entire HA_CREATE_INFO is passed again.
So these two parts should be moved out of HA_CREATE_INFO.
Proposed new structure hierarchy:
1. DDL_options_st, to store IF EXISTS, IF NOT EXISTS
This will be shared between all DDL routines (e.g. CREATE TABLE, DROP SCHEMA, etc).
This will be passed to mysql_create_db, mysql_drop_db, mysqld_show_create_db
3. Table_contents_source_st, contains everything the old HA_CREATE_INFO had but without DDL options and without Schema_specification_st
4. HA_CREATE_INFO= Table_contents_source_st + Schema_specification_st
This will be passed to handlers
5. Table_specification_st= HA_CREATE_INFO + DDL_options_st
This will be passed to mysql_create_table.
Also, API for some functions has to be changed:
- SCHEMA routines: mysql_create_db, mysql_drop_db
- TABLE routines: mysql_create_table, mysql_drop_table
and some others. The new structures will now be passed instead of HA_CREATE_INFO