database.beginTransaction()

NES2+Syntax

							database.beginTransaction()

Description

The beginTransaction() method of the database object begins a new SQL transaction. This groups all the actions against the database together until the user exits the page or either the commitTransaction() or rollbackTransaction() methods are called. In the instance of the user exiting the page, the transaction is either committed or rolled back, depending on setting of the commit flag when the database object instance is created.

Note

You cannot have nested transactions.

Example

Listing 8.38 creates a connection to an Oracle database. After the connection has been verified, the beginTransaction() method is called and a SQL query is performed. The results are ...

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.