1100.3.56
by Padraig O'Sullivan
Extracted the CREATE INDEX and DROP INDEX command into an individual class |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2009 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; either version 2 of the License, or
|
|
9 |
* (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
19 |
*/
|
|
20 |
||
1130.3.13
by Monty Taylor
Finished cleaning namespaces in drizzled/statement |
21 |
#include "drizzled/server_includes.h" |
22 |
#include "drizzled/show.h" |
|
23 |
#include "drizzled/session.h" |
|
24 |
#include "drizzled/statement/drop_index.h" |
|
25 |
#include "drizzled/statement/alter_table.h" |
|
1100.3.56
by Padraig O'Sullivan
Extracted the CREATE INDEX and DROP INDEX command into an individual class |
26 |
|
1130.3.12
by Monty Taylor
using namespace drizzled; to namespace drizzled { in statement/ |
27 |
namespace drizzled |
28 |
{
|
|
1100.3.56
by Padraig O'Sullivan
Extracted the CREATE INDEX and DROP INDEX command into an individual class |
29 |
|
1100.3.62
by Padraig O'Sullivan
Created a CreateIndex class and DropIndex class instead of a |
30 |
bool statement::DropIndex::execute() |
1100.3.56
by Padraig O'Sullivan
Extracted the CREATE INDEX and DROP INDEX command into an individual class |
31 |
{
|
32 |
TableList *first_table= (TableList *) session->lex->select_lex.table_list.first; |
|
33 |
TableList *all_tables= session->lex->query_tables; |
|
34 |
/*
|
|
1100.3.62
by Padraig O'Sullivan
Created a CreateIndex class and DropIndex class instead of a |
35 |
CREATE INDEX and DROP INDEX are implemented by calling ALTER
|
36 |
TABLE with proper arguments.
|
|
37 |
||
38 |
In the future ALTER TABLE will notice that the request is to
|
|
39 |
only add indexes and create these one by one for the existing
|
|
40 |
table without having to do a full rebuild.
|
|
41 |
*/
|
|
42 |
/* Prepare stack copies to be re-execution safe */
|
|
43 |
HA_CREATE_INFO create_info; |
|
44 |
||
45 |
assert(first_table == all_tables && first_table != 0); |
|
46 |
if (! session->endActiveTransaction()) |
|
47 |
{
|
|
48 |
return true; |
|
49 |
}
|
|
50 |
||
51 |
memset(&create_info, 0, sizeof(create_info)); |
|
52 |
create_info.db_type= 0; |
|
53 |
create_info.row_type= ROW_TYPE_NOT_USED; |
|
54 |
create_info.default_table_charset= get_default_db_collation(session->db); |
|
55 |
||
1130.3.13
by Monty Taylor
Finished cleaning namespaces in drizzled/statement |
56 |
bool res= alter_table(session, |
57 |
first_table->db, |
|
58 |
first_table->table_name, |
|
59 |
&create_info, |
|
1130.3.14
by Monty Taylor
Merged up with latest plugin-slot-reorg. |
60 |
&create_table_proto, |
1130.3.13
by Monty Taylor
Finished cleaning namespaces in drizzled/statement |
61 |
first_table, |
62 |
&alter_info, |
|
63 |
0, (order_st*) 0, 0); |
|
1100.3.62
by Padraig O'Sullivan
Created a CreateIndex class and DropIndex class instead of a |
64 |
return res; |
1100.3.56
by Padraig O'Sullivan
Extracted the CREATE INDEX and DROP INDEX command into an individual class |
65 |
}
|
1130.3.12
by Monty Taylor
using namespace drizzled; to namespace drizzled { in statement/ |
66 |
|
67 |
} /* namespace drizzled */ |