private void MoveLast() { Cursor c = new Cursor(db); byte[] k = new byte[5]; byte[] r = new byte[5]; db.Insert(k, r); c.MoveLast(); }
private void Cursor10000Test() { //create database Upscaledb.Environment env = new Upscaledb.Environment(); env.Create("ntest.db"); Parameter[] param = new Parameter[1]; param[0] = new Parameter(); param[0].name = UpsConst.UPS_PARAM_KEY_TYPE; param[0].value = UpsConst.UPS_TYPE_UINT64; Database db = env.CreateDatabase(1, 0, param); //insert records for (ulong i = 0; i < 10000; i++) { byte[] key = BitConverter.GetBytes(i); byte[] record = new byte[20]; db.Insert(key, record); } //close database db.Close(); //reopen again db = env.OpenDatabase(1); Cursor cursor = new Cursor(db); cursor.MoveFirst(); ulong firstKey = BitConverter.ToUInt64(cursor.GetKey(), 0); Assert.AreEqual((ulong)0, firstKey); cursor.MoveLast(); ulong lastKey = BitConverter.ToUInt64(cursor.GetKey(), 0); Assert.AreEqual((ulong)9999, lastKey); //close database cursor.Close(); db.Close(); env.Close(); }