GetDuplicateCount() public method

Returns the number of duplicate keys
This method wraps the native ups_cursor_get_duplicate_count function.
Returns the number of duplicate keys of the item to which the Cursor currently refers.
Returns 1 if the key has no duplicates.
/// /// /// if the Cursor does not point to any item /// ///
public GetDuplicateCount ( ) : int
return int
Beispiel #1
0
        private void GetDuplicateCount()
        {
            Cursor c = new Cursor(db);
            byte[] k1 = new byte[5]; k1[0] = 5;
            byte[] r1 = new byte[5]; r1[0] = 1;
            byte[] r2 = new byte[5]; r2[0] = 2;
            byte[] r3 = new byte[5]; r2[0] = 2;
            c.Insert(k1, r1);
            Assert.AreEqual(1, c.GetDuplicateCount());

            c.Insert(k1, r2, UpsConst.UPS_DUPLICATE);
            Assert.AreEqual(2, c.GetDuplicateCount());

            c.Insert(k1, r3, UpsConst.UPS_DUPLICATE);
            Assert.AreEqual(3, c.GetDuplicateCount());

            c.Erase();
            c.MoveFirst();
            Assert.AreEqual(2, c.GetDuplicateCount());
        }