There are times when you want to abort only a portion of a transaction. You may be processing several optional paths of a program, going down one branch, then backing out and trying another branch. It may be possible that you don’t want any of the updates to occur until you are completely finished, but you want the flexibility to back out part of the updates. Another possibility would be if you have run into some form of update error, such as an add record failing due to a duplicate key. You would want to back up to a prior point, correct the problem, and continue. The c-tree Servers let you implement this by using savepoints.
A savepoint is a temporary spot in the transaction that you may want to rollback to without having to abort the entire transaction. During a transaction, when you want to put a placeholder in the process, call the SetSavePoint() method. This does not commit any of the updates. The function returns a savepoint number, which you should keep track of. You can make as many SavePoint calls as you wish during a transaction, and each time you will be given a unique savepoint number.
When you decide that you want to rollback to a savepoint previously saved by a call to SetSavePoint(), issue a RestoreSavePoint() call. You should pass to RestoreSavePoint() the savepoint number that you saved.. This returns your data to the state it was at the point you issued the specified SetSavePoint() call, without aborting the entire transaction.