~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_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/create_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::CreateSchema::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
 
 
40
 
31
41
  if (! session->endActiveTransaction())
32
42
  {
33
43
    return true;
34
44
  }
35
 
  char *alias= session->strmake(session->lex->name.str,
36
 
                                session->lex->name.length);
37
 
  if (! alias ||
38
 
      check_db_name(&session->lex->name))
 
45
  if (! session->lex->name.str ||
 
46
      ! normalised_database_name.isValid())
39
47
  {
40
48
    my_error(ER_WRONG_DB_NAME, MYF(0), session->lex->name.str);
41
49
    return false;
42
50
  }
43
 
  bool res= mysql_create_db(session, session->lex->name.str, &create_info, is_if_not_exists);
 
51
  bool res= mysql_create_db(session, normalised_database_name, &schema_message, is_if_not_exists);
44
52
  return res;
45
53
}
46
54