/// <summary> /// Sets the duplicate comparison function /// </summary> /// <remarks> /// This method wraps the native ham_set_duplicate_compare_func function.<br /> /// <br /> /// The <see cref="CompareFunc" /> delegate compares two records. /// It returns -1 if the first record is smaller, +1 if the second record /// is smaller or 0 if both records are equal.<br /> /// <br /> /// If <paramref name="foo"/> is null, hamsterdb will use the default /// compare function (which is based on memcmp(3)).<br /> /// <br /> /// Note that duplicate comparison has to be enabled with /// <see cref="HamConst.HAM_SORT_DUPLICATES"/>. /// </remarks> /// <param name="foo">The duplicate compare delegate, or null</param> public void SetDuplicateCompareFunc(DuplicateCompareFunc foo) { int st; lock (this) { st = NativeMethods.SetDuplicateCompareFunc(handle, pinnedDupeCompareFunc); } if (st != 0) { throw new DatabaseException(st); } DuplicateCompareFoo = foo; }
/// <summary> /// Sets the duplicate comparison function /// </summary> /// <remarks> /// This method wraps the native ham_set_duplicate_compare_func function.<br /> /// <br /> /// The <see cref="CompareFunc" /> delegate compares two records. /// It returns -1 if the first record is smaller, +1 if the second record /// is smaller or 0 if both records are equal.<br /> /// <br /> /// If <paramref name="foo"/> is null, hamsterdb will use the default /// compare function (which is based on memcmp(3)).<br /> /// <br /> /// Note that duplicate comparison has to be enabled with /// <see cref="HamConst.HAM_SORT_DUPLICATES"/>. /// </remarks> /// <param name="foo">The duplicate compare delegate, or null</param> public void SetDuplicateCompareFunc(DuplicateCompareFunc foo) { int st; lock (this) { st = NativeMethods.SetDuplicateCompareFunc(handle, pinnedDupeCompareFunc); } if (st != 0) throw new DatabaseException(st); DuplicateCompareFoo = foo; }