~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/schema_engine.cc

  • Committer: Monty Taylor
  • Date: 2010-12-05 07:35:32 UTC
  • mfrom: (1974 b)
  • mto: (1975.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1976.
  • Revision ID: mordred@inaugust.com-20101205073532-hehqwv27pbd7byjm
Merged source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include "drizzled/plugin/storage_engine.h"
28
28
#include "drizzled/plugin/authorization.h"
29
29
 
30
 
using namespace std;
31
 
 
32
30
namespace drizzled
33
31
{
34
32
 
36
34
{
37
35
 
38
36
class AddSchemaNames : 
39
 
  public unary_function<StorageEngine *, void>
 
37
  public std::unary_function<StorageEngine *, void>
40
38
{
41
39
  SchemaIdentifier::vector &schemas;
42
40
 
56
54
void StorageEngine::getIdentifiers(Session &session, SchemaIdentifier::vector &schemas)
57
55
{
58
56
  // Add hook here for engines to register schema.
59
 
  for_each(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
 
57
  std::for_each(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
60
58
           AddSchemaNames(schemas));
61
59
 
62
60
  plugin::Authorization::pruneSchemaNames(session.getSecurityContext(), schemas);
63
61
}
64
62
 
65
 
class StorageEngineGetSchemaDefinition: public unary_function<StorageEngine *, bool>
 
63
class StorageEngineGetSchemaDefinition: public std::unary_function<StorageEngine *, bool>
66
64
{
67
65
  const SchemaIdentifier &identifier;
68
66
  message::schema::shared_ptr &schema_proto;
92
90
bool StorageEngine::getSchemaDefinition(const SchemaIdentifier &identifier, message::schema::shared_ptr &proto)
93
91
{
94
92
  EngineVector::iterator iter=
95
 
    find_if(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
96
 
            StorageEngineGetSchemaDefinition(identifier, proto));
 
93
    std::find_if(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
 
94
                 StorageEngineGetSchemaDefinition(identifier, proto));
97
95
 
98
96
  if (iter != StorageEngine::getSchemaEngines().end())
99
97
  {
120
118
 
121
119
  if (found && schmema_proto->has_collation())
122
120
  {
123
 
    const string buffer= schmema_proto->collation();
 
121
    const std::string buffer= schmema_proto->collation();
124
122
    const CHARSET_INFO* cs= get_charset_by_name(buffer.c_str());
125
123
 
126
124
    if (not cs)
142
140
}
143
141
 
144
142
class CreateSchema : 
145
 
  public unary_function<StorageEngine *, void>
 
143
  public std::unary_function<StorageEngine *, void>
146
144
{
147
145
  const drizzled::message::Schema &schema_message;
148
146
 
163
161
bool StorageEngine::createSchema(const drizzled::message::Schema &schema_message)
164
162
{
165
163
  // Add hook here for engines to register schema.
166
 
  for_each(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
167
 
           CreateSchema(schema_message));
 
164
  std::for_each(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
 
165
                CreateSchema(schema_message));
168
166
 
169
167
  return true;
170
168
}
171
169
 
172
170
class DropSchema : 
173
 
  public unary_function<StorageEngine *, void>
 
171
  public std::unary_function<StorageEngine *, void>
174
172
{
175
173
  uint64_t &success_count;
176
174
  const SchemaIdentifier &identifier;
197
195
{
198
196
  uint64_t counter= 0;
199
197
  // Add hook here for engines to register schema.
200
 
  for_each(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
201
 
           DropSchema(identifier, counter));
 
198
  std::for_each(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
 
199
                DropSchema(identifier, counter));
202
200
 
203
201
  return counter ? true : false;
204
202
}
205
203
 
206
204
class AlterSchema : 
207
 
  public unary_function<StorageEngine *, void>
 
205
  public std::unary_function<StorageEngine *, void>
208
206
{
209
207
  uint64_t &success_count;
210
208
  const drizzled::message::Schema &schema_message;
232
230
{
233
231
  uint64_t success_count= 0;
234
232
 
235
 
  for_each(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
236
 
           AlterSchema(schema_message, success_count));
 
233
  std::for_each(StorageEngine::getSchemaEngines().begin(), StorageEngine::getSchemaEngines().end(),
 
234
                AlterSchema(schema_message, success_count));
237
235
 
238
236
  return success_count ? true : false;
239
237
}