The goog.gears.BaseStore Class

goog.gears.BaseStore
> goog.Disposable

goog.gears.BaseStore(database)

This class implements the common store functionality

database {goog.gears.Database}
The data base to store the data in.

The goog.gears.BaseStore.SchemaType Enum

Schema definition types … more

.addOnDisposeCallback(callback, opt_scope)

Inherited from goog.Disposable .

Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.

callback {!Function}
The callback function.
opt_scope {Object=}
An optional scope to call the callback in.

.createSchema(defs, opt_ifNotExists)

Creates tables and indicies in the target database.

defs {Array}
definition arrays. This is an array of objects where each object describes a database object to create and drop. each object contains a 'type' field which of type goog.gears.BaseStore.SchemaType. Each object also contains a 'name' which contains the name of the object to create. A table object contains a 'columns' field which is an array that contains the column definitions for the table. A virtual table object contains c 'columns' field which contains the name of the columns. They are assumed to be of type text. An index object contains a 'tableName' field which is the name of the table that the index is on. It contains an 'isUnique' field which is a boolean indicating whether the index is unqiue or not. It also contains a 'columns' field which is an array that contains the columns names (possibly along with the ordering) that form the index. The trigger objects contain a 'tableName' field indicating the table the trigger is on. The type indicates the type of trigger. The trigger object may include a 'when' field which contains the when clause for the trigger. The trigger object also contains an 'actions' field which is an array of strings containing the actions for this trigger.
opt_ifNotExists {boolean=}
true if the table or index should be created only if it does not exist. Otherwise trying to create a table or index that already exists will result in an exception being thrown.

.createTriggers(defs)

Creates triggers specified in definitions. Will first attempt to drop the trigger with this name first.

defs {Array}
Definition arrays.

.creationStack {string}

Inherited from goog.Disposable .

If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.

.dispose()

Inherited from goog.Disposable .

Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.

returns {void}
Nothing.

.dropSchema(defs)

Drops tables and indicies in a target database.

defs {Array}
Definition arrays.

.ensureStoreExists()

Makes sure that tables needed for the store exist and are up to date.

.getName()

Returns the name of the store.

returns {string}
The name of the store.

.getStoreVersion()

Returns the version number for the specified store

returns {number}
The version number of the store. Returns 0 if the store does not exist.

.hasIndex(name)

Returns true if the index exists in the database

name {string}
The index name.
returns {boolean}
Whether the index exists in the database.

.hasTable(name)

Returns true if the table exists in the database

name {string}
The table name.
returns {boolean}
Whether the table exists in the database.

.hasTrigger(name)

name {string}
The name of the trigger.
returns {boolean}
Whether the schema contains a trigger with the given name.

.isDisposed()

Inherited from goog.Disposable .

returns {boolean}
Whether the object has been disposed of.

.registerDisposable(disposable)

Inherited from goog.Disposable .

Associates a disposable object with this object so that they will be disposed together.

disposable {goog.disposable.IDisposable}
that will be disposed when this object is disposed.

.removeStore()

Removes the tables for the MessageStore

.removeStoreVersion()

Removes the version number for the specified store