diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-29 14:43:47 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-03-29 14:43:47 +0200 |
commit | 83aede3c9e27a8370c71dbde3549905c60524702 (patch) | |
tree | f6e9f617a1e9183b67e6597d1a5179db6ac874c1 /odb/sqlite/statement-cache.hxx | |
parent | 2fe2c22fa340e4854a69a1c17d94f8e58ba68ad4 (diff) |
Add support for starting immediate and exclusive transactions
Diffstat (limited to 'odb/sqlite/statement-cache.hxx')
-rw-r--r-- | odb/sqlite/statement-cache.hxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/odb/sqlite/statement-cache.hxx b/odb/sqlite/statement-cache.hxx index 1b3d4b2..ca4ab2e 100644 --- a/odb/sqlite/statement-cache.hxx +++ b/odb/sqlite/statement-cache.hxx @@ -38,6 +38,24 @@ namespace odb } simple_statement& + begin_immediate_statement () const + { + if (!begin_immediate_) + begin_immediate_statement_ (); + + return *begin_immediate_; + } + + simple_statement& + begin_exclusive_statement () const + { + if (!begin_exclusive_) + begin_exclusive_statement_ (); + + return *begin_exclusive_; + } + + simple_statement& commit_statement () const { return *commit_; @@ -66,6 +84,13 @@ namespace odb } private: + void + begin_immediate_statement_ () const; + + void + begin_exclusive_statement_ () const; + + private: typedef std::map<const std::type_info*, details::shared_ptr<object_statements_base>, details::type_info_comparator> map; @@ -73,6 +98,8 @@ namespace odb connection& conn_; details::shared_ptr<simple_statement> begin_; + mutable details::shared_ptr<simple_statement> begin_immediate_; + mutable details::shared_ptr<simple_statement> begin_exclusive_; details::shared_ptr<simple_statement> commit_; details::shared_ptr<simple_statement> rollback_; |