aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-07-05 18:44:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-07-05 18:44:38 +0200
commit8ea45e39522f7040048c28dbeae853eea6b03b71 (patch)
tree782a200aa5c8de9ee2fc766d0cac2fa0727608a9
parent5d33aeaa327f53c920a65302925090debdfc80b8 (diff)
Add hook for schema column reference generation
-rw-r--r--odb/relational/schema.hxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/odb/relational/schema.hxx b/odb/relational/schema.hxx
index ada459d..28a893a 100644
--- a/odb/relational/schema.hxx
+++ b/odb/relational/schema.hxx
@@ -189,12 +189,7 @@ namespace relational
type (m);
constraints (m);
-
- if (semantics::class_* c = object_pointer (member_type (m, prefix_)))
- {
- os << " REFERENCES " << quote_id (table_name (*c)) << " (" <<
- quote_id (column_name (*id_member (*c))) << ")";
- }
+ reference (m);
return true;
}
@@ -212,6 +207,16 @@ namespace relational
os << " PRIMARY KEY";
}
+ virtual void
+ reference (semantics::data_member& m)
+ {
+ if (semantics::class_* c = object_pointer (member_type (m, prefix_)))
+ {
+ os << " REFERENCES " << quote_id (table_name (*c)) << " (" <<
+ quote_id (column_name (*id_member (*c))) << ")";
+ }
+ }
+
protected:
string prefix_;
};