diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-04-23 16:48:02 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-04-23 16:48:02 +0200 |
commit | f039726a9d756dff85607d89bf4ba5fd1ef42edf (patch) | |
tree | a422c8d57733d29d2ecab92b39a0b3bef8d6fc1d /odb/oracle/statement-cache.hxx | |
parent | d2fc34834f0b7660374f78d4409e24a165950c2c (diff) |
Polymorphic inheritance support
Diffstat (limited to 'odb/oracle/statement-cache.hxx')
-rw-r--r-- | odb/oracle/statement-cache.hxx | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/odb/oracle/statement-cache.hxx b/odb/oracle/statement-cache.hxx index 549251a..d4d65ca 100644 --- a/odb/oracle/statement-cache.hxx +++ b/odb/oracle/statement-cache.hxx @@ -11,11 +11,11 @@ #include <typeinfo> #include <odb/forward.hxx> +#include <odb/traits.hxx> #include <odb/oracle/version.hxx> +#include <odb/oracle/forward.hxx> #include <odb/oracle/statements-base.hxx> -#include <odb/oracle/object-statements.hxx> -#include <odb/oracle/view-statements.hxx> #include <odb/details/shared-ptr.hxx> #include <odb/details/type-info.hxx> @@ -26,49 +26,18 @@ namespace odb { namespace oracle { - class connection; - class LIBODB_ORACLE_EXPORT statement_cache { public: - statement_cache (connection& conn) - : conn_ (conn) - { - } + statement_cache (connection& conn): conn_ (conn) {} template <typename T> - typename object_statements_selector<T>::type& - find_object () - { - typedef typename object_statements_selector<T>::type object_statements; - - map::iterator i (map_.find (&typeid (T))); - - if (i != map_.end ()) - return static_cast<object_statements&> (*i->second); - - details::shared_ptr<object_statements> p ( - new (details::shared) object_statements (conn_)); - - map_.insert (map::value_type (&typeid (T), p)); - return *p; - } + typename object_traits<T>::statements_type& + find_object (); template <typename T> view_statements<T>& - find_view () - { - map::iterator i (map_.find (&typeid (T))); - - if (i != map_.end ()) - return static_cast<view_statements<T>&> (*i->second); - - details::shared_ptr<view_statements<T> > p ( - new (details::shared) view_statements<T> (conn_)); - - map_.insert (map::value_type (&typeid (T), p)); - return *p; - } + find_view (); private: typedef std::map<const std::type_info*, @@ -81,6 +50,8 @@ namespace odb } } +#include <odb/oracle/statement-cache.txx> + #include <odb/post.hxx> #endif // ODB_ORACLE_STATEMENT_CACHE_HXX |