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 529723 of IDBTransactionSync

  • Revision slug: Web/API/IDBTransactionSync
  • Revision title: IDBTransactionSync
  • Revision id: 529723
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

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

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>{{ draft() }}</p>
<p>The <code>IDBTransactionSync</code> interface of the <a href="/en/IndexedDB" title="en/IndexedDB">IndexedDB&nbsp;API</a> provides a synchronous <a href="/en/IndexedDB#gloss_transaction" title="en/IndexedDB#gloss transaction">transaction</a> on a database. When an application creates an IDBTransactionSync object, it blocks until the browser is able to reserve the require database objects.</p>
<h2 id="Method_overview">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 id="Attributes">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 <a href="/en/IndexedDB#gloss_database_connection" title="en/IndexedDB#gloss database connection">database connection</a> 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 <a href="/en/IndexedDB#gloss_static" title="en/IndexedDB#gloss static">static</a>; if false, this transaction is <a href="/en/IndexedDB#gloss_dynamic" title="en/IndexedDB#gloss dynamic">dynamic</a>.</td>
  </tr>
 </tbody>
</table>
<h2 id="Methods">Methods</h2>
<h3 id="abort" 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 id="Exceptions">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 id="commit" 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 id="Exceptions">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 id="objectStore()">objectStore()</h3>
<p>Returns an <a href="/en/IndexedDB#gloss_object_store" title="en/IndexedDB#gloss object store">object store</a> that has already been added to the scope of this transaction.</p>
<pre>
<code>IDBObjectStoreSync objectStore(
&nbsp; in DOMString name
) raises (IDBDatabaseException);</code>
</pre>
<h5 id="Parameters">Parameters</h5>
<dl>
 <dt>
  name</dt>
 <dd>
  The name of the requested object store.</dd>
</dl>
<h5 id="Returns">Returns</h5>
<dl>
 <dt>
  <code><a href="/IDBObjectStoreSync" title="IDBObjectStoreSync">IDBObjectStoreSync</a></code></dt>
 <dd>
  An object for accessing the requested object store.</dd>
</dl>
<h5 id="Exceptions">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