~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/generator/schema.h

Merge with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#ifndef DRIZZLED_GENERATOR_SCHEMA_H
22
22
#define DRIZZLED_GENERATOR_SCHEMA_H
23
23
 
24
 
#include "drizzled/session.h"
25
 
#include "drizzled/plugin/storage_engine.h"
 
24
#include <drizzled/plugin/authorization.h>
 
25
#include <drizzled/plugin/storage_engine.h>
26
26
 
27
27
namespace drizzled {
 
28
 
 
29
class Session;
 
30
 
28
31
namespace generator {
29
32
 
30
33
class Schema
32
35
  Session &session;
33
36
  message::schema::shared_ptr schema;
34
37
 
35
 
  SchemaIdentifier::vector schema_names;
36
 
  SchemaIdentifier::vector::const_iterator schema_iterator;
 
38
  identifier::Schema::vector schema_names;
 
39
  identifier::Schema::vector::const_iterator schema_iterator;
37
40
 
38
41
public:
39
42
 
40
43
  Schema(Session &arg);
41
44
 
42
 
  operator const drizzled::message::schema::shared_ptr()
43
 
  {
44
 
    while (schema_iterator != schema_names.end())
45
 
    {
46
 
      SchemaIdentifier schema_identifier(*schema_iterator);
47
 
      bool is_schema_parsed= plugin::StorageEngine::getSchemaDefinition(schema_identifier, schema);
48
 
      schema_iterator++;
49
 
 
50
 
      if (is_schema_parsed)
51
 
        return schema;
52
 
    }
53
 
 
54
 
    return message::schema::shared_ptr();
55
 
  }
56
 
 
57
 
  operator const drizzled::SchemaIdentifier*()
58
 
  {
59
 
    while (schema_iterator != schema_names.end())
60
 
    {
61
 
      const drizzled::SchemaIdentifier *_ptr= &(*schema_iterator);
62
 
      schema_iterator++;
63
 
 
64
 
      return _ptr;
65
 
    }
66
 
 
67
 
    return NULL;
68
 
  }
 
45
  operator const drizzled::message::schema::shared_ptr();
 
46
  operator const drizzled::identifier::Schema*();
69
47
};
70
48
 
71
49
} /* namespace generator */