summaryrefslogtreecommitdiff
path: root/cpp/src/Freeze/MapI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Freeze/MapI.cpp')
-rw-r--r--cpp/src/Freeze/MapI.cpp79
1 files changed, 20 insertions, 59 deletions
diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp
index 0766bc034d0..0bfbbd0b008 100644
--- a/cpp/src/Freeze/MapI.cpp
+++ b/cpp/src/Freeze/MapI.cpp
@@ -299,39 +299,6 @@ Freeze::IteratorHelperI::get(const Key*& key, const Value*& value) const
throw DatabaseException(__FILE__, __LINE__);
}
}
- catch(const ::DbMemoryException dx)
- {
- bool resizing = false;
- if(dbKey.get_size() > dbKey.get_ulen())
- {
- //
- // Let's resize key
- //
- _key.resize(dbKey.get_size());
- initializeOutDbt(_key, dbKey);
- resizing = true;
- }
-
- if(dbValue.get_size() > dbValue.get_ulen())
- {
- //
- // Let's resize value
- //
- _value.resize(dbValue.get_size());
- initializeOutDbt(_value, dbValue);
- resizing = true;
- }
-
- if(!resizing)
- {
- //
- // Real problem
- //
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- }
catch(const ::DbDeadlockException& dx)
{
if(_tx != 0)
@@ -345,9 +312,16 @@ Freeze::IteratorHelperI::get(const Key*& key, const Value*& value) const
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(dx.get_errno() == DB_BUFFER_SMALL)
+ {
+ handleMemoryException(dx, _key, dbKey, _value, dbValue);
+ }
+ else
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
}
@@ -409,26 +383,6 @@ Freeze::IteratorHelperI::get() const
throw DatabaseException(__FILE__, __LINE__);
}
}
- catch(const ::DbMemoryException dx)
- {
- if(dbKey.get_size() > dbKey.get_ulen())
- {
- //
- // Let's resize key
- //
- _key.resize(dbKey.get_size());
- initializeOutDbt(_key, dbKey);
- }
- else
- {
- //
- // Real problem
- //
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
- }
- }
catch(const ::DbDeadlockException& dx)
{
if(_tx != 0)
@@ -442,9 +396,16 @@ Freeze::IteratorHelperI::get() const
}
catch(const ::DbException& dx)
{
- DatabaseException ex(__FILE__, __LINE__);
- ex.message = dx.what();
- throw ex;
+ if(dx.get_errno() == DB_BUFFER_SMALL)
+ {
+ handleMemoryException(dx, _key, dbKey);
+ }
+ else
+ {
+ DatabaseException ex(__FILE__, __LINE__);
+ ex.message = dx.what();
+ throw ex;
+ }
}
}
}