diff options
author | bar@mysql.com <> | 2005-04-11 15:11:52 +0500 |
---|---|---|
committer | bar@mysql.com <> | 2005-04-11 15:11:52 +0500 |
commit | 71f530c4eac384cd408941416c31518b8f1bd59d (patch) | |
tree | 5ca97fe034800a82b6139eb23ea20d51dd9ac427 /sql/ha_innodb.cc | |
parent | fc0e6aa274c876fac17705d37b6d802f0e7d02e0 (diff) | |
parent | 16e186779f270bf9877938d20acdcebbee0d2e38 (diff) | |
download | mariadb-git-71f530c4eac384cd408941416c31518b8f1bd59d.tar.gz |
merge
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r-- | sql/ha_innodb.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc index cfc649a5963..5ffa9e26ea2 100644 --- a/sql/ha_innodb.cc +++ b/sql/ha_innodb.cc @@ -5380,6 +5380,32 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) DBUG_RETURN(0); } +/********************************************************************* +Checks if ALTER TABLE may change the storage engine of the table. +Changing storage engines is not allowed for tables for which there +are foreign key constraints (parent or child tables). */ + +bool +ha_innobase::can_switch_engines(void) +/*=================================*/ +{ + row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt; + bool can_switch; + + DBUG_ENTER("ha_innobase::can_switch_engines"); + prebuilt->trx->op_info = + "determining if there are foreign key constraints"; + row_mysql_lock_data_dictionary(prebuilt->trx); + + can_switch = !UT_LIST_GET_FIRST(prebuilt->table->referenced_list) + && !UT_LIST_GET_FIRST(prebuilt->table->foreign_list); + + row_mysql_unlock_data_dictionary(prebuilt->trx); + prebuilt->trx->op_info = ""; + + DBUG_RETURN(can_switch); +} + /*********************************************************************** Checks if a table is referenced by a foreign key. The MySQL manual states that a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a |