summaryrefslogtreecommitdiff
path: root/odb/type-processor.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-03-10 08:44:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-03-21 15:39:59 +0200
commit7ae497743c7b042904fe1f6b4153ab3f4763ff2b (patch)
tree08ba3f742f20d16d893856ccceb070094bd69225 /odb/type-processor.cxx
parent2436f20262a41bd1cafa5107ab6d6799c03e0964 (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/type-processor.cxx')
-rw-r--r--odb/type-processor.cxx23
1 files changed, 22 insertions, 1 deletions
diff --git a/odb/type-processor.cxx b/odb/type-processor.cxx
index 190b102..af6ab3d 100644
--- a/odb/type-processor.cxx
+++ b/odb/type-processor.cxx
@@ -8,8 +8,26 @@
#include <odb/cxx-lexer.hxx>
#include <odb/type-processor.hxx>
+using namespace std;
+
namespace
{
+ // Indirect (dynamic) context values.
+ //
+ static semantics::type*
+ id_tree_type (context& c)
+ {
+ semantics::data_member& id (c.id_member (*c.object));
+ return &id.type ();
+ }
+
+ static string
+ id_column_type (context& c)
+ {
+ semantics::data_member& id (c.id_member (*c.object));
+ return id.get<string> ("ref-column-type");
+ }
+
struct data_member: traversal::data_member, context
{
data_member (context& c)
@@ -408,6 +426,9 @@ namespace
// Process member data.
//
+ m.set ("tree-id-type", &id_tree_type);
+ m.set ("id-column-type", &id_column_type);
+
process_container_value (*vt, m, "value", true);
if (it != 0)
@@ -417,7 +438,7 @@ namespace
process_container_value (*kt, m, "key", false);
// If this is an inverse side of a bidirectional object relationship
- // and it is an ordred container, mark it as unordred since there is
+ // and it is an ordered container, mark it as unordred since there is
// no concept of order in this construct.
//
if (ck == ck_ordered && m.count ("value-inverse"))