diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-09-27 11:20:31 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-09-27 11:20:31 +0200 |
commit | a7bd7367e246ec5b6bb2e2f018a05173ff7e6301 (patch) | |
tree | 41e796b972320267f35fce07b9c77fd82029b3e8 /odb/context.hxx | |
parent | 8efcb4e093ec9faab36d49474fd3596a2ce90b13 (diff) |
Add support for associating tables with views
Diffstat (limited to 'odb/context.hxx')
-rw-r--r-- | odb/context.hxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/odb/context.hxx b/odb/context.hxx index 550b64e..f91568a 100644 --- a/odb/context.hxx +++ b/odb/context.hxx @@ -113,7 +113,7 @@ struct default_value tree node; }; -// +// Object or table associated with the view. // struct view_object { @@ -122,21 +122,29 @@ struct view_object std::string name () const { - return alias.empty () ? object->name () : alias; + if (!alias.empty ()) + return alias; + + return kind == object ? obj->name () : orig_name; } - tree node; + enum kind_type { object, table }; + + kind_type kind; + tree node; // Tree node if kind is object. std::string orig_name; // Original name as specified in the pragma. std::string alias; tree scope; location_t loc; - semantics::class_* object; + semantics::class_* obj; cxx_tokens cond; // Join condition tokens. }; typedef std::vector<view_object> view_objects; +// The view_alias_map does not contain entries for tables. +// typedef std::map<std::string, view_object*> view_alias_map; typedef std::map<tree, view_object*> view_object_map; |