diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-29 16:31:59 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-29 16:31:59 +0200 |
commit | 7aadac132d8512e7ee63970561f40ade80772726 (patch) | |
tree | 001695ad14cd9c2e6937a8e5d45a32587d0a37d5 /odb/sqlite/connection.hxx | |
parent | 2cdc08a9bcf807b4b908434c7bbe5439b0da3191 (diff) |
Support for shared cache and unlock notification
Diffstat (limited to 'odb/sqlite/connection.hxx')
-rw-r--r-- | odb/sqlite/connection.hxx | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/odb/sqlite/connection.hxx b/odb/sqlite/connection.hxx index 5390609..3ae82e3 100644 --- a/odb/sqlite/connection.hxx +++ b/odb/sqlite/connection.hxx @@ -13,6 +13,8 @@ #include <memory> // std::auto_ptr #include <odb/forward.hxx> +#include <odb/details/mutex.hxx> +#include <odb/details/condition.hxx> #include <odb/details/shared-ptr.hxx> #include <odb/sqlite/version.hxx> @@ -35,7 +37,7 @@ namespace odb virtual ~connection (); - connection (database_type&); + connection (database_type&, int extra_flags = 0); database_type& database () @@ -56,6 +58,12 @@ namespace odb return *statement_cache_; } + // Wait for the locks to be released via unlock notification. Can + // be called after getting SQLITE_LOCKED_SHAREDCACHE. + // + void + wait (); + public: // Reset active and finalize uncached statements. // @@ -67,14 +75,24 @@ namespace odb connection& operator= (const connection&); private: - friend class statement; - database_type& db_; sqlite3* handle_; + // Unlock notification machinery. + // + private: + bool unlocked_; + details::mutex unlock_mutex_; + details::condition unlock_cond_; + + friend void + connection_unlock_callback (void**, int); + // Linked list of active and uncached statements currently associated // with this connection. // + private: + friend class statement; statement* statements_; std::auto_ptr<statement_cache_type> statement_cache_; |