~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/generator/schema.h

Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#ifndef DRIZZLED_GENERATOR_SCHEMA_H
22
 
#define DRIZZLED_GENERATOR_SCHEMA_H
 
21
#pragma once
23
22
 
24
 
#include "drizzled/session.h"
25
 
#include "drizzled/plugin/storage_engine.h"
 
23
#include <drizzled/plugin/authorization.h>
 
24
#include <drizzled/plugin/storage_engine.h>
26
25
 
27
26
namespace drizzled {
 
27
 
 
28
class Session;
 
29
 
28
30
namespace generator {
29
31
 
30
32
class Schema
32
34
  Session &session;
33
35
  message::schema::shared_ptr schema;
34
36
 
35
 
  SchemaIdentifier::vector schema_names;
36
 
  SchemaIdentifier::vector::const_iterator schema_iterator;
 
37
  identifier::Schema::vector schema_names;
 
38
  identifier::Schema::vector::const_iterator schema_iterator;
37
39
 
38
40
public:
39
41
 
40
42
  Schema(Session &arg);
41
43
 
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
 
  }
 
44
  operator const drizzled::message::schema::shared_ptr();
 
45
  operator const drizzled::identifier::Schema*();
69
46
};
70
47
 
71
48
} /* namespace generator */
72
49
} /* namespace drizzled */
73
50
 
74
 
#endif /* DRIZZLED_GENERATOR_SCHEMA_H */