~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/schema_engine.cc

updating to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
  std::for_each(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
59
59
           AddSchemaNames(schemas));
60
60
 
61
 
  plugin::Authorization::pruneSchemaNames(session.user(), schemas);
 
61
  plugin::Authorization::pruneSchemaNames(*session.user(), schemas);
62
62
}
63
63
 
64
64
class StorageEngineGetSchemaDefinition: public std::unary_function<StorageEngine *, bool>
76
76
 
77
77
  result_type operator() (argument_type engine)
78
78
  {
79
 
    return engine->doGetSchemaDefinition(identifier, schema_proto);
 
79
    schema_proto= engine->doGetSchemaDefinition(identifier);
 
80
    return schema_proto;
80
81
  }
81
82
};
82
83
 
83
84
/*
84
85
  Return value is "if parsed"
85
86
*/
86
 
bool StorageEngine::getSchemaDefinition(const drizzled::identifier::Table &identifier, message::schema::shared_ptr &proto)
 
87
message::schema::shared_ptr StorageEngine::getSchemaDefinition(const drizzled::identifier::Table &identifier)
87
88
{
88
 
  return StorageEngine::getSchemaDefinition(identifier, proto);
 
89
  return StorageEngine::getSchemaDefinition(identifier);
89
90
}
90
91
 
91
 
bool StorageEngine::getSchemaDefinition(const identifier::Schema &identifier, message::schema::shared_ptr &proto)
 
92
message::schema::shared_ptr StorageEngine::getSchemaDefinition(const identifier::Schema &identifier)
92
93
{
 
94
  message::schema::shared_ptr proto;
 
95
 
93
96
  EngineVector::iterator iter=
94
97
    std::find_if(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
95
98
                 StorageEngineGetSchemaDefinition(identifier, proto));
96
99
 
97
100
  if (iter != StorageEngine::getSchemaEngines().end())
98
101
  {
99
 
    return true;
 
102
    return proto;
100
103
  }
101
104
 
102
 
  return false;
 
105
  return message::schema::shared_ptr();
103
106
}
104
107
 
105
108
bool StorageEngine::doesSchemaExist(const identifier::Schema &identifier)
106
109
{
107
110
  message::schema::shared_ptr proto;
108
111
 
109
 
  return StorageEngine::getSchemaDefinition(identifier, proto);
 
112
  return StorageEngine::getSchemaDefinition(identifier);
110
113
}
111
114
 
112
115
 
113
116
const CHARSET_INFO *StorageEngine::getSchemaCollation(const identifier::Schema &identifier)
114
117
{
115
118
  message::schema::shared_ptr schmema_proto;
116
 
  bool found;
117
 
 
118
 
  found= StorageEngine::getSchemaDefinition(identifier, schmema_proto);
119
 
 
120
 
  if (found && schmema_proto->has_collation())
 
119
 
 
120
  schmema_proto= StorageEngine::getSchemaDefinition(identifier);
 
121
 
 
122
  if (schmema_proto && schmema_proto->has_collation())
121
123
  {
122
124
    const std::string buffer= schmema_proto->collation();
123
125
    const CHARSET_INFO* cs= get_charset_by_name(buffer.c_str());