~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_table.cc

  • Committer: Brian Aker
  • Date: 2010-03-27 04:12:14 UTC
  • mfrom: (1395.1.18 build)
  • Revision ID: brian@gaz-20100327041214-2pm5eay51312xjvq
Merge (fixes known issues in ALTER TABLE not resetting correctly DFE).

Show diffs side-by-side

added added

removed removed

Lines of Context:
809
809
  new_engine= create_info->db_type;
810
810
 
811
811
 
812
 
  create_proto.set_schema(new_table_identifier.getSchemaName().c_str());
813
 
 
814
 
  if (new_table_identifier.isTmp())
815
 
  {
816
 
    create_proto.set_type(message::Table::TEMPORARY);
817
 
  }
818
 
  else
819
 
  {
820
 
    create_proto.set_type(message::Table::STANDARD);
821
 
  }
 
812
  create_proto.set_schema(new_table_identifier.getSchemaName());
 
813
  create_proto.set_type(new_table_identifier.getType());
822
814
 
823
815
  /**
824
816
    @todo Have a check on the table definition for FK in the future 
994
986
  */
995
987
  TableIdentifier new_table_as_temporary(original_table_identifier.getSchemaName(),
996
988
                                         tmp_name,
997
 
                                         create_proto.type() != message::Table::TEMPORARY ? INTERNAL_TMP_TABLE :
998
 
                                         TEMP_TABLE);
 
989
                                         create_proto.type() != message::Table::TEMPORARY ? message::Table::INTERNAL :
 
990
                                         message::Table::TEMPORARY);
999
991
 
1000
992
  error= create_temporary_table(session, new_table_as_temporary, create_info, create_proto, alter_info);
1001
993
 
1126
1118
    /* Should pass the 'new_name' as we store table name in the cache */
1127
1119
    if (new_table->renameAlterTemporaryTable(new_table_identifier))
1128
1120
    {
1129
 
      if (new_table)
1130
 
      {
1131
 
        /* close_temporary_table() frees the new_table pointer. */
1132
 
        session->close_temporary_table(new_table);
1133
 
      }
1134
 
      else
1135
 
      {
1136
 
        quick_rm_table(*session, new_table_as_temporary);
1137
 
      }
1138
 
 
 
1121
      session->close_temporary_table(new_table);
 
1122
 
 
1123
      return true;
 
1124
    }
 
1125
 
 
1126
    new_table_identifier.setPath(new_table_as_temporary.getPath());
 
1127
 
 
1128
    if (mysql_rename_table(new_engine, new_table_as_temporary, new_table_identifier, FN_FROM_IS_TMP) != 0)
 
1129
    {
1139
1130
      return true;
1140
1131
    }
1141
1132
  }
1191
1182
      compare_table(). Then, we need one additional call to
1192
1183
    */
1193
1184
    TableIdentifier original_table_to_drop(original_table_identifier.getSchemaName(),
1194
 
                                           old_name, TEMP_TABLE);
 
1185
                                           old_name, message::Table::TEMPORARY);
1195
1186
 
1196
1187
    if (mysql_rename_table(original_engine, original_table_identifier, original_table_to_drop, FN_TO_IS_TMP))
1197
1188
    {