From ded152cfb675537ab4ce24f50d0e95cec5b83b18 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 14 Aug 2014 09:37:06 +0200 Subject: Draft implementation for INSERT --- odb/database.ixx | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) (limited to 'odb/database.ixx') diff --git a/odb/database.ixx b/odb/database.ixx index 739db03..d4477e4 100644 --- a/odb/database.ixx +++ b/odb/database.ixx @@ -3,11 +3,62 @@ // license : GNU GPL v2; see accompanying LICENSE file #include // std::strlen() +#include // std::move +#include #include namespace odb { + template + struct object_pointer_p + { + typedef details::meta::no result_type; + typedef T object_type; + }; + + template + struct object_pointer_p + { + typedef details::meta::yes result_type; + typedef T object_type; + }; + + template + struct object_pointer_p + { + typedef details::meta::yes result_type; + typedef T object_type; + }; + + template class P> + struct object_pointer_p > + { + typedef details::meta::yes result_type; + typedef T object_type; + }; + + template class P> + struct object_pointer_p > + { + typedef details::meta::yes result_type; + typedef T object_type; + }; + + template class P> + struct object_pointer_p > + { + typedef details::meta::yes result_type; + typedef T object_type; + }; + + template class P> + struct object_pointer_p > + { + typedef details::meta::yes result_type; + typedef T object_type; + }; + inline database:: database (database_id id) : id_ (id), tracer_ (0), schema_version_seq_ (1) @@ -165,6 +216,13 @@ namespace odb return persist_ (pobj); } + template + inline void database:: + persist (I b, I e) + { + persist_ (b, e); + } + template inline typename object_traits::pointer_type database:: load (const typename object_traits::id_type& id) @@ -622,6 +680,26 @@ namespace odb // Implementations (i.e., the *_() functions). // + template + inline void database:: + persist_ (I b, I e) + { + // Sun CC with non-standard STL does not have iterator_traits. + // +#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC + typedef typename std::iterator_traits::value_type value_type; +#else + // Assume iterator is just a pointer. + // + typedef typename object_pointer_p::object_type value_type; +#endif + + typedef object_pointer_p test; + + persist_ ( + b, e, typename test::result_type ()); + } + template inline typename object_traits::pointer_type database:: find_ (const typename object_traits::id_type& id) -- cgit v1.1