diff options
Diffstat (limited to 'odb/semantics')
-rw-r--r-- | odb/semantics/relational/elements.hxx | 8 | ||||
-rw-r--r-- | odb/semantics/relational/foreign-key.hxx | 4 | ||||
-rw-r--r-- | odb/semantics/relational/index.hxx | 19 | ||||
-rw-r--r-- | odb/semantics/relational/key.hxx | 4 | ||||
-rw-r--r-- | odb/semantics/relational/primary-key.hxx | 7 |
5 files changed, 15 insertions, 27 deletions
diff --git a/odb/semantics/relational/elements.hxx b/odb/semantics/relational/elements.hxx index 6b4964e..8eb695a 100644 --- a/odb/semantics/relational/elements.hxx +++ b/odb/semantics/relational/elements.hxx @@ -174,10 +174,10 @@ namespace semantics public: // Id identifies the C++ node (e.g., a class or a data member) that // this model node corresponds to. The ids are not necessarily unique - // (e.g., there can be a table and an index with the same id that - // correspond to a container member). However, in any given scope, - // the {id,typeid} must be unique. This becomes important when we - // try to find correspondance between nodes during model diff'ing. + // (e.g., there can be a foreign key and an index with the same id that + // correspond to a container member). However, in any given scope, the + // {id,typeid} must be unique. This becomes important when we try to + // find correspondance between nodes during model diff'ing. // nameable (string const& id): id_ (id), named_ (0) {} diff --git a/odb/semantics/relational/foreign-key.hxx b/odb/semantics/relational/foreign-key.hxx index 83b7071..871c036 100644 --- a/odb/semantics/relational/foreign-key.hxx +++ b/odb/semantics/relational/foreign-key.hxx @@ -12,7 +12,7 @@ namespace semantics { namespace relational { - class foreign_key: public unameable, public key + class foreign_key: public key { public: enum action @@ -25,7 +25,7 @@ namespace semantics qname const& referenced_table, bool deferred, action on_delete = no_action) - : unameable (id), + : key (id), referenced_table_ (referenced_table), deferred_ (deferred), on_delete_ (on_delete) diff --git a/odb/semantics/relational/index.hxx b/odb/semantics/relational/index.hxx index dcb8e6e..af90b12 100644 --- a/odb/semantics/relational/index.hxx +++ b/odb/semantics/relational/index.hxx @@ -6,31 +6,18 @@ #define ODB_SEMANTICS_RELATIONAL_INDEX_HXX #include <odb/semantics/relational/elements.hxx> -#include <odb/semantics/relational/column.hxx> #include <odb/semantics/relational/key.hxx> -#include <odb/semantics/relational/table.hxx> namespace semantics { namespace relational { - // Note that unlike other keys, indexes are defined in the model - // scope, not table scope. + // Note that in our model indexes are defined in the table scope. // - class index: public qnameable, public key + class index: public key { public: - relational::table& - table () const - { - return contains_begin ()->column ().table (); - } - - public: - index (string const& id) - : qnameable (id) - { - } + index (string const& id): key (id) {} virtual string kind () const diff --git a/odb/semantics/relational/key.hxx b/odb/semantics/relational/key.hxx index f5184be..40e7499 100644 --- a/odb/semantics/relational/key.hxx +++ b/odb/semantics/relational/key.hxx @@ -50,7 +50,7 @@ namespace semantics column_type* column_; }; - class key: public virtual node + class key: public unameable { typedef std::vector<contains*> contains_list; @@ -78,6 +78,8 @@ namespace semantics } public: + key (std::string const& id): unameable (id) {} + void add_edge_left (contains& e) { diff --git a/odb/semantics/relational/primary-key.hxx b/odb/semantics/relational/primary-key.hxx index e35b00f..0aec038 100644 --- a/odb/semantics/relational/primary-key.hxx +++ b/odb/semantics/relational/primary-key.hxx @@ -12,7 +12,7 @@ namespace semantics { namespace relational { - class primary_key: public unameable, public key + class primary_key: public key { public: bool @@ -23,9 +23,8 @@ namespace semantics public: primary_key (bool auto_) - // Primary key has the implicit empty id. - // - : unameable (""), auto__ (auto_) + : key (""), // Primary key has the implicit empty id. + auto__ (auto_) { } |