DBHelper

open class DBHelper

SmartStore Database Helper Singleton class that provides helpful methods for accessing the database underneath the SmartStore It also caches a number of of things to speed things up (e.g. soup table name, index specs, insert helpers etc)

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
val EXPLAIN_ARGS: String = "args"
Link copied to clipboard
val EXPLAIN_ROWS: String = "rows"
Link copied to clipboard
val EXPLAIN_SQL: String = "sql"
Link copied to clipboard
val EXPLAIN_TAG: String = "EXPLAIN"
Link copied to clipboard

Functions

Link copied to clipboard
open fun cacheHasSoup(soupName: String, hasSoup: Boolean)
Link copied to clipboard
open fun cacheIndexSpecs(soupName: String, indexSpecs: Array<IndexSpec>)
Link copied to clipboard
open fun cacheTableName(soupName: String, tableName: String)
Link copied to clipboard
open fun clearMemoryCache()
Resets all cached data from memory.
Link copied to clipboard
open fun countQuery(db: SQLiteDatabase, table: String, whereClause: String, whereArgs: Array<String>): Cursor
Does a count query
Link copied to clipboard
open fun countRawCountQuery(db: SQLiteDatabase, countSql: String, whereArgs: Array<String>): Int
Does a count for a raw count query
Link copied to clipboard
open fun countRawQuery(db: SQLiteDatabase, sql: String, whereArgs: Array<String>): Int
Does a count for a raw query
Link copied to clipboard
open fun delete(db: SQLiteDatabase, table: String, whereClause: String, whereArgs: Array<String>)
Does a delete (after first logging the delete statement)
Link copied to clipboard
open fun getCachedHasFTS(soupName: String): Boolean
Link copied to clipboard
Link copied to clipboard
open fun getCachedTableName(soupName: String): String
Link copied to clipboard
open fun getColumnNameForPath(db: SQLiteDatabase, soupName: String, path: String): String
Return column name in soup table that holds the soup projection for path
Link copied to clipboard
open fun getIndexSpecs(db: SQLiteDatabase, soupName: String): Array<IndexSpec>
Read index specs back from the soup index map table
Link copied to clipboard
open fun getInsertHelper(db: SQLiteDatabase, table: String): DatabaseUtils.InsertHelper
Get insert helper for a table
Link copied to clipboard
open fun getInstance(db: SQLiteDatabase): DBHelper
Returns the instance of this class associated with the database specified.
Link copied to clipboard
open fun getNextId(db: SQLiteDatabase, tableName: String): Long
Get next id for a table
Link copied to clipboard
open fun getSoupTableName(db: SQLiteDatabase, soupName: String): String
Return table name for a given soup or null if the soup doesn't exist
Link copied to clipboard
open fun hasFTS(db: SQLiteDatabase, soupName: String): Boolean
Link copied to clipboard
open fun hasIndexForPath(db: SQLiteDatabase, soupName: String, path: String): Boolean
Return true if the given path is indexed on the given soup
Link copied to clipboard
open fun hasSoup(db: SQLiteDatabase, soupName: String): Boolean
Return true if given soup exists
Link copied to clipboard
open fun insert(db: SQLiteDatabase, table: String, contentValues: ContentValues): Long
Does an insert
Link copied to clipboard
open fun limitRawQuery(db: SQLiteDatabase, sql: String, limit: String, whereArgs: Array<String>): Cursor
Does a limit for a raw query
Link copied to clipboard
open fun query(db: SQLiteDatabase, table: String, columns: Array<String>, orderBy: String, limit: String, whereClause: String, whereArgs: Array<String>): Cursor
Runs a query
Link copied to clipboard
open fun removeFromCache(soupName: String)
Link copied to clipboard
open fun reset(ctx: Context)
Resets all cached data and deletes the database for all users.
open fun reset(ctx: Context, account: UserAccount)
Resets all cached data and deletes the database for the specified user.
Link copied to clipboard
open fun setCaptureExplainQueryPlan(captureExplainQueryPlan: Boolean)
If turned on, explain query plan is run before executing a query and stored in lastExplainQueryPlan and also get logged
Link copied to clipboard
open fun update(db: SQLiteDatabase, table: String, contentValues: ContentValues, whereClause: String, whereArgs: Array<String>): Int
Does an update