~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/statement/create_schema.cc

[patch 003/129] Merge patch for revision 1788 from InnoDB SVN:
revno: 1788
revision-id: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:5670
parent: svn-v4:16c675df-0fcb-4bc9-8058-dcc011a37293:branches/zip:5663
committer: marko
timestamp: Wed 2009-08-12 12:16:37 +0000
message:
  branches/zip: trx_undo_rec_copy(): Add const qualifier to undo_rec.
  This is a non-functional change.
modified:
  include/trx0rec.h              2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Ftrx0rec.h
  include/trx0rec.ic             2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Finclude%2Ftrx0rec.ic
  trx/trx0rec.c                  2@16c675df-0fcb-4bc9-8058-dcc011a37293:trunk%2Ftrx%2Ftrx0rec.c
diff:
=== modified file 'include/trx0rec.h'

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
  }
45
45
 
46
46
  SchemaIdentifier schema_identifier(string(session->lex->name.str, session->lex->name.length));
47
 
  if (not check(schema_identifier))
 
47
  if (not check_db_name(session, schema_identifier))
 
48
  {
 
49
    my_error(ER_WRONG_DB_NAME, MYF(0), schema_identifier.getSQLPath().c_str());
48
50
    return false;
 
51
  }
49
52
 
50
53
  drizzled::message::init(schema_message, session->lex->name.str);
51
54
 
52
55
  bool res = false;
53
 
  std::string path;
54
 
  schema_identifier.getSQLPath(path);
55
 
 
56
 
  if (unlikely(plugin::EventObserver::beforeCreateDatabase(*session, path)))
 
56
  if (unlikely(plugin::EventObserver::beforeCreateDatabase(*session, schema_identifier.getSQLPath())))
57
57
  {
58
 
    my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
 
58
    my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), schema_identifier.getSQLPath().c_str());
59
59
  }
60
60
  else
61
61
  {
62
62
    res= mysql_create_db(session, schema_message, is_if_not_exists);
63
 
    if (unlikely(plugin::EventObserver::afterCreateDatabase(*session, path, res)))
 
63
    if (unlikely(plugin::EventObserver::afterCreateDatabase(*session, schema_identifier.getSQLPath(), res)))
64
64
    {
65
 
      my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), path.c_str());
 
65
      my_error(ER_EVENT_OBSERVER_PLUGIN, MYF(0), schema_identifier.getSQLPath().c_str());
66
66
      res = false;
67
67
    }
68
68
 
71
71
  return not res;
72
72
}
73
73
 
74
 
bool statement::CreateSchema::check(const SchemaIdentifier &identifier)
75
 
{
76
 
  if (not identifier.isValid())
77
 
    return false;
78
 
 
79
 
  if (not plugin::Authorization::isAuthorized(getSession()->getSecurityContext(), identifier))
80
 
    return false;
81
 
 
82
 
  if (not is_if_not_exists)
83
 
  {
84
 
    if (plugin::StorageEngine::doesSchemaExist(identifier))
85
 
    {
86
 
      std::string name;
87
 
 
88
 
      identifier.getSQLPath(name);
89
 
      my_error(ER_DB_CREATE_EXISTS, MYF(0), name.c_str());
90
 
 
91
 
      return false;
92
 
    }
93
 
  }
94
 
 
95
 
  return true;
96
 
}
97
 
 
98
74
// We don't actually test anything at this point, we assume it is all bad.
99
75
bool statement::CreateSchema::validateSchemaOptions()
100
76
{