From 7ae497743c7b042904fe1f6b4153ab3f4763ff2b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 Mar 2011 08:44:28 +0200 Subject: 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. --- odb/emitter.cxx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'odb/emitter.cxx') 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 #include 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; } -- cgit v1.1