database.rollbackTransaction()

NES2+Syntax

							database.rollbackTransaction()

Description

The rollbackTransaction() method of the database object will undo all actions performed since the last beginTransaction() method call.

Note

You cannot have nested transactions.

Example

Listing 8.50 takes a commit field sent to the application from the user. If this evaluates to TRUE, the transaction is committed. If not, it is rolled back.

Listing 8.50 Rolling Back a Transaction with the rollbackTransaction() Method
 <SERVER> // See if the user wants to commit the last transaction client.commit = request.commit; if(client.commit = "YES"){ // Commit the transaction myConn.commitTransaction(); }else{ // Rollback the transaction myConn.rollbackTransaction(); ...

Get Pure JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.