summaryrefslogtreecommitdiff
path: root/cpp/src/Freeze/MapI.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2012-08-07 23:05:18 +0200
committerJose <jose@zeroc.com>2012-08-07 23:05:18 +0200
commitdbdb41800b6bc489234cf0fc065156273933274b (patch)
treeb86cc22a397801de4299ae02f74069eaf35d1de0 /cpp/src/Freeze/MapI.cpp
parentICE-4804 - Properties and case-mismatch (diff)
downloadice-dbdb41800b6bc489234cf0fc065156273933274b.tar.bz2
ice-dbdb41800b6bc489234cf0fc065156273933274b.tar.xz
ice-dbdb41800b6bc489234cf0fc065156273933274b.zip
ICE-4755 - Freeze and DB 5.x
Diffstat (limited to 'cpp/src/Freeze/MapI.cpp')
-rw-r--r--cpp/src/Freeze/MapI.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp
index a136dee7a46..97911587265 100644
--- a/cpp/src/Freeze/MapI.cpp
+++ b/cpp/src/Freeze/MapI.cpp
@@ -440,13 +440,22 @@ Freeze::IteratorHelperI::find(const Key& key) const
{
Dbt dbKey;
initializeInDbt(key, dbKey);
+#if (DB_VERSION_MAJOR <= 4) || (DB_VERSION_MAJOR == 5 && DB_VERSION_MINOR <= 1)
//
// When we have a custom-comparison function, Berkeley DB returns
// the key on-disk (when it finds one). We disable this behavior:
// (ref Oracle SR 5925672.992)
//
dbKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
-
+#else
+ //
+ // In DB > 5.1 we can not set DB_DBT_PARTIAL in the key Dbt,
+ // when using DB_SET, we must resize the Dbt key param to hold enought
+ // space or Dbc::get fails with DB_BUFFER_SMALL.
+ //
+ dbKey.set_flags(DB_DBT_USERMEM);
+ dbKey.set_ulen(static_cast<u_int32_t>(key.size()));
+#endif
//
// Keep 0 length since we're not interested in the data
//
@@ -1766,12 +1775,22 @@ Freeze::MapIndexI::untypedCount(const Key& k, const ConnectionIPtr& connection)
{
Dbt dbKey;
initializeInDbt(k, dbKey);
+#if (DB_VERSION_MAJOR <= 4)
//
// When we have a custom-comparison function, Berkeley DB returns
// the key on-disk (when it finds one). We disable this behavior:
// (ref Oracle SR 5925672.992)
//
dbKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
+#else
+ //
+ // In DB 5.x we can not set DB_DBT_PARTIAL in the key Dbt,
+ // when using DB_SET, we must resize the Dbt key param to hold enought
+ // space or Dbc::get fails with DB_BUFFER_SMALL.
+ //
+ dbKey.set_flags(DB_DBT_USERMEM);
+ dbKey.set_ulen(static_cast<u_int32_t>(k.size()));
+#endif
Dbt dbValue;