aboutsummaryrefslogtreecommitdiff
path: root/odb/generator.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-11-01 09:01:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-11-01 09:01:50 +0200
commit727a83dc82fa094aa91630d165d230a9a2dabe60 (patch)
treecf908eef97e4fd5518359bc90dc5839c829475ff /odb/generator.cxx
parent56237544eeed76a55190b3fd7cc364d133d4513d (diff)
Factor assignment of database type to separate pass
Diffstat (limited to 'odb/generator.cxx')
-rw-r--r--odb/generator.cxx30
1 files changed, 28 insertions, 2 deletions
diff --git a/odb/generator.cxx b/odb/generator.cxx
index 5d8c47c..be01886 100644
--- a/odb/generator.cxx
+++ b/odb/generator.cxx
@@ -18,6 +18,8 @@
#include <odb/context.hxx>
#include <odb/generator.hxx>
+#include <odb/type-processor.hxx>
+
#include <odb/include.hxx>
#include <odb/header.hxx>
#include <odb/inline.hxx>
@@ -108,13 +110,37 @@ generate (options const& ops, semantics::unit& unit, path const& p)
{
try
{
+ // Process types.
+ //
+ {
+ auto_ptr<context> ctx;
+
+ switch (ops.database ())
+ {
+ case database::mysql:
+ {
+ ctx.reset (new mysql::context (cerr, unit, ops));
+ break;
+ }
+ case database::tracer:
+ {
+ // Do not assign database types for tracer.
+ //
+ break;
+ }
+ }
+
+ if (ctx.get () != 0)
+ process_types (*ctx);
+ }
+
+ // Output files.
+ //
path file (p.leaf ());
string base (file.base ().string ());
fs::auto_removes auto_rm;
- // C++ output.
- //
string hxx_name (base + ops.odb_file_suffix () + ops.hxx_suffix ());
string ixx_name (base + ops.odb_file_suffix () + ops.ixx_suffix ());
string cxx_name (base + ops.odb_file_suffix () + ops.cxx_suffix ());