From 4eb0df751704345ec8744fe012e64064d5cdb754 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 8 Oct 2012 16:09:08 +0200 Subject: Ground work for multi-database support All generated code now includes database id. The database-specific database class interface has been updated to include all the database operations. The database-specific tests now use this interface. --- odb/relational/source.cxx | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'odb/relational/source.cxx') diff --git a/odb/relational/source.cxx b/odb/relational/source.cxx index 5a02703..8981417 100644 --- a/odb/relational/source.cxx +++ b/odb/relational/source.cxx @@ -49,7 +49,8 @@ traverse_object (type& c) } string const& type (class_fq_name (c)); - string traits ("access::object_traits< " + type + " >"); + string traits ("access::object_traits_impl< " + type + ", id_" + + db.string () + " >"); column_count_type const& cc (column_count (c)); os << "// " << class_name (c) << endl @@ -187,7 +188,7 @@ traverse_object (type& c) << "//" << endl << "if (--d != 0)" << "{" - << "if (object_traits::grow (*i.base, " << + << "if (base_traits::grow (*i.base, " << "t + " << cols << "UL" << (poly_base != poly_root ? ", d" : "") << "))" << endl << "i.base->version++;" @@ -268,7 +269,7 @@ traverse_object (type& c) os << "// " << class_name (*poly_base) << " base" << endl << "//" << endl << "if (sk == statement_select)" << endl - << "object_traits::"; + << "base_traits::"; if (poly_base == poly_root) os << "bind (b + n, *i.base, sk);"; @@ -360,7 +361,7 @@ traverse_object (type& c) os << "// " << class_name (*poly_base) << " base" << endl << "//" << endl << "if (--d != 0)" << endl - << "object_traits::init (o, *i.base, db" << + << "base_traits::init (o, *i.base, db" << (poly_base != poly_root ? ", d" : "") << ");" << endl; } @@ -450,7 +451,8 @@ traverse_object (type& c) << "typeid (" << type << ")," << endl; if (poly_derived) - os << "&object_traits< " << class_fq_name (*poly_base) << " >::info"; + os << "&object_traits_impl< " << class_fq_name (*poly_base) << + ", id_" << db << " >::info"; else os << "0"; @@ -463,7 +465,7 @@ traverse_object (type& c) os << "," << endl << strlit (string (n, 2, string::npos)) << "," << endl << "&odb::create_impl< " << type << " >," << endl - << "&odb::dispatch_impl< " << type << " >," << endl; + << "&odb::dispatch_impl< " << type << ", id_" << db << " >," << endl; if (poly_derived) os << "&statements_type::delayed_loader"; @@ -883,7 +885,7 @@ traverse_object (type& c) // hierarchy. // if (poly_derived) - os << "object_traits::persist (db, obj, false, false);" + os << "base_traits::persist (db, obj, false, false);" << endl; os << "image_type& im (sts.image ());" @@ -1135,7 +1137,7 @@ traverse_object (type& c) // if (!readonly_base) { - os << "object_traits::update (db, obj, false, false);" + os << "base_traits::update (db, obj, false, false);" << endl; } else @@ -1550,7 +1552,7 @@ traverse_object (type& c) // Call our base last (we erase polymorphic objects from base // to derived in order not to trigger cascading deletes). // - os << "object_traits::erase (db, id, false, false);" + os << "base_traits::erase (db, id, false, false);" << endl; } @@ -1787,7 +1789,7 @@ traverse_object (type& c) // Call our base last (we erase polymorphic objects from base // to derived in order not to trigger cascading deletes). // - os << "object_traits::erase (db, obj, false, false);" + os << "base_traits::erase (db, obj, false, false);" << endl; } @@ -2349,7 +2351,7 @@ traverse_object (type& c) if (poly_derived) os << "if (--d != 0)" << endl - << "object_traits::load_ (sts.base_statements (), obj" << + << "base_traits::load_ (sts.base_statements (), obj" << (poly_base != poly_root ? ", d" : "") << ");" << endl; @@ -2658,7 +2660,8 @@ void relational::source::class_:: traverse_view (type& c) { string const& type (class_fq_name (c)); - string traits ("access::view_traits< " + type + " >"); + string traits ("access::view_traits_impl< " + type + ", id_" + + db.string () + " >"); os << "// " << class_name (c) << endl << "//" << endl -- cgit v1.1