~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/drop_schema.cc

  • Committer: Lee Bieber
  • Date: 2011-01-12 02:31:03 UTC
  • mfrom: (2068.7.5 session-fix)
  • mto: This revision was merged to the branch mainline in revision 2076.
  • Revision ID: kalebral@gmail.com-20110112023103-nmz26cv1j32jc6n3
Merge Brian - fix bug 527084 - DROP TABLE: getTableDefiniton returns EEXIST but doDropTable returns ENOENT leads to SIGSEGV

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
44
    my_error(ER_WRONG_DB_NAME, schema_identifier);
48
45
 
49
46
    return false;
50
47
  }
51
 
 
52
 
  if (getSession()->inTransaction())
 
48
  if (session->inTransaction())
53
49
  {
54
50
    my_message(ER_LOCK_OR_ACTIVE_TRANSACTION, 
55
51
        ER(ER_LOCK_OR_ACTIVE_TRANSACTION), 
60
56
  bool res = true;
61
57
  std::string path;
62
58
  schema_identifier.getSQLPath(path);
63
 
  if (unlikely(plugin::EventObserver::beforeDropDatabase(*getSession(), path))) 
 
59
  if (unlikely(plugin::EventObserver::beforeDropDatabase(*session, path))) 
64
60
  {
65
 
    my_error(ER_EVENT_OBSERVER_PLUGIN, schema_identifier);
 
61
    my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
66
62
  }
67
63
  else
68
64
  {
69
 
    res= rm_db(getSession(), schema_identifier, drop_if_exists);
70
 
    if (unlikely(plugin::EventObserver::afterDropDatabase(*getSession(), path, res)))
 
65
    res= rm_db(session, schema_identifier, drop_if_exists);
 
66
    if (unlikely(plugin::EventObserver::afterDropDatabase(*session, path, res)))
71
67
    {
72
68
      my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
73
69
      res = false;