~drizzle-developers/drizzle/elliott-release

« back to all changes in this revision

Viewing changes to drizzled/statement/drop_schema.cc

  • Committer: Patrick Crews
  • Date: 2011-02-01 20:33:06 UTC
  • mfrom: (1845.2.288 drizzle)
  • Revision ID: gleebix@gmail.com-20110201203306-mwq2rk0it81tlwxh
Merged Trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
 
35
35
bool statement::DropSchema::execute()
36
36
{
37
 
  if (! session->endActiveTransaction())
 
37
  if (getSession()->inTransaction())
38
38
  {
 
39
    my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
39
40
    return true;
40
41
  }
41
 
  identifier::Schema schema_identifier(string(session->lex->name.str, session->lex->name.length));
42
 
  if (not check_db_name(session, schema_identifier))
 
42
 
 
43
  identifier::Schema schema_identifier(std::string(getSession()->lex->name.str, getSession()->lex->name.length));
 
44
 
 
45
  if (not check_db_name(getSession(), schema_identifier))
43
46
  {
44
47
    my_error(ER_WRONG_DB_NAME, schema_identifier);
45
48
 
46
49
    return false;
47
50
  }
48
 
  if (session->inTransaction())
 
51
 
 
52
  if (getSession()->inTransaction())
49
53
  {
50
54
    my_message(ER_LOCK_OR_ACTIVE_TRANSACTION, 
51
55
        ER(ER_LOCK_OR_ACTIVE_TRANSACTION), 
56
60
  bool res = true;
57
61
  std::string path;
58
62
  schema_identifier.getSQLPath(path);
59
 
  if (unlikely(plugin::EventObserver::beforeDropDatabase(*session, path))) 
 
63
  if (unlikely(plugin::EventObserver::beforeDropDatabase(*getSession(), path))) 
60
64
  {
61
 
    my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
 
65
    my_error(ER_EVENT_OBSERVER_PLUGIN, schema_identifier);
62
66
  }
63
67
  else
64
68
  {
65
 
    res= rm_db(session, schema_identifier, drop_if_exists);
66
 
    if (unlikely(plugin::EventObserver::afterDropDatabase(*session, path, res)))
 
69
    res= rm_db(getSession(), schema_identifier, drop_if_exists);
 
70
    if (unlikely(plugin::EventObserver::afterDropDatabase(*getSession(), path, res)))
67
71
    {
68
72
      my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
69
73
      res = false;