~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_index.cc

  • Committer: Lee Bieber
  • Date: 2011-01-25 17:15:03 UTC
  • mfrom: (1994.4.55 drizzle)
  • mto: This revision was merged to the branch mainline in revision 2115.
  • Revision ID: kalebral@gmail.com-20110125171503-zyx91pfdyyw9lty5
Merge Marisa - 684803: Need to update Drizzledump documentation with migration conversions / caveats
Merge Marisa - 686641: Need to document removal of multi-table update/delete from Drizzle

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>
22
 
 
23
 
#include <drizzled/show.h>
24
 
#include <drizzled/session.h>
25
 
#include <drizzled/statement/create_index.h>
26
 
#include <drizzled/statement/alter_table.h>
27
 
#include <drizzled/plugin/storage_engine.h>
 
21
#include "config.h"
 
22
#include "drizzled/show.h"
 
23
#include "drizzled/session.h"
 
24
#include "drizzled/statement/create_index.h"
 
25
#include "drizzled/statement/alter_table.h"
 
26
#include "drizzled/db.h"
28
27
 
29
28
namespace drizzled
30
29
{
38
37
    getSession()->getLex()->sql_command= SQLCOM_CREATE_INDEX;
39
38
    alter_info.flags.set(ALTER_ADD_INDEX);
40
39
    alter_info.build_method= method_arg;
41
 
    getSession()->getLex()->col_list.clear();
 
40
    getSession()->getLex()->col_list.empty();
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 *) getSession()->lex->select_lex.table_list.first;
 
46
  TableList *all_tables= getSession()->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 (plugin::StorageEngine::getTableDefinition(*getSession(), identifier, original_table_message) != EEXIST)
54
53
    {
55
54
      my_error(ER_BAD_TABLE_ERROR, identifier);
56
55
      return true;