diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-01-12 09:15:21 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-01-20 15:43:46 +0200 |
commit | 29f0456d158cd6a8f369d7574bb757d22052454b (patch) | |
tree | be66cd0f5ce0bec6d011de64a4187848084990c8 /odb/relational/source.hxx | |
parent | bcb41ec5c264862e1b70b295e8bb8cee546591a5 (diff) |
Add support for case where we don't send auto object id in INSERT
Diffstat (limited to 'odb/relational/source.hxx')
-rw-r--r-- | odb/relational/source.hxx | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx index db8d9e6..9860a30 100644 --- a/odb/relational/source.hxx +++ b/odb/relational/source.hxx @@ -576,8 +576,14 @@ namespace relational os << " + "; os << "(" << endl - << "sk == statement_insert ? 0 : " << - cc.id + cc.readonly << "UL)"; + << "sk == statement_insert ? "; + + if (insert_send_auto_id || !auto_ (*id_member (c))) + os << "0"; + else + os << cc.id << "UL"; + + os << " : " << cc.id + cc.readonly << "UL)"; } os << ")"; @@ -2233,7 +2239,8 @@ namespace relational init_auto_id (semantics::data_member&, // id member string const&) // image variable prefix { - assert (false); + if (insert_send_auto_id) + assert (false); } virtual void @@ -2839,7 +2846,7 @@ namespace relational << "im.version++;" << endl; - if (auto_id) + if (auto_id && insert_send_auto_id) { string const& n (id->name ()); string var ("im." + n + (n[n.size () - 1] == '_' ? "" : "_")); |