~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/drop_schema.cc

Big merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <drizzled/show.h>
23
23
#include <drizzled/session.h>
24
24
#include <drizzled/statement/drop_schema.h>
 
25
#include <drizzled/db.h>
 
26
 
 
27
#include <string>
 
28
 
 
29
using namespace std;
25
30
 
26
31
namespace drizzled
27
32
{
28
33
 
29
34
bool statement::DropSchema::execute()
30
35
{
 
36
  string database_name(session->lex->name.str);
 
37
  NonNormalisedDatabaseName non_normalised_database_name(database_name);
 
38
  NormalisedDatabaseName normalised_database_name(non_normalised_database_name);
 
39
 
31
40
  if (! session->endActiveTransaction())
32
41
  {
33
42
    return true;
34
43
  }
35
 
  if (check_db_name(&session->lex->name))
 
44
  if (! normalised_database_name.isValid())
36
45
  {
37
 
    my_error(ER_WRONG_DB_NAME, MYF(0), session->lex->name.str);
 
46
    my_error(ER_WRONG_DB_NAME, MYF(0),
 
47
             normalised_database_name.to_string().c_str());
38
48
    return false;
39
49
  }
40
50
  if (session->inTransaction())
44
54
        MYF(0));
45
55
    return true;
46
56
  }
47
 
  bool res= mysql_rm_db(session, session->lex->name.str, drop_if_exists);
 
57
  bool res= mysql_rm_db(session, normalised_database_name, drop_if_exists);
48
58
  return res;
49
59
}
50
60