~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/rename_table.cc

  • Committer: Monty Taylor
  • Date: 2011-02-12 21:49:59 UTC
  • mto: (2165.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110212214959-bve8sh4hu761y48m
Updated the windows build to be able to build from the command line and not to show warnings on strncpy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <config.h>
 
21
#include "config.h"
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/lock.h>
24
24
#include <drizzled/session.h>
25
25
#include <drizzled/statement/rename_table.h>
26
 
#include <drizzled/sql_table.h>
27
 
#include <drizzled/pthread_globals.h>
28
 
#include <drizzled/plugin/storage_engine.h>
 
26
#include "drizzled/sql_table.h"
 
27
#include "drizzled/pthread_globals.h"
 
28
#include "drizzled/plugin/storage_engine.h"
29
29
 
30
30
namespace drizzled
31
31
{
32
32
 
33
33
bool statement::RenameTable::execute()
34
34
{
35
 
  TableList *first_table= (TableList *) getSession()->getLex()->select_lex.table_list.first;
36
 
  TableList *all_tables= getSession()->getLex()->query_tables;
 
35
  TableList *first_table= (TableList *) getSession()->lex->select_lex.table_list.first;
 
36
  TableList *all_tables= getSession()->lex->query_tables;
37
37
  assert(first_table == all_tables && first_table != 0);
38
38
  TableList *table;
39
39
 
153
153
  }
154
154
 
155
155
  plugin::StorageEngine *engine= NULL;
156
 
  message::table::shared_ptr table_message;
 
156
  message::table::shared_ptr table_proto;
157
157
 
158
158
  identifier::Table old_identifier(ren_table->getSchemaName(), old_alias, message::Table::STANDARD);
159
159
 
160
 
  if (not (table_message= plugin::StorageEngine::getTableMessage(*getSession(), old_identifier)))
 
160
  if (plugin::StorageEngine::getTableDefinition(*getSession(), old_identifier, table_proto) != EEXIST)
161
161
  {
162
162
    my_error(ER_TABLE_UNKNOWN, old_identifier);
163
163
    return true;
164
164
  }
165
165
 
166
 
  engine= plugin::StorageEngine::findByName(*getSession(), table_message->engine().name());
 
166
  engine= plugin::StorageEngine::findByName(*getSession(), table_proto->engine().name());
167
167
 
168
168
  identifier::Table new_identifier(new_db, new_alias, message::Table::STANDARD);
169
169
  if (plugin::StorageEngine::doesTableExist(*getSession(), new_identifier))
170
170
  {
171
 
    my_error(ER_TABLE_EXISTS_ERROR, new_identifier);
 
171
    my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias);
172
172
    return 1; // This can't be skipped
173
173
  }
174
174