summaryrefslogtreecommitdiff
path: root/odb/relational/sqlite/source.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-26 12:13:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-28 14:15:45 +0200
commit64d0ceffaaf5f57a3d24a5210bf0ad2a8474a618 (patch)
tree98115a01b0bd2e9ddfdc6ff3a0f7470915de483a /odb/relational/sqlite/source.cxx
parent061a16256eef2c2df53e2e145d16f17270c2de82 (diff)
Add wrapper support for composite values
NULL semantics for composite values is not yet supported.
Diffstat (limited to 'odb/relational/sqlite/source.cxx')
-rw-r--r--odb/relational/sqlite/source.cxx35
1 files changed, 31 insertions, 4 deletions
diff --git a/odb/relational/sqlite/source.cxx b/odb/relational/sqlite/source.cxx
index 6a99fc8..a482184 100644
--- a/odb/relational/sqlite/source.cxx
+++ b/odb/relational/sqlite/source.cxx
@@ -239,6 +239,18 @@ namespace relational
<< "//" << endl;
}
+ // If this is a wrapped composite value, then we need to
+ // "unwrap" it. For simple values this is taken care of
+ // by the value_traits specializations.
+ //
+ if (mi.wrapper != 0 && comp_value (mi.t))
+ {
+ // Here we need the wrapper type, not the wrapped type.
+ //
+ member = "wrapper_traits< " + mi.fq_type (false) + " >::" +
+ "get_ref (" + member + ")";
+ }
+
if (comp_value (mi.t))
traits = "composite_value_traits< " + mi.fq_type () + " >";
else
@@ -333,8 +345,9 @@ namespace relational
virtual void
traverse_composite (member_info& mi)
{
- os << "if (" << traits << "::init (i." << mi.var << "value, " <<
- member << "))"
+ os << "if (" << traits << "::init (" << endl
+ << "i." << mi.var << "value," << endl
+ << member << "))"
<< "{"
<< "grew = true;"
<< "}";
@@ -413,6 +426,18 @@ namespace relational
<< "//" << endl;
}
+ // If this is a wrapped composite value, then we need to
+ // "unwrap" it. For simple values this is taken care of
+ // by the value_traits specializations.
+ //
+ if (mi.wrapper != 0 && comp_value (mi.t))
+ {
+ // Here we need the wrapper type, not the wrapped type.
+ //
+ member = "wrapper_traits< " + mi.fq_type (false) + " >::" +
+ "set_ref (" + member + ")";
+ }
+
if (comp_value (mi.t))
traits = "composite_value_traits< " + mi.fq_type () + " >";
else
@@ -497,8 +522,10 @@ namespace relational
virtual void
traverse_composite (member_info& mi)
{
- os << traits << "::init (" << member << ", i." <<
- mi.var << "value, db);"
+ os << traits << "::init (" << endl
+ << member << "," << endl
+ << "i." << mi.var << "value," << endl
+ << "db);"
<< endl;
}