~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_table.cc

  • Committer: Brian Aker
  • Date: 2010-10-24 01:34:39 UTC
  • mto: This revision was merged to the branch mainline in revision 1875.
  • Revision ID: brian@tangent.org-20101024013439-w9r8qtmt5ihnqtkd
Encapsulate table_name from table_list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
  /* Chicken/Egg... we need to search for the table, to know if the table exists, so we can build a full identifier from it */
108
108
  message::Table original_table_message;
109
109
  {
110
 
    TableIdentifier identifier(first_table->getSchemaName(), first_table->table_name);
 
110
    TableIdentifier identifier(first_table->getSchemaName(), first_table->getTableName());
111
111
    if (plugin::StorageEngine::getTableDefinition(*session, identifier, original_table_message) != EEXIST)
112
112
    {
113
113
      my_error(ER_BAD_TABLE_ERROR, MYF(0), identifier.getSQLPath().c_str());
146
146
  bool res;
147
147
  if (original_table_message.type() == message::Table::STANDARD )
148
148
  {
149
 
    TableIdentifier identifier(first_table->getSchemaName(), first_table->table_name);
 
149
    TableIdentifier identifier(first_table->getSchemaName(), first_table->getTableName());
150
150
    TableIdentifier new_identifier(select_lex->db ? select_lex->db : first_table->getSchemaName(),
151
 
                                   session->lex->name.str ? session->lex->name.str : first_table->table_name);
 
151
                                   session->lex->name.str ? session->lex->name.str : first_table->getTableName());
152
152
 
153
153
    res= alter_table(session, 
154
154
                     identifier,
164
164
  }
165
165
  else
166
166
  {
167
 
    TableIdentifier catch22(first_table->getSchemaName(), first_table->table_name);
 
167
    TableIdentifier catch22(first_table->getSchemaName(), first_table->getTableName());
168
168
    Table *table= session->find_temporary_table(catch22);
169
169
    assert(table);
170
170
    {
171
 
      TableIdentifier identifier(first_table->getSchemaName(), first_table->table_name, table->getMutableShare()->getPath());
 
171
      TableIdentifier identifier(first_table->getSchemaName(), first_table->getTableName(), table->getMutableShare()->getPath());
172
172
      TableIdentifier new_identifier(select_lex->db ? select_lex->db : first_table->getSchemaName(),
173
 
                                     session->lex->name.str ? session->lex->name.str : first_table->table_name,
 
173
                                     session->lex->name.str ? session->lex->name.str : first_table->getTableName(),
174
174
                                     table->getMutableShare()->getPath());
175
175
 
176
176
      res= alter_table(session, 
1498
1498
 
1499
1499
      memset(&tables, 0, sizeof(tables));
1500
1500
      tables.table= from;
1501
 
      tables.alias= tables.table_name= const_cast<char *>(from->getMutableShare()->getTableName());
 
1501
      tables.setTableName(const_cast<char *>(from->getMutableShare()->getTableName()));
 
1502
      tables.alias= const_cast<char *>(tables.getTableName());
1502
1503
      tables.setSchemaName(const_cast<char *>(from->getMutableShare()->getSchemaName()));
1503
1504
      error= 1;
1504
1505
 
1637
1638
    TableList tbl;
1638
1639
    tbl.setSchemaName(const_cast<char *>(identifier.getSchemaName().c_str()));
1639
1640
    tbl.alias= const_cast<char *>(identifier.getTableName().c_str());
1640
 
    tbl.table_name= const_cast<char *>(identifier.getTableName().c_str());
 
1641
    tbl.setTableName(const_cast<char *>(identifier.getTableName().c_str()));
1641
1642
 
1642
1643
    /* Table is in session->temporary_tables */
1643
1644
    new_table= session->openTable(&tbl, (bool*) 0, DRIZZLE_LOCK_IGNORE_FLUSH);