db

Classes

goog.db.Cursor
Creates a new IDBCursor wrapper object. Should not be created directly, access cursor through object store.
goog.db.Error
A database error. Since the stack trace can be unhelpful in an asynchronous context, the error provides a message about where it was produced.
goog.db.Index
Creates an IDBIndex wrapper object. Indexes are associated with object stores and provide methods for looking up objects based on their non-key properties. Should not be created directly, access through the object store it belongs to.
goog.db.IndexedDb
Creates an IDBDatabase wrapper object. The database object has methods for setting the version to change the structure of the database and for creating transactions to get or modify the stored records. Should not be created directly, call goog.db.openDatabase to set up the connection.
goog.db.KeyRange
Creates a new IDBKeyRange wrapper object. Should not be created directly, instead use one of the static factory methods. For example:
goog.db.ObjectStore
Creates an IDBObjectStore wrapper object. Object stores have methods for storing and retrieving records, and are accessed through a transaction object. They also have methods for creating indexes associated with the object store. They can only be created when setting the version of the database. Should not be created directly, access object stores through transactions.
goog.db.Transaction
Creates a new transaction. Transactions contain methods for accessing object stores and are created from the database object. Should not be created directly, open a database and call createTransaction on it.

Public Protected Private

Global Functions

goog.db.deleteDatabase(nameopt_onBlocked) !goog.async.Deferred
Deletes a database once all open connections have been closed.
Arguments:
name : string
The name of the database to delete.
opt_onBlocked : goog.db.BlockedCallback=
Called if there are active connections to the database.
Returns: !goog.async.Deferred  A deferred object that will fire once the database is deleted.
code »
goog.db.openDatabase(nameopt_versionopt_onUpgradeNeededopt_onBlocked) !goog.async.Deferred
Opens a database connection and wraps it.
Arguments:
name : string
The name of the database to open.
opt_version : number=
The expected version of the database. If this is larger than the actual version, opt_onUpgradeNeeded will be called (possibly after opt_onBlocked; see goog.db.BlockedCallback). If this is passed, opt_onUpgradeNeeded must be passed as well.
opt_onUpgradeNeeded : goog.db.UpgradeNeededCallback=
Called if opt_version is greater than the old version of the database. If opt_version is passed, this must be passed as well.
opt_onBlocked : goog.db.BlockedCallback=
Called if there are active connections to the database.
Returns: !goog.async.Deferred  The deferred database object.
code »

Global Properties

goog.db.BlockedCallback :
A callback that's called if a blocked event is received. When a database is supposed to be deleted or upgraded (i.e. versionchange), and there are open connections to this database, a block event will be fired to prevent the operations from going through until all such open connections are closed. This callback can be used to notify users that they should close other tabs that have open connections, or to close the connections manually. Databases can also listen for the goog.db.IndexedDb.EventType.VERSION_CHANGE event to automatically close themselves when they're blocking such operations. This is passed a VersionChangeEvent that has the version of the database before it was deleted, and "null" as the new version.
Code »
goog.db.UpgradeNeededCallback :
A callback that's called when opening a database whose internal version is lower than the version passed to goog.db.openDatabase. This callback is passed three arguments: a VersionChangeEvent with both the old version and the new version of the database; the database that's being opened, for which you can create and delete object stores; and the version change transaction, with which you can abort the version change. Note that the transaction is not active, which means that it can't be used to make changes to the database. However, since there is a transaction running, you can't create another one via goog.db.IndexedDb.createTransaction. This means that it's not possible to manipulate the database other than creating or removing object stores in this callback.
Code »
goog.db.indexedDb_ :
The IndexedDB factory object.
Code »

Package db

Package Reference