/// <summary> /// Sets the comparison function /// </summary> /// <remarks> /// This method wraps the native ups_db_set_compare_func function.<br /> /// <br /> /// The <see cref="CompareFunc" /> delegate compares two index keys. /// It returns -1 if the first key is smaller, +1 if the second key /// is smaller or 0 if both keys are equal.<br /> /// <br /> /// If <paramref name="foo"/> is null, upscaledb will use the default /// compare function (which is based on memcmp(3)).<br /> /// </remarks> /// <param name="foo">The compare delegate, or null</param> public void SetCompareFunc(CompareFunc foo) { int st; lock (this) { st = NativeMethods.SetCompareFunc(handle, pinnedCompareFunc); } if (st != 0) { throw new DatabaseException(st); } CompareFoo = foo; }
/// <summary> /// Sets the comparison function /// </summary> /// <remarks> /// This method wraps the native ups_db_set_compare_func function.<br /> /// <br /> /// The <see cref="CompareFunc" /> delegate compares two index keys. /// It returns -1 if the first key is smaller, +1 if the second key /// is smaller or 0 if both keys are equal.<br /> /// <br /> /// If <paramref name="foo"/> is null, upscaledb will use the default /// compare function (which is based on memcmp(3)).<br /> /// </remarks> /// <param name="foo">The compare delegate, or null</param> public void SetCompareFunc(CompareFunc foo) { int st; lock (this) { CompareFunc pinned = new CompareFunc(foo); callbacks.Add(pinned); st = NativeMethods.SetCompareFunc(handle, pinned); } if (st != 0) { throw new DatabaseException(st); } }