Small. Fast. Reliable.
Choose any three.

SQLite Requirement Matrix Details
lang_savepoint.html

Index Summary Markup Original


R-04005-08111-39731-15170-36576-49560-64443-15597 tcl slt th3 src

SAVEPOINTs are a method of creating transactions, similar to BEGIN and COMMIT, except that the SAVEPOINT and RELEASE commands are named and may be nested.

/* IMP: R-04005-08111 */
# EVIDENCE-OF: R-04005-08111 SAVEPOINTs are a method of creating
# transactions, similar to BEGIN and COMMIT, except that the SAVEPOINT
# and RELEASE commands are named and may be nested.

R-57963-05936-27484-31794-06157-35153-01891-09927 tcl slt th3 src

The SAVEPOINT command starts a new transaction with a name.

/* IMP: R-57963-05936 */
# EVIDENCE-OF: R-57963-05936 The SAVEPOINT command starts a new
# transaction with a name.

R-62101-33764-02885-01676-40188-04354-35995-63967 tcl slt th3 src

The transaction names need not be unique.

/* IMP: R-62101-33764 */
# EVIDENCE-OF: R-62101-33764 The transaction names need not be unique.

R-18818-06259-05609-26467-03914-52420-50425-49000 tcl slt th3 src

A SAVEPOINT can be started either within or outside of a BEGIN...COMMIT.

/* IMP: R-18818-06259 */
# EVIDENCE-OF: R-18818-06259 A SAVEPOINT can be started either within or
# outside of a BEGIN...COMMIT.

R-38828-57497-43339-57489-42530-28213-54283-40875 tcl slt th3 src

When a SAVEPOINT is the outer-most savepoint and it is not within a BEGIN...COMMIT then the behavior is the same as BEGIN DEFERRED TRANSACTION.

/* IMP: R-38828-57497 */
# EVIDENCE-OF: R-38828-57497 When a SAVEPOINT is the outer-most
# savepoint and it is not within a BEGIN...COMMIT then the behavior is
# the same as BEGIN DEFERRED TRANSACTION.

R-18401-29434-64954-06986-64183-65174-36377-46247 tcl slt th3 src

The ROLLBACK TO command reverts the state of the database back to what it was just after the corresponding SAVEPOINT.

/* IMP: R-18401-29434 */
# EVIDENCE-OF: R-18401-29434 The ROLLBACK TO command reverts the state
# of the database back to what it was just after the corresponding
# SAVEPOINT.

R-10477-59572-35916-33197-44074-53826-19513-26308 tcl slt th3 src

Note that unlike that plain ROLLBACK command (without the TO keyword) the ROLLBACK TO command does not cancel the transaction.

/* IMP: R-10477-59572 */
# EVIDENCE-OF: R-10477-59572 Note that unlike that plain ROLLBACK
# command (without the TO keyword) the ROLLBACK TO command does not
# cancel the transaction.

R-07727-56631-19058-51033-37798-11219-19213-34496 tcl slt th3 src

Instead of cancelling the transaction, the ROLLBACK TO command restarts the transaction again at the beginning.

/* IMP: R-07727-56631 */
# EVIDENCE-OF: R-07727-56631 Instead of cancelling the transaction, the
# ROLLBACK TO command restarts the transaction again at the beginning.

R-10722-45310-03105-41587-65268-38930-36590-56175 tcl slt th3 src

All intervening SAVEPOINTs are canceled, however.

/* IMP: R-10722-45310 */
# EVIDENCE-OF: R-10722-45310 All intervening SAVEPOINTs are canceled,
# however.

R-07434-39946-64395-56249-16923-20954-34684-05720 tcl slt th3 src

The RELEASE command is like a COMMIT for a SAVEPOINT.

/* IMP: R-07434-39946 */
# EVIDENCE-OF: R-07434-39946 The RELEASE command is like a COMMIT for a
# SAVEPOINT.

R-60758-29241-24503-58415-42517-14147-34293-65020 tcl slt th3 src

The RELEASE command causes all savepoints back to and including the most recent savepoint with a matching name to be removed from the transaction stack.

/* IMP: R-60758-29241 */
# EVIDENCE-OF: R-60758-29241 The RELEASE command causes all savepoints
# back to and including the most recent savepoint with a matching name
# to be removed from the transaction stack.

R-45106-55778-23498-47099-45026-10871-39267-61418 tcl slt th3 src

The RELEASE of an inner transaction does not cause any changes to be written to the database file; it merely removes savepoints from the transaction stack such that it is no longer possible to ROLLBACK TO those savepoints.

/* IMP: R-45106-55778 */
# EVIDENCE-OF: R-45106-55778 The RELEASE of an inner transaction does
# not cause any changes to be written to the database file; it merely
# removes savepoints from the transaction stack such that it is no
# longer possible to ROLLBACK TO those savepoints.

R-23935-31469-05351-59076-27167-07827-26621-20596 tcl slt th3 src

If a RELEASE command releases the outermost savepoint, so that the transaction stack becomes empty, then RELEASE is the same as COMMIT.

/* IMP: R-23935-31469 */
# EVIDENCE-OF: R-23935-31469 If a RELEASE command releases the outermost
# savepoint, so that the transaction stack becomes empty, then RELEASE
# is the same as COMMIT.

R-00695-31519-05206-48434-15068-58741-03264-34333 tcl slt th3 src

The COMMIT command may be used to release all savepoints and commit the transaction even if the transaction was originally started by a SAVEPOINT command instead of a BEGIN command.

/* IMP: R-00695-31519 */
# EVIDENCE-OF: R-00695-31519 The COMMIT command may be used to release
# all savepoints and commit the transaction even if the transaction was
# originally started by a SAVEPOINT command instead of a BEGIN command.

R-65068-25814-18099-09241-35748-05178-29106-53953 tcl slt th3 src

If the savepoint-name in a RELEASE command does not match any savepoint currently in the transaction stack, then no savepoints are released, the database is unchanged, and the RELEASE command returns an error.

/* IMP: R-65068-25814 */
# EVIDENCE-OF: R-65068-25814 If the savepoint-name in a RELEASE command
# does not match any savepoint currently in the transaction stack, then
# no savepoints are released, the database is unchanged, and the RELEASE
# command returns an error.

R-28351-07091-05361-50500-02238-36187-02311-00737 tcl slt th3 src

Note that an inner transaction might commit (using the RELEASE command) but then later have its work undone by a ROLLBACK in an outer transaction.

/* IMP: R-28351-07091 */
# EVIDENCE-OF: R-28351-07091 Note that an inner transaction might commit
# (using the RELEASE command) but then later have its work undone by a
# ROLLBACK in an outer transaction.

R-02961-26666-41829-02507-08304-47031-60058-62132 tcl slt th3 src

A power failure or program crash or OS crash will cause the outer-most transaction to rollback, undoing all changes that have occurred within that outer transaction, even changes that have supposedly been "committed" by the RELEASE command.

/* IMP: R-02961-26666 */
# EVIDENCE-OF: R-02961-26666 A power failure or program crash or OS
# crash will cause the outer-most transaction to rollback, undoing all
# changes that have occurred within that outer transaction, even changes
# that have supposedly been "committed" by the RELEASE command.

R-28530-22001-17760-49127-38466-18799-32025-16275 tcl slt th3 src

Content is not actually committed on the disk until the outermost transaction commits.

/* IMP: R-28530-22001 */
# EVIDENCE-OF: R-28530-22001 Content is not actually committed on the
# disk until the outermost transaction commits.

R-51202-43754-48199-60556-57882-64692-40949-61434 tcl slt th3 src

The last transaction started will be the first transaction committed or rolled back.

/* IMP: R-51202-43754 */
# EVIDENCE-OF: R-51202-43754 The last transaction started will be the
# first transaction committed or rolled back.

R-19672-38383-43870-63614-05691-24053-06228-32918 tcl slt th3 src

The BEGIN command only works if the transaction stack is empty, or in other words if there are no pending transactions.

/* IMP: R-19672-38383 */
# EVIDENCE-OF: R-19672-38383 The BEGIN command only works if the
# transaction stack is empty, or in other words if there are no pending
# transactions.

R-59172-51198-22956-23364-43321-06820-15140-44023 tcl slt th3 src

If the transaction stack is not empty when the BEGIN command is invoked, then the command fails with an error.

/* IMP: R-59172-51198 */
# EVIDENCE-OF: R-59172-51198 If the transaction stack is not empty when
# the BEGIN command is invoked, then the command fails with an error.

R-48711-46457-28354-47973-39166-41669-11371-37006 tcl slt th3 src

The COMMIT command commits all outstanding transactions and leaves the transaction stack empty.

/* IMP: R-48711-46457 */
# EVIDENCE-OF: R-48711-46457 The COMMIT command commits all outstanding
# transactions and leaves the transaction stack empty.

R-12830-59321-61911-43156-38228-08390-44545-62549 tcl slt th3 src

The RELEASE command starts with the most recent addition to the transaction stack and releases savepoints backwards in time until it releases a savepoint with a matching savepoint-name.

/* IMP: R-12830-59321 */
# EVIDENCE-OF: R-12830-59321 The RELEASE command starts with the most
# recent addition to the transaction stack and releases savepoints
# backwards in time until it releases a savepoint with a matching
# savepoint-name.

R-38293-42495-20916-29854-03664-36898-47028-10197 tcl slt th3 src

Prior savepoints, even savepoints with matching savepoint-names, are unchanged.

/* IMP: R-38293-42495 */
# EVIDENCE-OF: R-38293-42495 Prior savepoints, even savepoints with
# matching savepoint-names, are unchanged.

R-55606-57227-21877-64681-10447-20017-21356-32881 tcl slt th3 src

If the RELEASE command causes the transaction stack to become empty (if the RELEASE command releases the outermost transaction from the stack) then the transaction commits.

/* IMP: R-55606-57227 */
# EVIDENCE-OF: R-55606-57227 If the RELEASE command causes the
# transaction stack to become empty (if the RELEASE command releases the
# outermost transaction from the stack) then the transaction commits.

R-18711-35549-27220-03897-01638-65186-51204-23198 tcl slt th3 src

The ROLLBACK command without a TO clause rolls backs all transactions and leaves the transaction stack empty.

/* IMP: R-18711-35549 */
# EVIDENCE-OF: R-18711-35549 The ROLLBACK command without a TO clause
# rolls backs all transactions and leaves the transaction stack empty.

R-29144-37270-15316-24457-48532-24353-08508-55125 tcl slt th3 src

The ROLLBACK command with a TO clause rolls back transactions going backwards in time back to the most recent SAVEPOINT with a matching name.

/* IMP: R-29144-37270 */
# EVIDENCE-OF: R-29144-37270 The ROLLBACK command with a TO clause rolls
# back transactions going backwards in time back to the most recent
# SAVEPOINT with a matching name.

R-19003-27813-57127-49100-22413-58501-27554-18699 tcl slt th3 src

The SAVEPOINT with the matching name remains on the transaction stack, but all database changes that occurred after that SAVEPOINT was created are rolled back.

/* IMP: R-19003-27813 */
# EVIDENCE-OF: R-19003-27813 The SAVEPOINT with the matching name
# remains on the transaction stack, but all database changes that
# occurred after that SAVEPOINT was created are rolled back.

R-29830-14325-45586-46074-54512-52450-29043-42603 tcl slt th3 src

If the savepoint-name in a ROLLBACK TO command does not match any SAVEPOINT on the stack, then the ROLLBACK command fails with an error and leaves the state of the database unchanged.

/* IMP: R-29830-14325 */
# EVIDENCE-OF: R-29830-14325 If the savepoint-name in a ROLLBACK TO
# command does not match any SAVEPOINT on the stack, then the ROLLBACK
# command fails with an error and leaves the state of the database
# unchanged.