summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/store/ms-sql/AmqpTransaction.h
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2010-04-16 20:12:55 +0000
committerStephen D. Huston <shuston@apache.org>2010-04-16 20:12:55 +0000
commita2313ce0fc34fbe4864445595e1db1955c4918a1 (patch)
tree4757029ffe7a3970cf38d32f8775a14bef7ea259 /cpp/src/qpid/store/ms-sql/AmqpTransaction.h
parenteb56a638b2aea7e56c55e49b267cfe2f673afe51 (diff)
downloadqpid-python-a2313ce0fc34fbe4864445595e1db1955c4918a1.tar.gz
Fix for QPID-2420 to correctly handle restoring and commit/abort prepared transactions.
The basic approach is documented in QPID-2420. This also makes improvements in the way changes are done to the tblMessageMap table which should perform much better, avoiding pulling the whole table into the broker just to add or edit or delete a single record. Also, some of the consistency checks and enforcements are moved into the database itself from the C++ code. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@935068 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/store/ms-sql/AmqpTransaction.h')
-rw-r--r--cpp/src/qpid/store/ms-sql/AmqpTransaction.h29
1 files changed, 15 insertions, 14 deletions
diff --git a/cpp/src/qpid/store/ms-sql/AmqpTransaction.h b/cpp/src/qpid/store/ms-sql/AmqpTransaction.h
index 9b87d0ae15..625fab5595 100644
--- a/cpp/src/qpid/store/ms-sql/AmqpTransaction.h
+++ b/cpp/src/qpid/store/ms-sql/AmqpTransaction.h
@@ -23,8 +23,10 @@
*/
#include <qpid/broker/TransactionalStore.h>
+#include <boost/shared_ptr.hpp>
#include <string>
-#include <memory>
+
+#include "SqlTransaction.h"
namespace qpid {
namespace store {
@@ -41,23 +43,18 @@ class DatabaseConnection;
*/
class AmqpTransaction : public qpid::broker::TransactionContext {
- std::auto_ptr<DatabaseConnection> db;
-
- // Since ADO w/ SQLOLEDB can't do nested transaction via its BeginTrans(),
- // et al, nested transactions are carried out with direct SQL commands.
- // To ensure the state of this is known, keep track of how deeply the
- // transactions are nested.
- unsigned int transDepth;
+ boost::shared_ptr<DatabaseConnection> db;
+ SqlTransaction sqlTrans;
public:
- AmqpTransaction(std::auto_ptr<DatabaseConnection>& _db);
+ AmqpTransaction(const boost::shared_ptr<DatabaseConnection>& _db);
virtual ~AmqpTransaction();
DatabaseConnection *dbConn() { return db.get(); }
- void begin();
- void commit();
- void abort();
+ void sqlBegin();
+ void sqlCommit();
+ void sqlAbort();
};
/**
@@ -69,14 +66,18 @@ public:
*/
class AmqpTPCTransaction : public AmqpTransaction,
public qpid::broker::TPCTransactionContext {
+ bool prepared;
std::string xid;
public:
- AmqpTPCTransaction(std::auto_ptr<DatabaseConnection>& _db,
+ AmqpTPCTransaction(const boost::shared_ptr<DatabaseConnection>& db,
const std::string& _xid);
virtual ~AmqpTPCTransaction();
- void prepare();
+ void setPrepared(void) { prepared = true; }
+ bool isPrepared(void) const { return prepared; }
+
+ const std::string& getXid(void) const { return xid; }
};
}}} // namespace qpid::store::ms_sql