~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_index.cc

  • Committer: patrick crews
  • Date: 2011-03-15 12:12:09 UTC
  • mfrom: (1099.4.216 drizzle)
  • Revision ID: gleebix@gmail.com-20110315121209-8g2tkf31w0rx9ter
Tags: 2011.03.12
Updated translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
CreateIndex::CreateIndex(Session *in_session, const drizzled::ha_build_method method_arg) :
36
36
  CreateTable(in_session)
37
37
  {
38
 
    getSession()->getLex()->sql_command= SQLCOM_CREATE_INDEX;
 
38
    set_command(SQLCOM_CREATE_INDEX);
39
39
    alter_info.flags.set(ALTER_ADD_INDEX);
40
40
    alter_info.build_method= method_arg;
41
 
    getSession()->getLex()->col_list.clear();
 
41
    lex().col_list.clear();
42
42
  }
43
43
 
44
44
bool statement::CreateIndex::execute()
45
45
{
46
 
  TableList *first_table= (TableList *) getSession()->getLex()->select_lex.table_list.first;
47
 
  TableList *all_tables= getSession()->getLex()->query_tables;
 
46
  TableList *first_table= (TableList *) lex().select_lex.table_list.first;
 
47
  TableList *all_tables= lex().query_tables;
48
48
 
49
49
  /* Chicken/Egg... we need to search for the table, to know if the table exists, so we can build a full identifier from it */
50
50
  message::table::shared_ptr original_table_message;
51
51
  {
52
52
    identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName());
53
 
    if (not (original_table_message= plugin::StorageEngine::getTableMessage(*getSession(), identifier)))
 
53
    if (not (original_table_message= plugin::StorageEngine::getTableMessage(session(), identifier)))
54
54
    {
55
55
      my_error(ER_BAD_TABLE_ERROR, identifier);
56
56
      return true;
67
67
  */
68
68
 
69
69
  assert(first_table == all_tables && first_table != 0);
70
 
  if (getSession()->inTransaction())
 
70
  if (session().inTransaction())
71
71
  {
72
72
    my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
73
73
    return true;
79
79
    identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName());
80
80
    create_info().default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier);
81
81
 
82
 
    res= alter_table(getSession(), 
 
82
    res= alter_table(&session(), 
83
83
                     identifier,
84
84
                     identifier,
85
85
                     &create_info(), 
92
92
  else
93
93
  {
94
94
    identifier::Table catch22(first_table->getSchemaName(), first_table->getTableName());
95
 
    Table *table= getSession()->find_temporary_table(catch22);
 
95
    Table *table= session().find_temporary_table(catch22);
96
96
    assert(table);
97
97
    {
98
98
      identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName(), table->getMutableShare()->getPath());
99
99
      create_info().default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier);
100
100
 
101
 
      res= alter_table(getSession(), 
 
101
      res= alter_table(&session(), 
102
102
                       identifier,
103
103
                       identifier,
104
104
                       &create_info(),