~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:44:25 UTC
  • mfrom: (1874.1.2 catalogs)
  • Revision ID: brian@tangent.org-20101024014425-exsst7015tqgbw7x
TableĀ encapsulateĀ merge.

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->db, 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->db, first_table->table_name);
150
 
    TableIdentifier new_identifier(select_lex->db ? select_lex->db : first_table->db,
151
 
                                   session->lex->name.str ? session->lex->name.str : first_table->table_name);
 
149
    TableIdentifier identifier(first_table->getSchemaName(), first_table->getTableName());
 
150
    TableIdentifier new_identifier(select_lex->db ? select_lex->db : first_table->getSchemaName(),
 
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->db, 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->db, first_table->table_name, table->getMutableShare()->getPath());
172
 
      TableIdentifier new_identifier(select_lex->db ? select_lex->db : first_table->db,
173
 
                                     session->lex->name.str ? session->lex->name.str : first_table->table_name,
 
171
      TableIdentifier identifier(first_table->getSchemaName(), first_table->getTableName(), table->getMutableShare()->getPath());
 
172
      TableIdentifier new_identifier(select_lex->db ? select_lex->db : first_table->getSchemaName(),
 
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());
1502
 
      tables.db= const_cast<char *>(from->getMutableShare()->getSchemaName());
 
1501
      tables.setTableName(const_cast<char *>(from->getMutableShare()->getTableName()));
 
1502
      tables.alias= const_cast<char *>(tables.getTableName());
 
1503
      tables.setSchemaName(const_cast<char *>(from->getMutableShare()->getSchemaName()));
1503
1504
      error= 1;
1504
1505
 
1505
1506
      if (session->lex->select_lex.setup_ref_array(session, order_num) ||
1635
1636
  if (table->getShare()->getType())
1636
1637
  {
1637
1638
    TableList tbl;
1638
 
    tbl.db= const_cast<char *>(identifier.getSchemaName().c_str());
 
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);