~jaypipes/drizzle/xa-transaction-log

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_table.cc

  • Committer: Jay Pipes
  • Date: 2010-03-05 18:24:28 UTC
  • mfrom: (1273.1.51 staging)
  • Revision ID: jpipes@serialcoder-20100305182428-9m16fszbs3mvdhe0
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
                                      AlterInfo *alter_info);
69
69
 
70
70
static int create_temporary_table(Session *session,
71
 
                                  Table *table,
72
71
                                  TableIdentifier &identifier,
73
72
                                  HA_CREATE_INFO *create_info,
74
 
                                  message::Table *create_proto,
 
73
                                  message::Table &create_proto,
75
74
                                  AlterInfo *alter_info);
76
75
 
77
76
static Table *open_alter_table(Session *session, Table *table, char *db, char *table_name);
116
115
                        select_lex->db, 
117
116
                        session->lex->name.str,
118
117
                        &create_info,
119
 
                        &create_table_proto,
 
118
                        create_table_proto,
120
119
                        first_table,
121
120
                        &alter_info,
122
121
                        select_lex->order_list.elements,
678
677
                 char *new_db,
679
678
                 char *new_name,
680
679
                 HA_CREATE_INFO *create_info,
681
 
                 message::Table *create_proto,
 
680
                 message::Table &create_proto,
682
681
                 TableList *table_list,
683
682
                 AlterInfo *alter_info,
684
683
                 uint32_t order_num,
808
807
 
809
808
  if (table->s->tmp_table != STANDARD_TABLE)
810
809
  {
811
 
    create_proto->set_type(message::Table::TEMPORARY);
 
810
    create_proto.set_type(message::Table::TEMPORARY);
812
811
  }
813
812
  else
814
813
  {
815
 
    create_proto->set_type(message::Table::STANDARD);
 
814
    create_proto.set_type(message::Table::STANDARD);
816
815
  }
817
816
 
818
817
  new_db_type= create_info->db_type;
832
831
  if (create_info->row_type == ROW_TYPE_NOT_USED)
833
832
  {
834
833
    message::Table::TableOptions *table_options;
835
 
    table_options= create_proto->mutable_options();
 
834
    table_options= create_proto.mutable_options();
836
835
 
837
836
    create_info->row_type= table->s->row_type;
838
837
    table_options->set_row_type((message::Table_TableOptions_RowType)table->s->row_type);
968
967
  /* We have to do full alter table. */
969
968
  new_db_type= create_info->db_type;
970
969
 
971
 
  if (mysql_prepare_alter_table(session, table, create_info, create_proto,
 
970
  if (mysql_prepare_alter_table(session, table, create_info, &create_proto,
972
971
                                alter_info))
973
972
      goto err;
974
973
 
990
989
    */
991
990
    TableIdentifier new_table_temp(new_db,
992
991
                                   tmp_name,
993
 
                                   create_proto->type() != message::Table::TEMPORARY ? INTERNAL_TMP_TABLE :
 
992
                                   create_proto.type() != message::Table::TEMPORARY ? INTERNAL_TMP_TABLE :
994
993
                                   TEMP_TABLE);
995
994
 
996
 
    error= create_temporary_table(session, table, new_table_temp, create_info, create_proto, alter_info);
 
995
    error= create_temporary_table(session, new_table_temp, create_info, create_proto, alter_info);
997
996
 
998
997
    if (error != 0)
999
998
      goto err;
1423
1422
 
1424
1423
static int
1425
1424
create_temporary_table(Session *session,
1426
 
                       Table *table,
1427
1425
                       TableIdentifier &identifier,
1428
1426
                       HA_CREATE_INFO *create_info,
1429
 
                       message::Table *create_proto,
 
1427
                       message::Table &create_proto,
1430
1428
                       AlterInfo *alter_info)
1431
1429
{
1432
1430
  int error;
1433
 
  plugin::StorageEngine *old_db_type, *new_db_type;
1434
 
 
1435
 
  old_db_type= table->s->db_type();
1436
 
  new_db_type= create_info->db_type;
1437
1431
 
1438
1432
  /*
1439
1433
    Create a table with a temporary name.
1440
1434
    We don't log the statement, it will be logged later.
1441
1435
  */
1442
 
  create_proto->set_name(identifier.getTableName());
 
1436
  create_proto.set_name(identifier.getTableName());
1443
1437
 
1444
1438
  message::Table::StorageEngine *protoengine;
1445
 
  protoengine= create_proto->mutable_engine();
1446
 
  protoengine->set_name(new_db_type->getName());
 
1439
  protoengine= create_proto.mutable_engine();
 
1440
  protoengine->set_name(create_info->db_type->getName());
1447
1441
 
1448
1442
  error= mysql_create_table(session,
1449
1443
                            identifier,