~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to drizzled/statement/alter_schema.cc

  • Committer: Padraig O'Sullivan
  • Date: 2010-03-15 14:05:26 UTC
  • mfrom: (1237.9.99 staging)
  • Revision ID: osullivan.padraig@gmail.com-20100315140526-opbgwdwn6tfecdkq
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/statement/alter_schema.h>
 
25
#include <drizzled/plugin/storage_engine.h>
25
26
#include <drizzled/db.h>
26
27
 
27
28
#include <string>
34
35
bool statement::AlterSchema::execute()
35
36
{
36
37
  LEX_STRING *db= &session->lex->name;
 
38
  message::Schema old_definition;
37
39
 
38
40
  if (check_db_name(db))
39
41
  {
41
43
    return false;
42
44
  }
43
45
 
 
46
  schema_message.set_name(db->str);
 
47
 
 
48
  if (not plugin::StorageEngine::getSchemaDefinition(schema_message.name(), old_definition))
 
49
  {
 
50
    my_error(ER_SCHEMA_DOES_NOT_EXIST, MYF(0), db->str);
 
51
    return true;
 
52
  }
 
53
 
44
54
  if (session->inTransaction())
45
55
  {
46
56
    my_message(ER_LOCK_OR_ACTIVE_TRANSACTION, 
49
59
    return true;
50
60
  }
51
61
 
52
 
  bool res= mysql_alter_db(session, db->str, &schema_message);
53
 
 
54
 
  return res;
 
62
  if (not schema_message.has_collation())
 
63
  {
 
64
    schema_message.set_collation(schema_message.collation());
 
65
  }
 
66
 
 
67
  bool res= mysql_alter_db(session, schema_message);
 
68
 
 
69
  return not res;
55
70
}
56
71
 
57
72
} /* namespace drizzled */