public class JsIDBDatabase extends JsElementalMixinBase implements IDBDatabase
SVG_ZOOMANDPAN_DISABLE, SVG_ZOOMANDPAN_MAGNIFY, SVG_ZOOMANDPAN_UNKNOWN
Modifier | Constructor and Description |
---|---|
protected |
JsIDBDatabase() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Returns immediately and closes the connection in a separate thread.
|
JsIDBObjectStore |
createObjectStore(String name)
Creates and returns a new object store or index.
|
JsIDBObjectStore |
createObjectStore(String name,
Mappable options)
Creates and returns a new object store or index.
|
void |
deleteObjectStore(String name)
Destroys the object store with the given name in the connected database, along with any indexes that reference it.
|
String |
getName()
Name of the connected database.
|
JsIndexable |
getObjectStoreNames()
A list of the names of the object stores currently in the connected database.
|
EventListener |
getOnabort() |
EventListener |
getOnerror() |
EventListener |
getOnversionchange() |
String |
getVersion()
The version of the connected database.
|
void |
setOnabort(EventListener listener) |
void |
setOnerror(EventListener listener) |
void |
setOnversionchange(EventListener listener) |
JsIDBTransaction |
transaction(Indexable storeNames)
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread.
|
JsIDBTransaction |
transaction(Indexable storeNames,
int mode)
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread.
|
JsIDBTransaction |
transaction(Indexable storeNames,
String mode)
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread.
|
JsIDBTransaction |
transaction(String storeName)
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread.
|
JsIDBTransaction |
transaction(String storeName,
int mode)
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread.
|
JsIDBTransaction |
transaction(String storeName,
String mode)
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread.
|
addEventListener, addEventListener, beginElement, beginElementAt, dispatchEvent, endElement, endElementAt, getAnimatedClassName, getAnimatedHeight, getAnimatedHref, getAnimatedResult, getAnimatedTransform, getAnimatedWidth, getAnimatedX, getAnimatedY, getBBox, getChildElementCount, getCTM, getExternalResourcesRequired, getFarthestViewportElement, getFirstElementChild, getLastElementChild, getNearestViewportElement, getNextElementSibling, getPresentationAttribute, getPreserveAspectRatio, getPreviousElementSibling, getRequiredExtensions, getRequiredFeatures, getScreenCTM, getSvgStyle, getSystemLanguage, getTransformToElement, getViewBox, getXmllang, getXmlspace, getZoomAndPan, hasExtension, querySelector, querySelectorAll, removeEventListener, removeEventListener, setXmllang, setXmlspace, setZoomAndPan
at, at, intAt, intAt, length, numberAt, numberAt, setAt, setAt, setAt, setAt, setAt, setAt
cast, createArray, createArray, createFunction, createObject, equals, hashCode, toSource, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addEventListener, addEventListener, dispatchEvent, removeEventListener, removeEventListener
intAt, length
numberAt
public final String getName()
IDBDatabase
getName
in interface IDBDatabase
public final JsIndexable getObjectStoreNames()
IDBDatabase
getObjectStoreNames
in interface IDBDatabase
public final EventListener getOnabort()
getOnabort
in interface IDBDatabase
public final void setOnabort(EventListener listener)
setOnabort
in interface IDBDatabase
public final EventListener getOnerror()
getOnerror
in interface IDBDatabase
public final void setOnerror(EventListener listener)
setOnerror
in interface IDBDatabase
public final EventListener getOnversionchange()
getOnversionchange
in interface IDBDatabase
public final void setOnversionchange(EventListener listener)
setOnversionchange
in interface IDBDatabase
public final String getVersion()
IDBDatabase
getVersion
in interface IDBDatabase
public final void close()
IDBDatabase
Returns immediately and closes the connection in a separate thread. The connection is not actually closed until all transactions created using this connection are complete. No new transactions can be created for this connection once this method is called. Methods that create transactions throw an exception if a closing operation is pending.
void close();
close
in interface IDBDatabase
public final JsIDBObjectStore createObjectStore(String name)
IDBDatabase
Creates and returns a new object store or index. The method takes the name of the store as well as a parameter object. The parameter object lets you define important optional properties. You can use the property to uniquely identify individual objects in the store. As the property is an identifier, it should be unique to every object, and every object should have that property.
But before you can create any object store or index, you must first call the setVersion()
method.
IDBDatabaseOptionalParameters
, which is not yet recognized by any browserOptional. Options object whose attributes are optional parameters to the method. It includes the following properties:
Attribute | Description |
---|---|
keyPath | The key path to be used by the new object store. If empty or not specified, the object store is created without a key path and uses out-of-line keys. |
autoIncrement | If true, the object store has a key generator. Defaults to false . |
Unknown parameters are ignored.
IDBObjectStore
This method can raise an IDBDatabaseException with the following codes:
Exception | Description |
---|---|
NOT_ALLOWED_ERR | The method was not called from a VERSION_CHANGE transaction callback. You must call setVersion() first. |
CONSTRAINT_ERR | An object store with the given name (based on case-sensitive comparison) already exists in the connected database. |
NON_TRANSIENT_ERR | optionalParameters has attributes other than keyPath and autoIncrement . |
createObjectStore
in interface IDBDatabase
public final JsIDBObjectStore createObjectStore(String name, Mappable options)
IDBDatabase
Creates and returns a new object store or index. The method takes the name of the store as well as a parameter object. The parameter object lets you define important optional properties. You can use the property to uniquely identify individual objects in the store. As the property is an identifier, it should be unique to every object, and every object should have that property.
But before you can create any object store or index, you must first call the setVersion()
method.
IDBDatabaseOptionalParameters
, which is not yet recognized by any browserOptional. Options object whose attributes are optional parameters to the method. It includes the following properties:
Attribute | Description |
---|---|
keyPath | The key path to be used by the new object store. If empty or not specified, the object store is created without a key path and uses out-of-line keys. |
autoIncrement | If true, the object store has a key generator. Defaults to false . |
Unknown parameters are ignored.
IDBObjectStore
This method can raise an IDBDatabaseException with the following codes:
Exception | Description |
---|---|
NOT_ALLOWED_ERR | The method was not called from a VERSION_CHANGE transaction callback. You must call setVersion() first. |
CONSTRAINT_ERR | An object store with the given name (based on case-sensitive comparison) already exists in the connected database. |
NON_TRANSIENT_ERR | optionalParameters has attributes other than keyPath and autoIncrement . |
createObjectStore
in interface IDBDatabase
public final void deleteObjectStore(String name)
IDBDatabase
Destroys the object store with the given name in the connected database, along with any indexes that reference it.
As with createObjectStore()
, this method can be called only within a VERSION_CHANGE
transaction. So you must call the setVersion()
method first before you can remove any object store or index.
void
This method can raise an IDBDatabaseException with the following codes:
Exception | Description |
---|---|
NOT_ALLOWED_ERR | The method was not called from a VERSION_CHANGE transaction callback. You must call setVersion() first. |
NOT_FOUND_ERR | You are trying to delete an object store that does not exist. Names are case sensitive. |
deleteObjectStore
in interface IDBDatabase
public final JsIDBTransaction transaction(Indexable storeNames)
IDBDatabase
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread. The method returns a transaction object (IDBTransaction
) containing the objectStore() method, which you can use to access your object store.
READ_ONLY
, READ_WRITE
, and VERSION_CHANGE
. If you don't provide the parameter, the default access mode is READ_ONLY
. To avoid slowing things down, don't open a READ_WRITE
transaction, unless you actually need to write into the database.To start a transaction with the following scope, you can use the code snippets in the table. As noted earlier:
IDBTransaction.READ_ONLY
, use webkitIDBTransaction.READ_ONLY
).READ_ONLY
, so you don't really have to specify it. Of course, if you need to write into the object store, you can open the transaction in the READ_WRITE
mode.Scope | Code |
---|---|
Single object store |
Alternatively:
|
Multiple object stores | var transaction = db.transaction(['my-store-name', 'my-store-name2'], IDBTransaction.READ_ONLY); |
All object stores |
You cannot pass an empty array into the storeNames parameter, such as in the following: Warning: Accessing all obejct stores under the READ_WRITE mode means that you can run only that transaction. You cannot have writing transactions with overlapping scopes. |
IDBTransaction
This method can raise an IDBDatabaseException with the following codes:
Exception | Description |
---|---|
NOT_ALLOWED_ERR | The error is thrown for one of two reasons:
|
NOT_FOUND_ERR | One of the object stores doesn't exist in the connected database. |
transaction
in interface IDBDatabase
public final JsIDBTransaction transaction(Indexable storeNames, String mode)
IDBDatabase
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread. The method returns a transaction object (IDBTransaction
) containing the objectStore() method, which you can use to access your object store.
READ_ONLY
, READ_WRITE
, and VERSION_CHANGE
. If you don't provide the parameter, the default access mode is READ_ONLY
. To avoid slowing things down, don't open a READ_WRITE
transaction, unless you actually need to write into the database.To start a transaction with the following scope, you can use the code snippets in the table. As noted earlier:
IDBTransaction.READ_ONLY
, use webkitIDBTransaction.READ_ONLY
).READ_ONLY
, so you don't really have to specify it. Of course, if you need to write into the object store, you can open the transaction in the READ_WRITE
mode.Scope | Code |
---|---|
Single object store |
Alternatively:
|
Multiple object stores | var transaction = db.transaction(['my-store-name', 'my-store-name2'], IDBTransaction.READ_ONLY); |
All object stores |
You cannot pass an empty array into the storeNames parameter, such as in the following: Warning: Accessing all obejct stores under the READ_WRITE mode means that you can run only that transaction. You cannot have writing transactions with overlapping scopes. |
IDBTransaction
This method can raise an IDBDatabaseException with the following codes:
Exception | Description |
---|---|
NOT_ALLOWED_ERR | The error is thrown for one of two reasons:
|
NOT_FOUND_ERR | One of the object stores doesn't exist in the connected database. |
transaction
in interface IDBDatabase
public final JsIDBTransaction transaction(String storeName)
IDBDatabase
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread. The method returns a transaction object (IDBTransaction
) containing the objectStore() method, which you can use to access your object store.
READ_ONLY
, READ_WRITE
, and VERSION_CHANGE
. If you don't provide the parameter, the default access mode is READ_ONLY
. To avoid slowing things down, don't open a READ_WRITE
transaction, unless you actually need to write into the database.To start a transaction with the following scope, you can use the code snippets in the table. As noted earlier:
IDBTransaction.READ_ONLY
, use webkitIDBTransaction.READ_ONLY
).READ_ONLY
, so you don't really have to specify it. Of course, if you need to write into the object store, you can open the transaction in the READ_WRITE
mode.Scope | Code |
---|---|
Single object store |
Alternatively:
|
Multiple object stores | var transaction = db.transaction(['my-store-name', 'my-store-name2'], IDBTransaction.READ_ONLY); |
All object stores |
You cannot pass an empty array into the storeNames parameter, such as in the following: Warning: Accessing all obejct stores under the READ_WRITE mode means that you can run only that transaction. You cannot have writing transactions with overlapping scopes. |
IDBTransaction
This method can raise an IDBDatabaseException with the following codes:
Exception | Description |
---|---|
NOT_ALLOWED_ERR | The error is thrown for one of two reasons:
|
NOT_FOUND_ERR | One of the object stores doesn't exist in the connected database. |
transaction
in interface IDBDatabase
public final JsIDBTransaction transaction(String storeName, String mode)
IDBDatabase
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread. The method returns a transaction object (IDBTransaction
) containing the objectStore() method, which you can use to access your object store.
READ_ONLY
, READ_WRITE
, and VERSION_CHANGE
. If you don't provide the parameter, the default access mode is READ_ONLY
. To avoid slowing things down, don't open a READ_WRITE
transaction, unless you actually need to write into the database.To start a transaction with the following scope, you can use the code snippets in the table. As noted earlier:
IDBTransaction.READ_ONLY
, use webkitIDBTransaction.READ_ONLY
).READ_ONLY
, so you don't really have to specify it. Of course, if you need to write into the object store, you can open the transaction in the READ_WRITE
mode.Scope | Code |
---|---|
Single object store |
Alternatively:
|
Multiple object stores | var transaction = db.transaction(['my-store-name', 'my-store-name2'], IDBTransaction.READ_ONLY); |
All object stores |
You cannot pass an empty array into the storeNames parameter, such as in the following: Warning: Accessing all obejct stores under the READ_WRITE mode means that you can run only that transaction. You cannot have writing transactions with overlapping scopes. |
IDBTransaction
This method can raise an IDBDatabaseException with the following codes:
Exception | Description |
---|---|
NOT_ALLOWED_ERR | The error is thrown for one of two reasons:
|
NOT_FOUND_ERR | One of the object stores doesn't exist in the connected database. |
transaction
in interface IDBDatabase
public final JsIDBTransaction transaction(Indexable storeNames, int mode)
IDBDatabase
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread. The method returns a transaction object (IDBTransaction
) containing the objectStore() method, which you can use to access your object store.
READ_ONLY
, READ_WRITE
, and VERSION_CHANGE
. If you don't provide the parameter, the default access mode is READ_ONLY
. To avoid slowing things down, don't open a READ_WRITE
transaction, unless you actually need to write into the database.To start a transaction with the following scope, you can use the code snippets in the table. As noted earlier:
IDBTransaction.READ_ONLY
, use webkitIDBTransaction.READ_ONLY
).READ_ONLY
, so you don't really have to specify it. Of course, if you need to write into the object store, you can open the transaction in the READ_WRITE
mode.Scope | Code |
---|---|
Single object store |
Alternatively:
|
Multiple object stores | var transaction = db.transaction(['my-store-name', 'my-store-name2'], IDBTransaction.READ_ONLY); |
All object stores |
You cannot pass an empty array into the storeNames parameter, such as in the following: Warning: Accessing all obejct stores under the READ_WRITE mode means that you can run only that transaction. You cannot have writing transactions with overlapping scopes. |
IDBTransaction
This method can raise an IDBDatabaseException with the following codes:
Exception | Description |
---|---|
NOT_ALLOWED_ERR | The error is thrown for one of two reasons:
|
NOT_FOUND_ERR | One of the object stores doesn't exist in the connected database. |
transaction
in interface IDBDatabase
public final JsIDBTransaction transaction(String storeName, int mode)
IDBDatabase
Immediately returns an IDBTransaction object, and starts a transaction in a separate thread. The method returns a transaction object (IDBTransaction
) containing the objectStore() method, which you can use to access your object store.
READ_ONLY
, READ_WRITE
, and VERSION_CHANGE
. If you don't provide the parameter, the default access mode is READ_ONLY
. To avoid slowing things down, don't open a READ_WRITE
transaction, unless you actually need to write into the database.To start a transaction with the following scope, you can use the code snippets in the table. As noted earlier:
IDBTransaction.READ_ONLY
, use webkitIDBTransaction.READ_ONLY
).READ_ONLY
, so you don't really have to specify it. Of course, if you need to write into the object store, you can open the transaction in the READ_WRITE
mode.Scope | Code |
---|---|
Single object store |
Alternatively:
|
Multiple object stores | var transaction = db.transaction(['my-store-name', 'my-store-name2'], IDBTransaction.READ_ONLY); |
All object stores |
You cannot pass an empty array into the storeNames parameter, such as in the following: Warning: Accessing all obejct stores under the READ_WRITE mode means that you can run only that transaction. You cannot have writing transactions with overlapping scopes. |
IDBTransaction
This method can raise an IDBDatabaseException with the following codes:
Exception | Description |
---|---|
NOT_ALLOWED_ERR | The error is thrown for one of two reasons:
|
NOT_FOUND_ERR | One of the object stores doesn't exist in the connected database. |
transaction
in interface IDBDatabase
Copyright © 2016. All rights reserved.