~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_schema.cc

Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include <drizzled/plugin/storage_engine.h>
26
26
#include <drizzled/schema.h>
27
27
#include <drizzled/message.h>
 
28
#include <drizzled/sql_lex.h>
28
29
 
29
30
#include <string>
30
31
 
35
36
 
36
37
bool statement::AlterSchema::execute()
37
38
{
38
 
  LEX_STRING *db= &getSession()->getLex()->name;
 
39
  LEX_STRING *db= &lex().name;
39
40
  message::schema::shared_ptr old_definition;
40
41
 
41
42
  if (not validateSchemaOptions())
43
44
 
44
45
  identifier::Schema schema_identifier(string(db->str, db->length));
45
46
 
46
 
  if (not schema::check(*getSession(), schema_identifier))
 
47
  if (not schema::check(session(), schema_identifier))
47
48
  {
48
49
    my_error(ER_WRONG_DB_NAME, schema_identifier);
49
50
 
57
58
    return true;
58
59
  }
59
60
 
60
 
  if (getSession()->inTransaction())
 
61
  if (session().inTransaction())
61
62
  {
62
63
    my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
63
64
    return true;
83
84
  
84
85
  drizzled::message::update(schema_message);
85
86
 
86
 
  bool res= schema::alter(*getSession(), schema_message, *old_definition);
 
87
  bool res= schema::alter(session(), schema_message, *old_definition);
87
88
 
88
89
  return not res;
89
90
}