aboutsummaryrefslogtreecommitdiff
path: root/odb/sqlite/statement-cache.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-04-23 16:48:01 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-04-23 16:48:01 +0200
commit851cbe3927b987ec992bbbb69bd62224bf4a0dc3 (patch)
tree278298c656c75b1625e9408a15e81736c35c194e /odb/sqlite/statement-cache.hxx
parent7d52205f2b2fc9403b9ea46483e8a17746c6be35 (diff)
Polymorphic inheritance support
Diffstat (limited to 'odb/sqlite/statement-cache.hxx')
-rw-r--r--odb/sqlite/statement-cache.hxx40
1 files changed, 7 insertions, 33 deletions
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 <typeinfo>
#include <odb/forward.hxx>
+#include <odb/traits.hxx>
#include <odb/details/shared-ptr.hxx>
#include <odb/details/type-info.hxx>
#include <odb/sqlite/version.hxx>
+#include <odb/sqlite/forward.hxx>
#include <odb/sqlite/statement.hxx>
#include <odb/sqlite/statements-base.hxx>
-#include <odb/sqlite/object-statements.hxx>
-#include <odb/sqlite/view-statements.hxx>
#include <odb/sqlite/details/export.hxx>
@@ -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 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:
void
@@ -129,6 +101,8 @@ namespace odb
}
}
+#include <odb/sqlite/statement-cache.txx>
+
#include <odb/post.hxx>
#endif // ODB_SQLITE_STATEMENT_CACHE_HXX