From 5ced83875191cf9e0f395af79f45babd6fae3d29 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 25 Apr 2013 07:34:36 +0200 Subject: Add default constructor, finalized() accessor to transaction --- NEWS | 6 ++++++ doc/manual.xhtml | 17 ++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 9bb30a1..caa8f44 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,12 @@ Version 2.3.0 (the default schema name). For more information, refer to Section 3.4, "Database" in the ODB manual. + * The transaction class now provides the default constructor that allows + the creation of a finalized transactions which can then be re-initialized + with the reset() function. The finalized() accessor has also been added + which allows querying of the finalized state. For more information, refer + to Section 3.5, "Transactions" in the ODB manual. + * New option, --fkeys-deferrable-mode, specifies the alternative deferrable mode for foreign keys. By default, the ODB compiler generates deferred foreign keys for databases that support them (SQLite, PostgreSQL, and diff --git a/doc/manual.xhtml b/doc/manual.xhtml index dfdca31..75f9102 100644 --- a/doc/manual.xhtml +++ b/doc/manual.xhtml @@ -2973,8 +2973,11 @@ namespace odb typedef odb::database database_type; typedef odb::connection connection_type; + explicit transaction (transaction_impl*, bool make_current = true); + transaction (); + void reset (transaction_impl*, bool make_current = true); @@ -2990,6 +2993,10 @@ namespace odb connection_type& connection (); + bool + finilized () const; + + public: static bool has_current (); @@ -3004,6 +3011,7 @@ namespace odb // Callback API. // + public: ... }; } @@ -3070,9 +3078,12 @@ t2.commit (); transaction instance to complete several database transactions. Similar to the destructor, reset() will roll the current transaction back if it hasn't been finalized. - Here is how we can use this function to commit the current transaction - and start a new one every time a certain number of database operations - has been performed:

+ The default transaction constructor creates a finalized + transaction which can later be initialized using reset(). + The finilized() accessor can be used to check whether the + transaction has been finalized. Here is how we can use this functionality + to commit the current transaction and start a new one every time a + certain number of database operations has been performed:

 transaction t (db.begin ());
-- 
cgit v1.1