~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_table.cc

  • Committer: Stewart Smith
  • Date: 2011-03-02 04:23:05 UTC
  • mto: (2241.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2242.
  • Revision ID: stewart@flamingspork.com-20110302042305-q6bjqjn4jq2rqmtm
remove enum_enable_or_disable which was only used for alter_info.keys_onoff. We can just use the message::AlterTable now

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
                                    Order *order,
65
65
                                    ha_rows *copied,
66
66
                                    ha_rows *deleted,
67
 
                                    enum enum_enable_or_disable keys_onoff,
 
67
                                    message::AlterTable &alter_table_message,
68
68
                                    bool error_if_not_empty);
69
69
 
70
70
static bool prepare_alter_table(Session *session,
787
787
*/
788
788
static bool alter_table_manage_keys(Session *session,
789
789
                                    Table *table, int indexes_were_disabled,
790
 
                                    enum enum_enable_or_disable keys_onoff)
 
790
                                    const message::AlterTable &alter_table_message)
791
791
{
792
792
  int error= 0;
793
 
  switch (keys_onoff) {
794
 
  case ENABLE:
 
793
  if (alter_table_message.has_alter_keys_onoff()
 
794
      && alter_table_message.alter_keys_onoff().enable())
 
795
  {
795
796
    error= table->cursor->ha_enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
796
 
    break;
797
 
  case LEAVE_AS_IS:
798
 
    if (not indexes_were_disabled)
799
 
      break;
800
 
    /* fall-through: disabled indexes */
801
 
  case DISABLE:
 
797
  }
 
798
 
 
799
  if ((! alter_table_message.has_alter_keys_onoff() && indexes_were_disabled)
 
800
      || (alter_table_message.has_alter_keys_onoff()
 
801
          && ! alter_table_message.alter_keys_onoff().enable()))
 
802
  {
802
803
    error= table->cursor->ha_disable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE);
803
804
  }
804
805
 
1122
1123
                                    order,
1123
1124
                                    &copied,
1124
1125
                                    &deleted,
1125
 
                                    alter_info->keys_onoff,
 
1126
                                    alter_table_message,
1126
1127
                                    alter_info->error_if_not_empty);
1127
1128
 
1128
1129
    /* We must not ignore bad input! */
1505
1506
                         uint32_t order_num, Order *order,
1506
1507
                         ha_rows *copied,
1507
1508
                         ha_rows *deleted,
1508
 
                         enum enum_enable_or_disable keys_onoff,
 
1509
                         message::AlterTable &alter_table_message,
1509
1510
                         bool error_if_not_empty)
1510
1511
{
1511
1512
  int error= 0;
1545
1546
    return -1;
1546
1547
 
1547
1548
  /* We need external lock before we can disable/enable keys */
1548
 
  alter_table_manage_keys(session, to, from->cursor->indexes_are_disabled(), keys_onoff);
 
1549
  alter_table_manage_keys(session, to, from->cursor->indexes_are_disabled(),
 
1550
                          alter_table_message);
1549
1551
 
1550
1552
  /* We can abort alter table for any table type */
1551
1553
  session->setAbortOnWarning(not ignore);