From 7871bd9b681f449cc3938750ce70fa1ed5400dcd Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 1 Nov 2011 12:41:02 +0200 Subject: Implement support for optimistic concurrency New pragmas: optimistic, version. New test: optimistic. New database function: reload(). --- odb/relational/sqlite/source.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'odb/relational/sqlite/source.cxx') diff --git a/odb/relational/sqlite/source.cxx b/odb/relational/sqlite/source.cxx index 0516370..041f8aa 100644 --- a/odb/relational/sqlite/source.cxx +++ b/odb/relational/sqlite/source.cxx @@ -48,7 +48,7 @@ namespace relational os << "// " << mi.m.name () << endl << "//" << endl; - if (inverse (mi.m, key_prefix_)) + if (inverse (mi.m, key_prefix_) || version (mi.m)) os << "if (sk == statement_select)" << "{"; // If the whole class is readonly, then we will never be @@ -93,7 +93,7 @@ namespace relational << "sk == statement_select ? 0 : "; if (cc.inverse != 0) - os << cc.inverse << "UL" << endl; + os << cc.inverse << "UL"; if (!ro && cc.readonly != 0) { @@ -117,7 +117,7 @@ namespace relational // The same logic as in pre(). // - if (inverse (mi.m, key_prefix_)) + if (inverse (mi.m, key_prefix_) || version (mi.m)) block = true; else if (!readonly (*context::top_object)) { @@ -295,6 +295,12 @@ namespace relational member = member_override_; else { + // If we are generating standard init() and this member + // contains version, ignore it. + // + if (version (mi.m)) + return false; + string const& name (mi.m.name ()); member = "o." + name; -- cgit v1.1