From be97326d67365e16175cc599e23348feaf80e0fe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 8 Oct 2012 16:09:07 +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/traits.hxx | 77 +++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 20 deletions(-) (limited to 'odb/traits.hxx') diff --git a/odb/traits.hxx b/odb/traits.hxx index 0743dba..3711601 100644 --- a/odb/traits.hxx +++ b/odb/traits.hxx @@ -99,17 +99,16 @@ namespace odb // template + // + // If a C++ compiler issues an error pointing to this struct and + // saying that it is incomplete, then you are most likely trying to + // perform a database operation on a C++ type that is not a persistent + // object. Or you forgot to include the corresponding -odb.hxx file. + // struct object_traits: access::object_traits, access::object_factory::pointer_type> { - // - // If a C++ compiler issues an error pointing to this struct and - // saying that it is incomplete, then you are most likely trying to - // perform a database operation on a C++ type that is not a persistent - // object. Or you forgot to include the corresponding -odb.hxx file. - // - typedef odb::pointer_traits::pointer_type> pointer_traits; @@ -160,45 +159,64 @@ namespace odb }; template class P> - struct object_traits< P > + struct object_traits > { struct id_type {}; }; template class P> - struct object_traits< P > + struct object_traits > { struct id_type {}; }; template class P> - struct object_traits< const P > + struct object_traits > { struct id_type {}; }; template class P> - struct object_traits< const P > + struct object_traits > { struct id_type {}; }; + template + // + // If a C++ compiler issues an error pointing to this struct and + // saying that it is incomplete, then you are most likely trying to + // perform a database operation on a C++ type that is not a persistent + // object. Or you forgot to include the corresponding -odb.hxx file. + // + struct object_traits_impl: + access::object_traits_impl, + access::object_factory::pointer_type> + { + typedef + odb::pointer_traits::pointer_type> + pointer_traits; + + typedef typename access::object_traits::object_type object_type; + typedef typename access::object_traits::pointer_type pointer_type; + typedef typename pointer_traits::const_pointer_type const_pointer_type; + }; + // // view_traits // template + // + // If a C++ compiler issues an error pointing to this struct and + // saying that it is incomplete, then you are most likely trying to + // perform a database operation on a C++ type that is not a view + // Or you forgot to include the corresponding -odb.hxx file. + // struct view_traits: access::view_traits, access::view_factory::pointer_type> { - // - // If a C++ compiler issues an error pointing to this struct and - // saying that it is incomplete, then you are most likely trying to - // perform a database operation on a C++ type that is not a view - // Or you forgot to include the corresponding -odb.hxx file. - // - typedef odb::pointer_traits::pointer_type> pointer_traits; @@ -227,12 +245,31 @@ namespace odb typedef const_pointer_type pointer_type; }; + template + // + // If a C++ compiler issues an error pointing to this struct and + // saying that it is incomplete, then you are most likely trying to + // perform a database operation on a C++ type that is not a view + // Or you forgot to include the corresponding -odb.hxx file. + // + struct view_traits_impl: + access::view_traits_impl, + access::view_factory::pointer_type> + { + typedef + odb::pointer_traits::pointer_type> + pointer_traits; + + typedef typename access::view_traits::view_type view_type; + typedef typename access::view_traits::pointer_type pointer_type; + }; + // // composite_value_traits // - template - struct composite_value_traits: access::composite_value_traits + template + struct composite_value_traits: access::composite_value_traits { }; } -- cgit v1.1