示例#1
0
 public void Erase()
 {
     Cursor c = new Cursor(db);
     byte[] k1 = new byte[5]; k1[0] = 5;
     byte[] r1 = new byte[5]; r1[0] = 1;
     c.Insert(k1, r1);
     c.Erase();
 }
示例#2
0
 public void EraseNegative()
 {
     Cursor c = new Cursor(db);
     try {
         c.Erase();
     }
     catch (DatabaseException e) {
         Assert.AreEqual(HamConst.HAM_CURSOR_IS_NIL, e.ErrorCode);
     }
 }
示例#3
0
        public 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, HamConst.HAM_DUPLICATE);
            Assert.AreEqual(2, c.GetDuplicateCount());

            c.Insert(k1, r3, HamConst.HAM_DUPLICATE);
            Assert.AreEqual(3, c.GetDuplicateCount());

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