~barry-leslie/drizzle/drizzle_pbmsV2

« back to all changes in this revision

Viewing changes to drizzled/statement/create_index.cc

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2011-04-04 14:40:45 UTC
  • mfrom: (1919.2.344 build)
  • Revision ID: barry.leslie@primebase.com-20110404144045-etbtnq340cgy2dw3
MergedĀ inĀ lp:drizzle.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
namespace statement
33
33
{
34
34
 
35
 
CreateIndex::CreateIndex(Session *in_session, const drizzled::ha_build_method method_arg) :
 
35
CreateIndex::CreateIndex(Session *in_session) :
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
 
    alter_info.build_method= method_arg;
41
 
    getSession()->getLex()->col_list.clear();
 
40
    lex().col_list.clear();
42
41
  }
43
42
 
44
43
bool statement::CreateIndex::execute()
45
44
{
46
 
  TableList *first_table= (TableList *) getSession()->getLex()->select_lex.table_list.first;
47
 
  TableList *all_tables= getSession()->getLex()->query_tables;
 
45
  TableList *first_table= (TableList *) lex().select_lex.table_list.first;
 
46
  TableList *all_tables= lex().query_tables;
48
47
 
49
48
  /* 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
49
  message::table::shared_ptr original_table_message;
51
50
  {
52
51
    identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName());
53
 
    if (not (original_table_message= plugin::StorageEngine::getTableMessage(*getSession(), identifier)))
 
52
    if (not (original_table_message= plugin::StorageEngine::getTableMessage(session(), identifier)))
54
53
    {
55
54
      my_error(ER_BAD_TABLE_ERROR, identifier);
56
55
      return true;
67
66
  */
68
67
 
69
68
  assert(first_table == all_tables && first_table != 0);
70
 
  if (getSession()->inTransaction())
 
69
  if (session().inTransaction())
71
70
  {
72
71
    my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
73
72
    return true;
79
78
    identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName());
80
79
    create_info().default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier);
81
80
 
82
 
    res= alter_table(getSession(), 
 
81
    res= alter_table(&session(), 
83
82
                     identifier,
84
83
                     identifier,
85
84
                     &create_info(), 
92
91
  else
93
92
  {
94
93
    identifier::Table catch22(first_table->getSchemaName(), first_table->getTableName());
95
 
    Table *table= getSession()->find_temporary_table(catch22);
 
94
    Table *table= session().find_temporary_table(catch22);
96
95
    assert(table);
97
96
    {
98
97
      identifier::Table identifier(first_table->getSchemaName(), first_table->getTableName(), table->getMutableShare()->getPath());
99
98
      create_info().default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier);
100
99
 
101
 
      res= alter_table(getSession(), 
 
100
      res= alter_table(&session(), 
102
101
                       identifier,
103
102
                       identifier,
104
103
                       &create_info(),