MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Konstantin Osipov Date:July 29 2009 11:57am
Subject:bzr commit into mysql-6.1-fk branch (kostja:2762) WL#148
View as plain text  
#At file:///opt/local/work/6.1-fk-stage-new/ based on revid:kostja@stripped

 2762 Konstantin Osipov	2009-07-29
      WL#148 "Foreign keys", Milestone 13 "ALTER", misc review fixes.

    modified:
      sql/fk_dd.cc
      sql/sql_class.h
=== modified file 'sql/fk_dd.cc'
--- a/sql/fk_dd.cc	2009-07-29 10:17:28 +0000
+++ b/sql/fk_dd.cc	2009-07-29 11:57:04 +0000
@@ -1835,21 +1835,22 @@ bool fk_check_constraint_added(THD *thd,
                  an error was emitted.
 */
 
-static bool
-fk_check_if_can_change_engine(THD *thd, Foreign_key_parent *fkey,
-                              TABLE_LIST *old_table, handler *new_file)
+bool
+Foreign_key_parent::
+check_if_can_change_engine(THD *thd,
+                           TABLE_LIST *old_table, handler *new_file)
 {
 
   if (!(thd->options & OPTION_NO_FOREIGN_KEY_CHECKS))
   {
     handler *old_file= old_table->table->file;
 
-    if (! fkey->is_self_reference &&
+    if (! this->is_self_reference &&
         (new_file->ha_table_flags() & HA_NO_TRANSACTIONS) !=
         (old_file->ha_table_flags() & HA_NO_TRANSACTIONS))
     {
       my_error(ER_FK_NON_TRANSACTIONAL_AND_TRANSACTIONAL, MYF(0),
-               fkey->name.str);
+               this->name.str);
       return TRUE;
     }
     /*
@@ -1858,12 +1859,12 @@ fk_check_if_can_change_engine(THD *thd, 
       what will happen if we encounter some problem in the middle of
       cascading update). So disallow it.
      */
-    if (fkey->has_cascading_action())
+    if (this->has_cascading_action())
     {
       if (new_file->ha_table_flags() & HA_NO_TRANSACTIONS)
       {
         my_error(ER_FK_NON_TRANSACTIONAL_CASCADING_ACTION, MYF(0),
-                 fkey->name.str, old_table->table_name);
+                 this->name.str, old_table->table_name);
         return TRUE;
       }
     }
@@ -1874,12 +1875,12 @@ fk_check_if_can_change_engine(THD *thd, 
       like RESTRICT for UPDATE/DELETE). Alternative is emit warning in
       this case.
     */
-    if ((fkey->update_opt == FK_OPTION_NO_ACTION ||
-         fkey->delete_opt == FK_OPTION_NO_ACTION))
+    if ((this->update_opt == FK_OPTION_NO_ACTION ||
+         this->delete_opt == FK_OPTION_NO_ACTION))
     {
       if (new_file->ha_table_flags() & HA_NO_TRANSACTIONS)
       {
-        my_error(ER_FK_NON_TRANSACTIONAL_NO_ACTION, MYF(0), fkey->name.str,
+        my_error(ER_FK_NON_TRANSACTIONAL_NO_ACTION, MYF(0), this->name.str,
                  old_table->table_name);
         return TRUE;
       }
@@ -1916,12 +1917,12 @@ fk_check_if_can_change_engine(THD *thd, 
 
   while ((fk_c= c_it++))
     if (fk_c->exists &&
-        fk_check_if_can_change_engine(thd, fk_c, old_table, new_file))
+        fk_c->check_if_can_change_engine(thd, old_table, new_file))
       return TRUE;
 
   while ((fk_p= p_it++))
     if (fk_p->exists &&
-        fk_check_if_can_change_engine(thd, fk_p, old_table, new_file))
+        fk_p->check_if_can_change_engine(thd, old_table, new_file))
       return TRUE;
 
   return FALSE;

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2009-07-28 13:21:59 +0000
+++ b/sql/sql_class.h	2009-07-29 11:57:04 +0000
@@ -304,10 +304,10 @@ enum enum_fk_option { FK_OPTION_UNDEF, F
 
 
 /**
-   Class that represents foreign key in the structures describing its
-   parent table in CREATE TABLE/ALTER TABLE statements. Contains all
-   information about foreign key which should be saved in .FRM of its
-   parent table.
+  Class that represents foreign key in the structures describing its
+  parent table in CREATE TABLE/ALTER TABLE statements. Contains all
+  information about foreign key which should be saved in .FRM of its
+  parent table.
 */
 
 class Foreign_key_parent: public Sql_alloc {
@@ -378,6 +378,8 @@ public:
              delete_opt != FK_OPTION_RESTRICT));
   }
 
+  bool check_if_can_change_engine(THD *thd, TABLE_LIST *old_table, handler
+                                  *new_file);
 protected:
   virtual uint get_match_opt_frm_length();
   virtual char get_additional_flags();


Attachment: [text/bzr-bundle] bzr/kostja@sun.com-20090729115704-6755yhu5gtwps7um.bundle
Thread
bzr commit into mysql-6.1-fk branch (kostja:2762) WL#148Konstantin Osipov29 Jul