From 851cbe3927b987ec992bbbb69bd62224bf4a0dc3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 23 Apr 2012 16:48:01 +0200 Subject: Polymorphic inheritance support --- odb/sqlite/statement-cache.hxx | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) (limited to 'odb/sqlite/statement-cache.hxx') diff --git a/odb/sqlite/statement-cache.hxx b/odb/sqlite/statement-cache.hxx index 8281b22..5d94296 100644 --- a/odb/sqlite/statement-cache.hxx +++ b/odb/sqlite/statement-cache.hxx @@ -11,15 +11,15 @@ #include #include +#include #include #include #include +#include #include #include -#include -#include #include @@ -27,8 +27,6 @@ namespace odb { namespace sqlite { - class connection; - class LIBODB_SQLITE_EXPORT statement_cache { public: @@ -71,38 +69,12 @@ namespace odb } template - typename object_statements_selector::type& - find_object () - { - typedef typename object_statements_selector::type object_statements; - - map::iterator i (map_.find (&typeid (T))); - - if (i != map_.end ()) - return static_cast (*i->second); - - details::shared_ptr p ( - new (details::shared) object_statements (conn_)); - - map_.insert (map::value_type (&typeid (T), p)); - return *p; - } + typename object_traits::statements_type& + find_object (); template view_statements& - find_view () - { - map::iterator i (map_.find (&typeid (T))); - - if (i != map_.end ()) - return static_cast&> (*i->second); - - details::shared_ptr > p ( - new (details::shared) view_statements (conn_)); - - map_.insert (map::value_type (&typeid (T), p)); - return *p; - } + find_view (); private: void @@ -129,6 +101,8 @@ namespace odb } } +#include + #include #endif // ODB_SQLITE_STATEMENT_CACHE_HXX -- cgit v1.1