From 6400b736456af65176c9c1959022f1eb49fcde32 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 20 Jul 2010 11:02:07 +0200 Subject: Get rid of the session mechanism for now Add low-level API instead. --- odb/transaction.hxx | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) (limited to 'odb/transaction.hxx') diff --git a/odb/transaction.hxx b/odb/transaction.hxx index 01d4a38..8d09d9f 100644 --- a/odb/transaction.hxx +++ b/odb/transaction.hxx @@ -6,8 +6,6 @@ #ifndef ODB_TRANSACTION_HXX #define ODB_TRANSACTION_HXX -#include // placement new - #include namespace odb @@ -17,7 +15,6 @@ namespace odb class transaction { public: - typedef odb::session session_type; typedef odb::database database_type; explicit @@ -39,11 +36,6 @@ namespace odb database_type& database (); - // Return the session this transaction is part of. - // - session_type& - session (); - // Return current transaction or throw if there is no transaction // in effect. // @@ -69,30 +61,17 @@ namespace odb bool finilized_; transaction_impl* impl_; }; -} - -#include -namespace odb -{ class transaction_impl { protected: friend class transaction; - typedef odb::session session_type; typedef odb::database database_type; - transaction_impl (database_type& db, session_type& s) - : database_ (db), session_ (s) - { - } - transaction_impl (database_type& db) - : database_ (db), - session_ (*reinterpret_cast (&session_mem_)) + : database_ (db) { - new (&session_mem_) session_type (); } virtual @@ -104,33 +83,14 @@ namespace odb virtual void rollback () = 0; - session_type& - session () - { - return session_; - } - database_type& database () { return database_; } - bool - own_session () const - { - return &session_ == reinterpret_cast (&session_mem_); - } - protected: database_type& database_; - session_type& session_; - - union - { - void* align_; - char data_[sizeof (session_type)]; - } session_mem_; }; } -- cgit v1.1