From 29f0456d158cd6a8f369d7574bb757d22052454b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 12 Jan 2012 09:15:21 +0200 Subject: Add support for case where we don't send auto object id in INSERT --- odb/relational/source.hxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'odb/relational/source.hxx') 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] == '_' ? "" : "_")); -- cgit v1.1