~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/statement/drop_index.cc

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
{
33
33
  TableList *first_table= (TableList *) session->lex->select_lex.table_list.first;
34
34
  TableList *all_tables= session->lex->query_tables;
 
35
 
 
36
  /* Chicken/Egg... we need to search for the table, to know if the table exists, so we can build a full identifier from it */
 
37
  message::Table original_table_message;
 
38
  {
 
39
    TableIdentifier identifier(first_table->db, first_table->table_name);
 
40
    if (plugin::StorageEngine::getTableDefinition(*session, identifier, original_table_message) != EEXIST)
 
41
    {
 
42
      my_error(ER_BAD_TABLE_ERROR, MYF(0), identifier.getSQLPath().c_str());
 
43
      return true;
 
44
    }
 
45
  }
 
46
 
35
47
  /*
36
48
     CREATE INDEX and DROP INDEX are implemented by calling ALTER
37
49
     TABLE with proper arguments.
51
63
 
52
64
  memset(&create_info, 0, sizeof(create_info));
53
65
  create_info.db_type= 0;
54
 
  create_info.row_type= ROW_TYPE_NOT_USED;
55
 
  create_info.default_table_charset= plugin::StorageEngine::getSchemaCollation(session->db.c_str());
56
 
 
57
 
  bool res= alter_table(session, 
58
 
                        first_table->db, 
59
 
                        first_table->table_name,
60
 
                        &create_info, 
61
 
                        create_table_proto, 
62
 
                        first_table,
63
 
                        &alter_info,
64
 
                        0, (order_st*) 0, 0);
 
66
 
 
67
  bool res;
 
68
  if (original_table_message.type() == message::Table::STANDARD )
 
69
  {
 
70
    TableIdentifier identifier(first_table->db, first_table->table_name);
 
71
 
 
72
    create_info.default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier);
 
73
 
 
74
    res= alter_table(session, 
 
75
                     identifier,
 
76
                     identifier,
 
77
                     &create_info, 
 
78
                     original_table_message,
 
79
                     create_table_proto, 
 
80
                     first_table,
 
81
                     &alter_info,
 
82
                     0, (order_st*) 0, 0);
 
83
  }
 
84
  else
 
85
  {
 
86
    Table *table= session->find_temporary_table(first_table);
 
87
    assert(table);
 
88
    {
 
89
      TableIdentifier identifier(first_table->db, first_table->table_name, table->s->getPath());
 
90
      create_info.default_table_charset= plugin::StorageEngine::getSchemaCollation(identifier);
 
91
 
 
92
      res= alter_table(session, 
 
93
                       identifier,
 
94
                       identifier,
 
95
                       &create_info, 
 
96
                       original_table_message,
 
97
                       create_table_proto, 
 
98
                       first_table,
 
99
                       &alter_info,
 
100
                       0, (order_st*) 0, 0);
 
101
    }
 
102
  }
65
103
  return res;
66
104
}
67
105