~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/generator/schema.h

  • Committer: patrick crews
  • Date: 2010-09-29 15:15:19 UTC
  • mfrom: (1099.4.188 drizzle)
  • Revision ID: gleebix@gmail.com-20100929151519-6mrmzd1ciw2p9nws
Tags: 2010.09.1802
Update translations

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