From: Zardosht Kasheff Date: September 22 2010 4:09am Subject: Re: question on mysql_alter_table List-Archive: http://lists.mysql.com/internals/38108 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello all, Any ideas on how to do this? I guess what I am looking for is some way to differentiate between using new_mysql_alter_table and old_mysql_alter_table. I thought one way would be to query flags of the engine of the table being altered, but if that is too complicated, perhaps some other idea works? Thoughts? Thanks -Zardosht On Mon, Sep 20, 2010 at 12:26 AM, Zardosht Kasheff wro= te: > Hello all, > > 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. > > I would like to implement mysql_alter_table as such: > =A0 =A0if (use_new) { > =A0 =A0 =A0 =A0return new_mysql_alter_table( > =A0 =A0 =A0 =A0 =A0 =A0thd, > =A0 =A0 =A0 =A0 =A0 =A0new_db, > =A0 =A0 =A0 =A0 =A0 =A0new_name, > =A0 =A0 =A0 =A0 =A0 =A0create_info, > =A0 =A0 =A0 =A0 =A0 =A0table_list, > =A0 =A0 =A0 =A0 =A0 =A0alter_info, > =A0 =A0 =A0 =A0 =A0 =A0order_num, > =A0 =A0 =A0 =A0 =A0 =A0order, > =A0 =A0 =A0 =A0 =A0 =A0ignore > =A0 =A0 =A0 =A0 =A0 =A0); > =A0 =A0} > =A0 =A0else return old_mysql_alter_table( > =A0 =A0 =A0 =A0thd, > =A0 =A0 =A0 =A0new_db, > =A0 =A0 =A0 =A0new_name, > =A0 =A0 =A0 =A0create_info, > =A0 =A0 =A0 =A0table_list, > =A0 =A0 =A0 =A0alter_info, > =A0 =A0 =A0 =A0order_num, > =A0 =A0 =A0 =A0order, > =A0 =A0 =A0 =A0ignore > =A0 =A0 =A0 =A0); > > I do not know how to evaluate use_new. Ideally, I would do something > like the following: > =A0 =A0ulong alter_flags=3D 0; > =A0 =A0alter_flags=3D table_list->table->s->db_type() ? > table_list->table->s->db_type()->alter_table_flags(alter_info->flags) > : 0; > =A0 =A0bool use_new =3D (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? > > Thanks > -Zardosht >