diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/Freeze/IndexI.cpp | 17 | ||||
-rw-r--r-- | cpp/src/Freeze/MapI.cpp | 19 |
2 files changed, 30 insertions, 6 deletions
diff --git a/cpp/src/Freeze/IndexI.cpp b/cpp/src/Freeze/IndexI.cpp index 50509e66b8e..cd1b2a929ea 100644 --- a/cpp/src/Freeze/IndexI.cpp +++ b/cpp/src/Freeze/IndexI.cpp @@ -41,12 +41,14 @@ Freeze::IndexI::untypedFindFirst(const Key& bytes, Int firstN) const Dbt dbKey; initializeInDbt(bytes, dbKey); - // - // Berkeley DB 4.1.25 bug: it should not write into dbKey + // 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_ulen(static_cast<u_int32_t>(bytes.size())); - + dbKey.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); + + Key pkey(1024); Dbt pdbKey; initializeOutDbt(pkey, pdbKey); @@ -185,6 +187,13 @@ Freeze::IndexI::untypedCount(const Key& bytes) const Dbt dbKey; initializeInDbt(bytes, dbKey); + // + // 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); + Dbt dbValue; dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); diff --git a/cpp/src/Freeze/MapI.cpp b/cpp/src/Freeze/MapI.cpp index 5d6744252a2..4c3783dca80 100644 --- a/cpp/src/Freeze/MapI.cpp +++ b/cpp/src/Freeze/MapI.cpp @@ -224,7 +224,13 @@ Freeze::IteratorHelperI::find(const Key& key) const { Dbt dbKey; initializeInDbt(key, dbKey); - + // + // 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); + // // Keep 0 length since we're not interested in the data // @@ -257,7 +263,9 @@ Freeze::IteratorHelperI::find(const Key& key) const } catch(const ::DbException& dx) { - handleDbException(dx, const_cast<Key&>(key), dbKey, __FILE__, __LINE__); + DatabaseException ex(__FILE__, __LINE__); + ex.message = dx.what(); + throw ex; } } } @@ -1470,6 +1478,13 @@ Freeze::MapIndexI::untypedCount(const Key& k, const ConnectionIPtr& connection) { Dbt dbKey; initializeInDbt(k, dbKey); + // + // 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); + Dbt dbValue; dbValue.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL); |