diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-10 08:44:28 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-21 15:39:59 +0200 |
commit | 7ae497743c7b042904fe1f6b4153ab3f4763ff2b (patch) | |
tree | 08ba3f742f20d16d893856ccceb070094bd69225 /odb/emitter.cxx | |
parent | 2436f20262a41bd1cafa5107ab6d6799c03e0964 (diff) |
Split MySQL code generator into common and db-specific parts
The common part (in relational/) still has some MySQL-specific parts.
Also, add the notion of the current context which is used to avoid
explicitly passing the context object to every generator's c-tor.
Diffstat (limited to 'odb/emitter.cxx')
-rw-r--r-- | odb/emitter.cxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/odb/emitter.cxx b/odb/emitter.cxx index 6cfe64a..2989ffb 100644 --- a/odb/emitter.cxx +++ b/odb/emitter.cxx @@ -3,6 +3,7 @@ // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v3; see accompanying LICENSE file +#include <odb/context.hxx> #include <odb/emitter.hxx> using namespace std; @@ -30,7 +31,22 @@ sync () s.resize (n - 1); } + // Temporary restore output diversion. + // + bool r (false); + context& ctx (context::current ()); + + if (ctx.os.rdbuf () == this) + { + ctx.restore (); + r = true; + } + e_.line (s); + + if (r) + ctx.diverge (this); + str (string ()); return 0; } |