Class that for accessing a Gears database
extends goog.events.EventTarget| Instance Method Summary | |
begin() ⇒ booleanMarks the beginning of a database transaction using the default begin type. Does a real BEGIN operation if useTransactions is true for this database and this is the first opened transaction. This will throw an exception if this is a nested begin and is trying to elevate the begin type from the original BEGIN that was processed. | |
beginDeferred() ⇒ booleanMarks the beginning of a deferred database transaction. Does a real BEGIN operation if useTransactions is true for this database and this is the first opened transaction. | |
beginExclusive() ⇒ booleanMarks the beginning of an exclusive database transaction. Does a real BEGIN operation if useTransactions is true for this database and this is the first opened transaction. This will throw an exception if this is a nested begin and is trying to elevate the begin type from the original BEGIN that was processed. | |
beginImmediate() ⇒ booleanMarks the beginning of an immediate database transaction. Does a real BEGIN operation if useTransactions is true for this database and this is the first opened transaction. This will throw an exception if this is a nested begin and is trying to elevate the begin type from the original BEGIN that was processed. | |
beginTransaction_(string beginType) ⇒ booleanMarks the beginning of a database transaction. Does a real BEGIN operation if useTransactions is true for this database and the this is the first opened transaction | |
close()Closes the database. | |
closeTransaction_(boolean rollback) ⇒ booleanHelper that performs either a COMMIT or ROLLBACK command and dispatches pre/post commit/rollback events. | |
commit() ⇒ booleanMarks the end of a successful transaction. Will do a real COMMIT if this the last outstanding transaction unless a nested transaction was closed with a ROLLBACK in which case a real ROLLBACK will be performed. | |
disposeInternal()Unattach listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners, it should be something like this:
MyClass.prototype.disposeInternal = function() {
MyClass.superClass_.disposeInternal.call(this);
// Dispose logic for MyClass
};
| |
ensureNoTransaction(string= opt_logMsgPrefix)Ensures there is no open transaction upon return. An existing open transaction is rolled back. | |
execute(string sql, <Any Type> var_args) ⇒ ?GearsResultSetExecute a sql statement with a set of arguments | |
executeVarArgs_(string sql, ?Object params, number startIndex) ⇒ ?GearsResultSetThis is useful to remove all the arguments juggling from inside the different helper functions. | |
forEachRow(string sql, ?Function f, ?Object= opt_this, <Any Type> var_args)For each row in the result set f will be called with the following parameters: row (array of values), rowIndex and columnNames. Rows will continue being processed as long as f returns true. | |
forEachValue(string sql, ?Function f, ?Object= opt_this, <Any Type> var_args)For each value in the result set f will be called with the following parameters; value, rowIndex, columnIndex, columnName. Values will continue being processed as long as f returns true. | |
getExecutionTime() ⇒ numberReturns the time in Ms that database operations have currently consumed. This only exists in debug builds, but it still may be useful for goog.gears.Trace. | |
getLastInsertRowId() ⇒ number | |
getUseTransactions() ⇒ booleanWhether transactions are used for the database | |
isInTransaction() ⇒ booleanReturns whether or not we're in a transaction. | |
needsRollback() ⇒ booleanReturns whether or not the current transaction has a pending rollback. Returns false if there is no current transaction. | |
open()Opens the database. | |
queryArray(string sql, <Any Type> var_args) ⇒ ?ArrayThis calls query on the database and returns the first row as an array | |
queryArrays(string sql, <Any Type> var_args) ⇒ ?ArrayThis calls query on the database and builds a two dimensional array containing the result. | |
queryObject(string sql, <Any Type> var_args) ⇒ ?ObjectThis calls query on the database and returns the first row as a hash map where the keys are the column names. | |
queryObjectArray(string sql, <Any Type> var_args) ⇒ ?ArrayThis calls query on the database and builds an array containing hashes | |
queryObject_(string sql, ?Function f, ?Object params, number startIndex) ⇒ (Object|boolean|null|number|string|undefined)Helper methods for queryArrays, queryObjectArray, queryValueArray, queryValue, queryObject. | |
queryValue(string sql, <Any Type> var_args) ⇒ (null|number|string)This calls query on the database and returns the first value in the first row. | |
queryValueArray(string sql, <Any Type> var_args) ⇒ ?ArrayThis calls query on the database and returns an array containing the values in the first column. This is useful if the result set only contains one column. | |
remove()Removes the database. | |
rollback(?Error= opt_e) ⇒ booleanMarks the end of an unsuccessful transaction. Will do a real ROLLBACK if this the last outstanding transaction, otherwise the real ROLLBACK will be deferred until the last outstanding transaction is closed. | |
setDefaultBeginType(string beginType)Sets the default begin type. | |
setUseTransactions(boolean b)Whether transactions are used for the database | |
transact(?Function func) ⇒ (Object|boolean|null|number|string|undefined)Executes a function transactionally. | |
| Static Method Summary | |
isLockedException((Error|null|string) ex) ⇒ booleanDetermines if the exception is a locking error. | |
resultSetToArray(?GearsResultSet rs) ⇒ ?ArrayReturns an array of the first row in the result set | |
resultSetToArrays(?GearsResultSet rs) ⇒ ?ArrayReturns an array of arrays, where each sub array contains the selected values for each row in the result set. result values | |
resultSetToObject(?GearsResultSet rs) ⇒ ?ObjectReturns a single hashed object from the result set (the first row), where the column names in the query are used as the members of the object. | |
resultSetToObjectArray(?GearsResultSet rs) ⇒ ?ArrayReturns a array of hash objects, one per row in the result set, where the column names in the query are used as the members of the object. | |
resultSetToValue(?GearsResultSet rs) ⇒ (null|number|string)Returns a single value from the results (first column in first row). | |
resultSetToValueArray(?GearsResultSet rs) ⇒ ?ArrayReturns an array containing the first item of each row in a result set. This is useful for query that returns one column | |