From fa3f14db14671b4c37c400880d097b17aa12b824 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 29 Apr 2021 11:55:45 +0200 Subject: Move begin/commit/rollback statements to connection --- odb/sqlite/connection.hxx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'odb/sqlite/connection.hxx') diff --git a/odb/sqlite/connection.hxx b/odb/sqlite/connection.hxx index 254a002..30bb467 100644 --- a/odb/sqlite/connection.hxx +++ b/odb/sqlite/connection.hxx @@ -8,6 +8,7 @@ #include +#include #include #include @@ -29,6 +30,7 @@ namespace odb namespace sqlite { class statement_cache; + class generic_statement; class connection_factory; class connection; @@ -164,6 +166,22 @@ namespace odb void clear (); + public: + generic_statement& + begin_statement (); + + generic_statement& + begin_immediate_statement (); + + generic_statement& + begin_exclusive_statement (); + + generic_statement& + commit_statement (); + + generic_statement& + rollback_statement (); + private: connection (const connection&); connection& operator= (const connection&); @@ -180,6 +198,15 @@ namespace odb // details::unique_ptr statement_cache_; + // Note: using odb::statement in order to break the connection-statement + // dependency cycle. + // + details::shared_ptr begin_; + details::shared_ptr begin_immediate_; + details::shared_ptr begin_exclusive_; + details::shared_ptr commit_; + details::shared_ptr rollback_; + // Unlock notification machinery. // private: -- cgit v1.1