With version 2 storage this will revert the contents of tree to it's initial state when the file was first opened, or to the state captured with the last call to commit. Any transaction log data will be truncated.
Syntax
Visual Basic (Declaration) | |
---|
Public Sub Rollback() |
C# | |
---|
public void Rollback() |
Exceptions
Example
BPlusTree/BPlusTree.Test/BasicTestsVersion2.cs
C# | Copy Code |
---|
using (BPlusTree<int, string> tree = Create(Options))
{
tree.EnableCount();
Assert.AreEqual(0, tree.Count);
tree.Rollback();
Assert.AreEqual(0, tree.Count);
tree.Commit();
Assert.AreEqual(0, tree.Count);
tree.Add(1, "A");
tree.Rollback();
Assert.AreEqual(0, tree.Count);
tree.Commit();
Assert.AreEqual(0, tree.Count);
tree.Add(1, "A");
tree.Commit();
Assert.AreEqual(1, tree.Count);
tree.Rollback();
Assert.AreEqual(1, tree.Count);
tree.Add(2, "B");
tree.Rollback();
Assert.AreEqual(1, tree.Count);
tree[1] = "abc";
tree.Commit();
Assert.AreEqual(1, tree.Count);
tree.Rollback();
Assert.AreEqual("abc", tree[1]);
Assert.IsFalse(tree.ContainsKey(2));
} |
VB.NET | Copy Code |
---|
Using tree As BPlusTree(Of Integer, String) = Create(Options)
tree.EnableCount()
Assert.AreEqual(0, tree.Count)
tree.Rollback()
Assert.AreEqual(0, tree.Count)
tree.Commit()
Assert.AreEqual(0, tree.Count)
tree.Add(1, "A")
tree.Rollback()
Assert.AreEqual(0, tree.Count)
tree.Commit()
Assert.AreEqual(0, tree.Count)
tree.Add(1, "A")
tree.Commit()
Assert.AreEqual(1, tree.Count)
tree.Rollback()
Assert.AreEqual(1, tree.Count)
tree.Add(2, "B")
tree.Rollback()
Assert.AreEqual(1, tree.Count)
tree(1) = "abc"
tree.Commit()
Assert.AreEqual(1, tree.Count)
tree.Rollback()
Assert.AreEqual("abc", tree(1))
Assert.IsFalse(tree.ContainsKey(2))
End Using |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also