summaryrefslogtreecommitdiff
path: root/cpp/src/IceDB/IceDB.cpp
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2021-01-28 14:18:08 -0500
committerJoe George <joe@zeroc.com>2021-02-01 16:50:22 -0500
commit3dd23049d2424404255585228ffc5e0314fed7ce (patch)
tree5dd38567c461ab08f0c402f54551b42e23de29cb /cpp/src/IceDB/IceDB.cpp
parentRemove checksum support (#607) (diff)
downloadice-3dd23049d2424404255585228ffc5e0314fed7ce.tar.bz2
ice-3dd23049d2424404255585228ffc5e0314fed7ce.tar.xz
ice-3dd23049d2424404255585228ffc5e0314fed7ce.zip
Port Glacier2, IceBox, IceBridge, IceDB, IceXML, icegriddb
Diffstat (limited to 'cpp/src/IceDB/IceDB.cpp')
-rw-r--r--cpp/src/IceDB/IceDB.cpp38
1 files changed, 26 insertions, 12 deletions
diff --git a/cpp/src/IceDB/IceDB.cpp b/cpp/src/IceDB/IceDB.cpp
index 03701eff884..a9604ec02b9 100644
--- a/cpp/src/IceDB/IceDB.cpp
+++ b/cpp/src/IceDB/IceDB.cpp
@@ -35,7 +35,13 @@ LMDBException::ice_print(ostream& out) const
out << ": " << mdb_strerror(_error);
}
-#ifndef ICE_CPP11_MAPPING
+#ifdef ICE_CPP11_MAPPING
+IceUtil::Exception*
+LMDBException::ice_cloneImpl() const
+{
+ return new LMDBException(*this);
+}
+#else
LMDBException*
LMDBException::ice_clone() const
{
@@ -85,7 +91,13 @@ KeyTooLongException::ice_print(ostream& out) const
out << "Max size = " << maxKeySize;
}
-#ifndef ICE_CPP11_MAPPING
+#ifdef ICE_CPP11_MAPPING
+IceUtil::Exception*
+KeyTooLongException::ice_cloneImpl() const
+{
+ return new KeyTooLongException(*this);
+}
+#else
KeyTooLongException*
KeyTooLongException::ice_clone() const
{
@@ -125,7 +137,13 @@ BadEnvException::ice_print(ostream& out) const
out << ", IceDB max key size = " << maxKeySize;
}
-#ifndef ICE_CPP11_MAPPING
+#ifdef ICE_CPP11_MAPPING
+IceUtil::Exception*
+BadEnvException::ice_cloneImpl() const
+{
+ return new BadEnvException(*this);
+}
+#else
BadEnvException*
BadEnvException::ice_clone() const
{
@@ -223,7 +241,9 @@ Env::menv() const
return _menv;
}
-Txn::Txn(const Env& env, unsigned int flags)
+Txn::Txn(const Env& env, unsigned int flags) :
+ _mtxn(0),
+ _readOnly(flags == MDB_RDONLY)
{
const int rc = mdb_txn_begin(env.menv(), 0, flags, &_mtxn);
if(rc != MDB_SUCCESS)
@@ -266,7 +286,6 @@ Txn::mtxn() const
ReadOnlyTxn::~ReadOnlyTxn()
{
- // Out of line to avoid weak vtable
}
ReadOnlyTxn::ReadOnlyTxn(const Env& env) :
@@ -292,7 +311,6 @@ ReadOnlyTxn::renew()
ReadWriteTxn::~ReadWriteTxn()
{
- // Out of line to avoid weak vtable
}
ReadWriteTxn::ReadWriteTxn(const Env& env) :
@@ -322,10 +340,6 @@ DbiBase::DbiBase() :
{
}
-DbiBase::~DbiBase()
-{
-}
-
void
DbiBase::clear(const ReadWriteTxn& txn)
{
@@ -387,8 +401,8 @@ DbiBase::del(const ReadWriteTxn& txn, MDB_val* key, MDB_val* data)
return rc == MDB_SUCCESS;
}
-CursorBase::CursorBase(MDB_dbi dbi, const Txn& txn, bool readOnly) :
- _readOnly(readOnly)
+CursorBase::CursorBase(MDB_dbi dbi, const Txn& txn) :
+ _readOnly(txn.isReadOnly())
{
const int rc = mdb_cursor_open(txn.mtxn(), dbi, &_mcursor);
if(rc != MDB_SUCCESS)