~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/drop_schema.cc

  • Committer: Brian Aker
  • Date: 2010-12-19 06:20:54 UTC
  • mfrom: (2005.1.1 bug673105)
  • Revision ID: brian@tangent.org-20101219062054-1kt0l3dxs4z2z8md
Merge Dave.

Show diffs side-by-side

added added

removed removed

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