{{ Fx_minversion_header("4") }}{{ draft() }}
The IDBTransactionSync
interface of the IndexedDB API provides a synchronous transaction on a database. When an application creates an IDBTransactionSync object, it blocks until the browser is able to reserve the require database objects.
A transaction represents an atomic and durable set of data access and data mutation operations. A transaction has a scope and a database to which it applies. The scope can be either static or dynamic. If the scope is static, either it can cover all of the object stores and indexes in the database, or it may include a subset of them. Transactions are expected to be short-lived. The browser can terminate a transaction that takes too long, in order to free up storage resources that the long-running transaction has locked.
Method overview
void abort() raises (IDBDatabaseException); |
void commit() raises (IDBDatabaseException); |
IDBObjectStoreSync objectStore(in DOMString name) raises (IDBDatabaseException); |
Attributes
Attribute | Type | Description |
---|---|---|
db | IDBDatabaseSync | The database connection that this transaction is associated with. |
static | boolean | If true, this transaction is static; if false, this transaction is dynamic. |
Methods
abort()
Call this method to signal a need to cancel the effects of the operations performed by this transaction. When this method is called, the browser ignores all the changes performed to the objects of this database since this transaction was created.
void abort( ) raises (IDBDatabaseException);
Exceptions
This method can raise an IDBDatabaseException with the following code:
NON_TRANSIENT_ERR
- If this transaction has already been committed or aborted.
commit()
Call this method to signal that the transaction has completed normally and satisfactorily. When this method is called, the browser durably stores all the changes performed to the objects of the database since this transaction was created.
void commit( ) raises (IDBDatabaseException);
Exceptions
This method can raise an IDBDatabaseException with the following codes:
NON_TRANSIENT_ERR
- If this transaction has already been committed or aborted.
RECOVERABLE_ERR
- If this transaction's scope is dynamic, and the browser cannot commit all of the changes due to another transaction.
objectStore()
Returns an object store that has already been added to the scope of this transaction.
IDBObjectStoreSync objectStore(
in DOMString name
) raises (IDBDatabaseException);
Parameters
- name
- The name of the requested object store.
Returns
- IDBObjectStoreSync
- An object for accessing the requested object store.
Exceptions
The method can raise an IDBDatabaseException with the following code:
NOT_FOUND_ERR
- If the requested object store is not in this transaction's scope.