~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/drop_schema.cc

Separated BlitzCursor code out to it's own file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/statement/drop_schema.h>
25
25
#include <drizzled/db.h>
26
 
#include <drizzled/plugin/event_observer.h>
27
26
 
28
27
#include <string>
29
28
 
39
38
    return true;
40
39
  }
41
40
  SchemaIdentifier schema_identifier(string(session->lex->name.str, session->lex->name.length));
42
 
  if (not check_db_name(session, schema_identifier))
 
41
  if (not check_db_name(schema_identifier))
43
42
  {
44
 
    std::string path;
45
 
    schema_identifier.getSQLPath(path);
46
 
 
47
 
    my_error(ER_WRONG_DB_NAME, MYF(0), path.c_str());
 
43
    my_error(ER_WRONG_DB_NAME, MYF(0), schema_identifier.getSQLPath().c_str());
48
44
    return false;
49
45
  }
50
46
  if (session->inTransaction())
54
50
        MYF(0));
55
51
    return true;
56
52
  }
57
 
  
58
 
  bool res = true;
59
 
  std::string path;
60
 
  schema_identifier.getSQLPath(path);
61
 
  if (unlikely(plugin::EventObserver::beforeDropDatabase(*session, path))) 
62
 
  {
63
 
    my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
64
 
  }
65
 
  else
66
 
  {
67
 
    res= mysql_rm_db(session, schema_identifier, drop_if_exists);
68
 
    if (unlikely(plugin::EventObserver::afterDropDatabase(*session, path, res)))
69
 
    {
70
 
      my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
71
 
      res = false;
72
 
    }
73
 
 
74
 
  }
 
53
  bool res= mysql_rm_db(session, schema_identifier, drop_if_exists);
75
54
 
76
55
  return res;
77
56
}