summaryrefslogtreecommitdiff
path: root/odb/relational/schema.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/relational/schema.hxx')
-rw-r--r--odb/relational/schema.hxx33
1 files changed, 33 insertions, 0 deletions
diff --git a/odb/relational/schema.hxx b/odb/relational/schema.hxx
index 8e56ff9..2911c40 100644
--- a/odb/relational/schema.hxx
+++ b/odb/relational/schema.hxx
@@ -44,6 +44,39 @@ namespace relational
ostream& os_;
};
+ struct schema_emitter: emitter, virtual context
+ {
+ typedef schema_emitter base;
+
+ virtual void
+ pre ()
+ {
+ first_ = true;
+ }
+
+ virtual void
+ line (const std::string& l)
+ {
+ if (first_)
+ first_ = false;
+ else
+ os << endl;
+
+ os << l;
+ }
+
+ virtual void
+ post ()
+ {
+ if (!first_) // Ignore empty statements.
+ os << ';' << endl
+ << endl;
+ }
+
+ private:
+ bool first_;
+ };
+
//
// Drop.
//