~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_table.cc

  • Committer: Patrick Crews
  • Date: 2010-08-19 23:23:15 UTC
  • mfrom: (1720.1.3 build)
  • Revision ID: gleebix@gmail.com-20100819232315-xcpbkwc5vz7kjhrp
Rollup patch - stewart's show create table patch + a couple of fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
878
878
      fk_key_count++;
879
879
      if (((Foreign_key *)key)->validate(alter_info->create_list))
880
880
        return true;
 
881
 
881
882
      Foreign_key *fk_key= (Foreign_key*) key;
 
883
 
 
884
      add_foreign_key_to_table_message(&create_proto,
 
885
                                       fk_key->name.str,
 
886
                                       fk_key->columns,
 
887
                                       fk_key->ref_table,
 
888
                                       fk_key->ref_columns,
 
889
                                       fk_key->delete_opt,
 
890
                                       fk_key->update_opt,
 
891
                                       fk_key->match_opt);
 
892
 
882
893
      if (fk_key->ref_columns.elements &&
883
894
          fk_key->ref_columns.elements != fk_key->columns.elements)
884
895
      {
888
899
                 ER(ER_KEY_REF_DO_NOT_MATCH_TABLE_REF));
889
900
        return(true);
890
901
      }
891
 
 
892
 
      message::Table::ForeignKeyConstraint *pfkey= create_proto.add_fk_constraint();
893
 
      if (fk_key->name.str)
894
 
        pfkey->set_name(fk_key->name.str);
895
 
 
896
 
      pfkey->set_match(fk_key->match_opt);
897
 
      pfkey->set_update_option(fk_key->update_opt);
898
 
      pfkey->set_delete_option(fk_key->delete_opt);
899
 
 
900
 
      pfkey->set_references_table_name(fk_key->ref_table->table.str);
901
 
 
902
 
      Key_part_spec *keypart;
903
 
      List_iterator<Key_part_spec> col_it(fk_key->columns);
904
 
      while ((keypart= col_it++))
905
 
      {
906
 
        pfkey->add_column_names(keypart->field_name.str);
907
 
      }
908
 
 
909
 
      List_iterator<Key_part_spec> ref_it(fk_key->ref_columns);
910
 
      while ((keypart= ref_it++))
911
 
      {
912
 
        pfkey->add_references_columns(keypart->field_name.str);
913
 
      }
914
 
 
915
902
      continue;
916
903
    }
917
904
    (*key_count)++;