List:Internals« Previous MessageNext Message »
From:Konstantin Osipov Date:September 20 2010 2:35pm
Subject:Re: question on mysql_alter_table
View as plain text  
* Zardosht Kasheff <zardosht@stripped> [10/09/20 11:31]:
> I am trying to make a change to mysql_alter_table, but I want the
> change to apply only when the table being altered is created with my
> storage engine. So, I have two different versions of mysql_alter_table
> written, one named old_mysql_alter_table, which is the current
> functionality, and the other is new_mysql_alter_table, which has my
> changes.

Maybe you could start by telling what exactly it is that you
want from ALTER that requires a completely new implementation?

> I would like to implement mysql_alter_table as such:
>     if (use_new) {
>         bool failed = new_mysql_alter_table(
>             thd,
>             new_db,
>             new_name,
>             create_info,
>             table_list,
>             alter_info,
>             order_num,
>             order,
>             ignore
>             );
>     }
>     else return old_mysql_alter_table(
>         thd,
>         new_db,
>         new_name,
>         create_info,
>         table_list,
>         alter_info,
>         order_num,
>         order,
>         ignore
>         );

> 
> I do not know how to evaluate use_new. Ideally, I would do something
> like the following:
>     ulong alter_flags= 0;
>     alter_flags= table_list->table->s->db_type() ?
> table_list->table->s->db_type()->alter_table_flags(alter_info->flags)
> : 0;
>     bool use_new = (alter_flags & HA_FLAG_THAT_ONLY_MY_ENGINE_HAS) ? true:false;
> 
> The problem is that table_list->table is not yet set, and I do not see
> how to get easily get access to the table that is about to be altered.
> 
> Any ideas on how I could solve this problem?

You can only look at the storage engine after the table is opened.
The table is opened in the beginning of mysql_alter_table().
Look for open_ltable().


-- 
Thread
question on mysql_alter_tableZardosht Kasheff20 Sep
  • Re: question on mysql_alter_tableKonstantin Osipov20 Sep
    • Re: question on mysql_alter_tableZardosht Kasheff20 Sep
  • Re: question on mysql_alter_tableZardosht Kasheff22 Sep
    • Re: question on mysql_alter_tableSergei Golubchik22 Sep
      • Re: question on mysql_alter_tableZardosht Kasheff22 Sep