~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/generator/schema.h

  • Committer: Brian Aker
  • Date: 2011-02-03 18:12:09 UTC
  • mfrom: (2134.1.9 timestamp)
  • mto: This revision was merged to the branch mainline in revision 2140.
  • Revision ID: brian@tangent.org-20110203181209-xr7i2079pdmu33hd
Merge in table tree.

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>
24
25
#include <drizzled/plugin/authorization.h>
25
26
#include <drizzled/plugin/storage_engine.h>
26
27
 
27
28
namespace drizzled {
28
 
 
29
 
class Session;
30
 
 
31
29
namespace generator {
32
30
 
33
31
class Schema
42
40
 
43
41
  Schema(Session &arg);
44
42
 
45
 
  operator const drizzled::message::schema::shared_ptr();
46
 
  operator const drizzled::identifier::Schema*();
 
43
  operator const drizzled::message::schema::shared_ptr()
 
44
  {
 
45
    while (schema_iterator != schema_names.end())
 
46
    {
 
47
      identifier::Schema schema_identifier(*schema_iterator);
 
48
 
 
49
      if (not plugin::Authorization::isAuthorized(session.user(), schema_identifier, false))
 
50
      {
 
51
        schema_iterator++;
 
52
        continue;
 
53
      }
 
54
 
 
55
      bool is_schema_parsed= plugin::StorageEngine::getSchemaDefinition(schema_identifier, schema);
 
56
      schema_iterator++;
 
57
 
 
58
      if (is_schema_parsed)
 
59
        return schema;
 
60
    }
 
61
 
 
62
    return message::schema::shared_ptr();
 
63
  }
 
64
 
 
65
  operator const drizzled::identifier::Schema*()
 
66
  {
 
67
    while (schema_iterator != schema_names.end())
 
68
    {
 
69
      const drizzled::identifier::Schema *_ptr= &(*schema_iterator);
 
70
      schema_iterator++;
 
71
 
 
72
      if (not plugin::Authorization::isAuthorized(session.user(), *_ptr, false))
 
73
        continue;
 
74
 
 
75
      return _ptr;
 
76
    }
 
77
 
 
78
    return NULL;
 
79
  }
47
80
};
48
81
 
49
82
} /* namespace generator */