Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 76830 of IDBTransactionSync

  • Revision slug: IndexedDB/IDBTransactionSync
  • Revision title: IDBTransactionSync
  • Revision id: 76830
  • Created:
  • Creator: jswisher
  • Is current revision? No
  • Comment 1 words added, 1 words removed

Revision Content

{{ 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.

Revision Source

<p>{{ Fx_minversion_header("4") }}{{ draft() }}</p>
<p>The <code>IDBTransactionSync</code> interface of the <a href="/en/IndexedDB" title="en/IndexedDB">IndexedDB API</a> 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.</p>
<p>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.</p>
<h2>Method overview</h2>
<table class="standard-table"> <tbody> <tr> <td><code>void <a href="#abort" title="#abort">abort</a>() raises (<a href="/en/IndexedDB/IDBDatabaseException" title="en/indexedDB/IDBDatabaseException">IDBDatabaseException</a>); </code></td> </tr> <tr> <td><code>void <a href="#commit" title="#commit">commit</a>() raises (<a href="/en/IndexedDB/IDBDatabaseException" title="en/indexedDB/IDBDatabaseException">IDBDatabaseException</a>);</code></td> </tr> <tr> <td><code><a href="/en/IndexedDB/IDBObjectStoreSync" title="en/IndexedDB/IDBObjectStoreSync">IDBObjectStoreSync</a> <a href="#objectStore" title="#objectStore">objectStore</a>(in DOMString name) raises (<a href="/en/IndexedDB/IDBDatabaseException" title="en/indexedDB/IDBDatabaseException">IDBDatabaseException</a>);</code></td> </tr> </tbody>
</table>
<h2>Attributes</h2>
<table class="standard-table"> <thead> <tr> <th scope="col">Attribute</th> <th scope="col">Type</th> <th scope="col">Description</th> </tr> </thead> <tbody> <tr> <td><a name="attr_db"><code>db</code></a></td> <td><code><a href="/en/IndexedDB/IDBDatabaseSync" title="en/IndexedDB/IDBDatabaseSync">IDBDatabaseSync</a></code></td> <td>The database connection that this transaction is associated with.</td> </tr> <tr> <td><a name="attr_static"><code>static</code></a></td> <td><code>boolean</code></td> <td>If true, this transaction is static; if false, this transaction is dynamic.</td> </tr> </tbody>
</table>
<h2>Methods</h2>
<h3 name="abort">abort()</h3>
<p>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.</p>
<pre>void abort(
) raises (IDBDatabaseException);
</pre>
<h5>Exceptions</h5>
<p>This method can raise an IDBDatabaseException with the following code:</p>
<dl> <dt><code><a href="/en/IndexedDB/IDBDatabaseException#NON_TRANSIENT_ERR" title="en/IndexedDB/DatabaseException#NON TRANSIENT ERR">NON_TRANSIENT_ERR</a></code></dt> <dd>If this transaction has already been committed or aborted.</dd>
</dl>
<h3 name="commit">commit()</h3>
<p>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.</p>
<pre>void commit(
) raises (IDBDatabaseException);
</pre>
<h5>Exceptions</h5>
<p>This method can raise an IDBDatabaseException with the following codes:</p>
<dl> <dt><code><a href="/en/IndexedDB/IDBDatabaseException#NON_TRANSIENT_ERR" title="en/IndexedDB/DatabaseException#NON TRANSIENT ERR">NON_TRANSIENT_ERR</a></code></dt> <dd>If this transaction has already been committed or aborted.</dd> <dt><code><a href="/en/IndexedDB/IDBDatabaseException#RECOVERABLE_ERR" title="en/IndexedDB/DatabaseException#RECOVERABLE ERR">RECOVERABLE_ERR</a></code></dt> <dd>If this transaction's scope is dynamic, and the browser cannot commit all of the changes due to another transaction.</dd>
</dl>
<h3>objectStore()</h3>
<p>Returns an object store that has already been added to the scope of this transaction.</p>
<pre><code>IDBObjectStoreSync objectStore(<br>  in DOMString name<br>) raises (IDBDatabaseException);</code>
</pre>
<h5>Parameters</h5>
<dl> <dt>name</dt> <dd>The name of the requested object store.</dd>
</dl>
<h5>Returns</h5>
<dl> <dt><a href="/IDBObjectStoreSync" title="IDBObjectStoreSync">IDBObjectStoreSync</a></dt> <dd>An object for accessing the requested object store.</dd>
</dl>
<h5>Exceptions</h5>
<p>The method can raise an IDBDatabaseException with the following code:</p>
<dl> <dt><code><a href="/en/IndexedDB/IDBDatabaseException#NOT_FOUND_ERR" title="en/IndexedDB/DatabaseException#NOT FOUND ERR">NOT_FOUND_ERR</a></code></dt> <dd>If the requested object store is not in this transaction's scope.</dd>
</dl>
Revert to this revision