summaryrefslogtreecommitdiff
path: root/odb/relational/schema.hxx
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-10-14 15:05:26 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-10-21 11:47:13 +0200
commit8c37ec27c06341572d947342869345e59f7bdcf5 (patch)
tree8d80239d90e76cc76122b17f84d900f0676c447a /odb/relational/schema.hxx
parent9aa4062b27b52fb8348f125dc58ccca48f3366ac (diff)
Allow per database specialization of schema_emitter
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.
//