diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-05-30 13:18:35 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-05-30 13:18:35 +0000 |
commit | cd8abbb04a79b0d93f34742c49b06607e4e989f7 (patch) | |
tree | fabe04903dac6bd3ecf2ac6f3248ab5c22300fa7 /cpp/src/Freeze/ObjectStore.cpp | |
parent | fix problem with possible use of uninitialized local variable (diff) | |
download | ice-cd8abbb04a79b0d93f34742c49b06607e4e989f7.tar.bz2 ice-cd8abbb04a79b0d93f34742c49b06607e4e989f7.tar.xz ice-cd8abbb04a79b0d93f34742c49b06607e4e989f7.zip |
Removed transactional evictor context
Diffstat (limited to 'cpp/src/Freeze/ObjectStore.cpp')
-rw-r--r-- | cpp/src/Freeze/ObjectStore.cpp | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/cpp/src/Freeze/ObjectStore.cpp b/cpp/src/Freeze/ObjectStore.cpp index 77556081f22..f472cba7614 100644 --- a/cpp/src/Freeze/ObjectStore.cpp +++ b/cpp/src/Freeze/ObjectStore.cpp @@ -160,8 +160,18 @@ Freeze::ObjectStoreBase::~ObjectStoreBase() } bool -Freeze::ObjectStoreBase::dbHasObject(const Identity& ident, DbTxn* tx) const +Freeze::ObjectStoreBase::dbHasObject(const Identity& ident, const TransactionIPtr& transaction) const { + DbTxn* tx = 0; + if(transaction != 0) + { + tx = transaction->dbTxn(); + if(tx == 0) + { + throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); + } + } + Key key; marshal(ident, key, _communicator); Dbt dbKey; @@ -305,13 +315,18 @@ Freeze::ObjectStoreBase::unmarshal(ObjectRecord& v, const Value& bytes, const Co } bool -Freeze::ObjectStoreBase::load(const Identity& ident, const TransactionIPtr& tx, ObjectRecord& rec) +Freeze::ObjectStoreBase::load(const Identity& ident, const TransactionIPtr& transaction, ObjectRecord& rec) { - DbTxn* txn = tx->dbTxn(); + if(transaction == 0) + { + throw DatabaseException(__FILE__, __LINE__, "no active transaction"); + } + + DbTxn* txn = transaction->dbTxn(); if(txn == 0) { - throw DatabaseException(__FILE__, __LINE__, "invalid TransactionalEvictorContext"); + throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); } Key key; @@ -364,13 +379,18 @@ Freeze::ObjectStoreBase::load(const Identity& ident, const TransactionIPtr& tx, } void -Freeze::ObjectStoreBase::update(const Identity& ident, const ObjectRecord& rec, const TransactionIPtr& tx) +Freeze::ObjectStoreBase::update(const Identity& ident, const ObjectRecord& rec, const TransactionIPtr& transaction) { - DbTxn* txn = tx->dbTxn(); + if(transaction == 0) + { + throw DatabaseException(__FILE__, __LINE__, "no active transaction"); + } + + DbTxn* txn = transaction->dbTxn(); if(txn == 0) { - throw DatabaseException(__FILE__, __LINE__, "invalid TransactionalEvictorContext"); + throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); } Key key; @@ -406,8 +426,18 @@ Freeze::ObjectStoreBase::update(const Identity& ident, const ObjectRecord& rec, } bool -Freeze::ObjectStoreBase::insert(const Identity& ident, const ObjectRecord& rec, DbTxn* tx) +Freeze::ObjectStoreBase::insert(const Identity& ident, const ObjectRecord& rec, const TransactionIPtr& transaction) { + DbTxn* tx = 0; + if(transaction != 0) + { + tx = transaction->dbTxn(); + if(tx == 0) + { + throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); + } + } + Key key; marshal(ident, key, _communicator); @@ -454,8 +484,18 @@ Freeze::ObjectStoreBase::insert(const Identity& ident, const ObjectRecord& rec, } bool -Freeze::ObjectStoreBase::remove(const Identity& ident, DbTxn* tx) +Freeze::ObjectStoreBase::remove(const Identity& ident, const TransactionIPtr& transaction) { + DbTxn* tx = 0; + if(transaction != 0) + { + tx = transaction->dbTxn(); + if(tx == 0) + { + throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); + } + } + Key key; marshal(ident, key, _communicator); |