~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_schema.cc

  • Committer: Tim Penhey
  • Date: 2010-01-20 02:39:01 UTC
  • mto: This revision was merged to the branch mainline in revision 1275.
  • Revision ID: tim.penhey@canonical.com-20100120023901-8teeunid6gwlthzx
Add in a rot 13 function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
bool statement::CreateSchema::execute()
35
35
{
36
 
  if (not session->endActiveTransaction())
 
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
 
 
41
  if (! session->endActiveTransaction())
37
42
  {
38
43
    return true;
39
44
  }
40
 
 
41
 
  SchemaIdentifier schema_identifier(string(session->lex->name.str, session->lex->name.length));
42
 
  if (not check_db_name(schema_identifier))
 
45
  if (! session->lex->name.str ||
 
46
      ! normalised_database_name.isValid())
43
47
  {
44
 
    my_error(ER_WRONG_DB_NAME, MYF(0), schema_identifier.getSQLPath().c_str());
 
48
    my_error(ER_WRONG_DB_NAME, MYF(0), session->lex->name.str);
45
49
    return false;
46
50
  }
47
 
 
48
 
  schema_message.set_name(session->lex->name.str);
49
 
  if (not schema_message.has_collation())
50
 
  {
51
 
    schema_message.set_collation(default_charset_info->name);
52
 
  }
53
 
 
54
 
  bool res= mysql_create_db(session, schema_message, is_if_not_exists);
55
 
  return not res;
 
51
  bool res= mysql_create_db(session, normalised_database_name, &schema_message, is_if_not_exists);
 
52
  return res;
56
53
}
57
54
 
58
55
} /* namespace drizzled */