From 1b1cb92a27592da6ab9300b2c5c8384f7588e2af Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 6 Sep 2011 16:54:06 +0200 Subject: Support for views; native part --- odb/sqlite/statement-cache.hxx | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'odb/sqlite/statement-cache.hxx') diff --git a/odb/sqlite/statement-cache.hxx b/odb/sqlite/statement-cache.hxx index ca4ab2e..16e0c15 100644 --- a/odb/sqlite/statement-cache.hxx +++ b/odb/sqlite/statement-cache.hxx @@ -12,12 +12,16 @@ #include #include + #include #include #include #include +#include #include +#include + #include namespace odb @@ -69,7 +73,7 @@ namespace odb template object_statements& - find () + find_object () { map::iterator i (map_.find (&typeid (T))); @@ -83,6 +87,22 @@ namespace odb return *p; } + 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; + } + private: void begin_immediate_statement_ () const; @@ -92,7 +112,7 @@ namespace odb private: typedef std::map, + details::shared_ptr, details::type_info_comparator> map; connection& conn_; -- cgit v1.1