~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/drop_schema.cc

  • Committer: Brian Aker
  • Date: 2011-01-22 18:52:16 UTC
  • mfrom: (2098.4.1 catalogs)
  • Revision ID: brian@tangent.org-20110122185216-18and6vncipd7x72
Session encapsulation.

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->inTransaction())
 
37
  if (getSession()->inTransaction())
38
38
  {
39
39
    my_error(ER_TRANSACTIONAL_DDL_NOT_SUPPORTED, MYF(0));
40
40
    return true;
41
41
  }
42
42
 
43
 
  identifier::Schema schema_identifier(string(session->lex->name.str, session->lex->name.length));
 
43
  identifier::Schema schema_identifier(std::string(getSession()->lex->name.str, getSession()->lex->name.length));
44
44
 
45
 
  if (not check_db_name(session, schema_identifier))
 
45
  if (not check_db_name(getSession(), schema_identifier))
46
46
  {
47
47
    my_error(ER_WRONG_DB_NAME, schema_identifier);
48
48
 
49
49
    return false;
50
50
  }
51
51
 
52
 
  if (session->inTransaction())
 
52
  if (getSession()->inTransaction())
53
53
  {
54
54
    my_message(ER_LOCK_OR_ACTIVE_TRANSACTION, 
55
55
        ER(ER_LOCK_OR_ACTIVE_TRANSACTION), 
60
60
  bool res = true;
61
61
  std::string path;
62
62
  schema_identifier.getSQLPath(path);
63
 
  if (unlikely(plugin::EventObserver::beforeDropDatabase(*session, path))) 
 
63
  if (unlikely(plugin::EventObserver::beforeDropDatabase(*getSession(), path))) 
64
64
  {
65
65
    my_error(ER_EVENT_OBSERVER_PLUGIN, schema_identifier);
66
66
  }
67
67
  else
68
68
  {
69
 
    res= rm_db(session, schema_identifier, drop_if_exists);
70
 
    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)))
71
71
    {
72
72
      my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
73
73
      res = false;