//selekt-android/com.bloomberg.selekt.android/SQLiteDatabase
SQLiteDatabase
[androidJvm]\ @ThreadSafe
class SQLiteDatabase : Closeable
Since
v0.1.0.
Types
Name | Summary |
---|---|
Companion | [androidJvm] object Companion |
Properties
Name | Summary |
---|---|
autoVacuum | [androidJvm] var autoVacuum: SQLiteAutoVacuumMode Auto-vacuuming is only possible if the database stores some additional information that allows each database page to be traced backwards to its referrer. Therefore, auto-vacuuming must be turned on before any tables are created. It is not possible to enable or disable auto-vacuum after a table has been created. |
isConnectionHeldByCurrentThread | [androidJvm] val isConnectionHeldByCurrentThread: Boolean Get whether this thread currently holds a connection to the database. |
isOpen | [androidJvm] val isOpen: Boolean |
isTransactionOpenedByCurrentThread | [androidJvm] val isTransactionOpenedByCurrentThread: Boolean Get whether the current thread has an open transaction. |
journalMode | [androidJvm] val journalMode: SQLiteJournalMode |
maximumSize | [androidJvm] val maximumSize: Long |
maxPageCount | [androidJvm] val maxPageCount: Long |
pageCount | [androidJvm] val pageCount: Int |
pageSize | [androidJvm] var pageSize: Long |
path | [androidJvm] val path: String |
version | [androidJvm] var version: Int |
Functions
Name | Summary |
---|---|
batch | [androidJvm] fun batch(sql: String, bindArgs: Sequence<Array<out Any?>>): Int Transacts to the database in exclusive mode a batch of queries with the same underlying SQL statement. The prototypical use case is for database modifications inside a tight loop to which this is optimised. |
beginExclusiveTransaction | [androidJvm] @DelicateApi fun beginExclusiveTransaction() Begins a transaction in exclusive mode. Prefer transact whenever possible. |
beginExclusiveTransactionWithListener | [androidJvm] @DelicateApi fun beginExclusiveTransactionWithListener(listener: SQLTransactionListener) |
beginImmediateTransaction | [androidJvm] @DelicateApi fun beginImmediateTransaction() Begins a transaction in immediate mode. Prefer transact whenever possible. |
beginImmediateTransactionWithListener | [androidJvm] @DelicateApi fun beginImmediateTransactionWithListener(listener: SQLTransactionListener) |
close | [androidJvm] open override fun close() |
compileStatement | [androidJvm] fun compileStatement(sql: String): ISQLStatement |
delete | [androidJvm] fun delete(table: String, whereClause: String?, whereArgs: Array<out Any?>?): Int |
endTransaction | [androidJvm] @DelicateApi fun endTransaction() |
exec | [androidJvm] fun exec(sql: String) fun exec(sql: String, @Size(min = 1)bindArgs: Array<out Any?>) |
incrementalVacuum | [androidJvm] fun incrementalVacuum() The incremental vacuum pragma causes pages to be removed from the freelist. The database file is truncated by the same number of pages. The incremental vacuum pragma has no effect if the database is not already in incremental vacuum mode or if there are no pages on the freelist. [androidJvm] fun incrementalVacuum(pages: Int) The incremental vacuum pragma causes up to N pages to be removed from the freelist. The database file is truncated by the same amount. The incremental vacuum pragma has no effect if the database is not already in incremental mode or if there are no pages on the freelist. If there are fewer on the freelist, or if pages is less than 1, then the entire freelist is cleared. |
insert | [androidJvm] fun insert(table: String, values: ContentValues, conflictAlgorithm: ConflictAlgorithm): Long |
integrityCheck | [androidJvm] fun integrityCheck(name: String = "main"): Boolean |
query | [androidJvm] fun query(query: ISQLQuery): Cursor fun query(sql: String, selectionArgs: Array<out Any?>?): Cursor fun query(distinct: Boolean, table: String, columns: Array<out String>?, selection: String?, selectionArgs: Array<out Any?>?, groupBy: String? = null, having: String? = null, limit: Int? = null, orderBy: String? = null): Cursor |
readFromBlob | [androidJvm] fun readFromBlob(table: String, column: String, row: Long, offset: Int, limit: Int, stream: OutputStream) fun readFromBlob(name: String, table: String, column: String, row: Long, offset: Int, limit: Int, stream: OutputStream) |
setForeignKeyConstraintsEnabled | [androidJvm] fun setForeignKeyConstraintsEnabled(enabled: Boolean) Setting foreign key constraints is not possible within a transaction; foreign key constraint enforcement may only be enabled or disabled when there are no pending transactions. |
setMaximumSize | [androidJvm] fun setMaximumSize(bytes: Long): Long |
setTransactionSuccessful | [androidJvm] @DelicateApi fun setTransactionSuccessful() |
sizeOfBlob | [androidJvm] fun sizeOfBlob(table: String, column: String, row: Long): Int fun sizeOfBlob(name: String, table: String, column: String, row: Long): Int |
transact | [androidJvm] fun <T> transact(transactionMode: SQLiteTransactionMode = SQLiteTransactionMode.EXCLUSIVE, block: SQLiteDatabase.() -> T): T Execute a block inside either an exclusive or an immediate database transaction. These transaction modes are the same in WAL-journal mode; in other journal modes, exclusive transaction mode prevents other connections from reading the database while the transaction is underway. |
update | [androidJvm] fun update(table: String, values: ContentValues, whereClause: String?, whereArgs: Array<out Any?>?, conflictAlgorithm: ConflictAlgorithm): Int |
upsert | [androidJvm] fun upsert(table: String, values: ContentValues, columns: Array<out String>, update: String): Long |
vacuum | [androidJvm] fun vacuum() The vacuum command rebuilds the database file, repacking it into a minimal amount of disk space. |
writeToBlob | [androidJvm] fun writeToBlob(table: String, column: String, row: Long, offset: Int, stream: InputStream) [androidJvm] fun writeToBlob(name: String, table: String, column: String, row: Long, offset: Int, stream: InputStream) Modifies the contents of a blob; it is not possible to increase the size of a blob using this method. |
yieldTransaction | [androidJvm] @JvmOverloads fun yieldTransaction(@IntRange(from = 0)pauseMillis: Long = 0): Boolean Temporarily end the transaction to allow other threads to make progress. The transaction is assumed to be successful thus far and committed, do not call setTransactionSuccessful. When this method returns a new transaction will have been created but not yet marked as successful. |