SupportSQLiteDatabase

public interface SupportSQLiteDatabase
implements Closeable

androidx.sqlite.db.SupportSQLiteDatabase


A database abstraction which removes the framework dependency and allows swapping underlying sql versions. It mimics the behavior of SQLiteDatabase

Summary

Public methods

abstract void beginTransaction()

Begins a transaction in EXCLUSIVE mode.

abstract void beginTransactionNonExclusive()

Begins a transaction in IMMEDIATE mode.

abstract void beginTransactionWithListener(SQLiteTransactionListener transactionListener)

Begins a transaction in EXCLUSIVE mode.

abstract void beginTransactionWithListenerNonExclusive(SQLiteTransactionListener transactionListener)

Begins a transaction in IMMEDIATE mode.

abstract SupportSQLiteStatement compileStatement(String sql)

Compiles the given SQL statement.

abstract int delete(String table, String whereClause, Object[] whereArgs)

Convenience method for deleting rows in the database.

abstract void disableWriteAheadLogging()

This method disables the features enabled by enableWriteAheadLogging().

abstract boolean enableWriteAheadLogging()

This method enables parallel execution of queries from multiple threads on the same database.

abstract void endTransaction()

End a transaction.

default void execPerConnectionSQL(String sql, Object[] bindArgs)

Execute the given SQL statement on all connections to this database.

abstract void execSQL(String sql, Object[] bindArgs)

Execute a single SQL statement that does not return any data.

abstract void execSQL(String sql)

Execute a single SQL statement that does not return any data.

abstract List<Pair<String, String>> getAttachedDbs()

Returns list of full path names of all attached databases including the main database by executing 'pragma database_list' on the database.

abstract long getMaximumSize()

Returns the maximum size the database may grow to.

abstract long getPageSize()

Returns the current database page size, in bytes.

abstract String getPath()

Gets the path to the database file.

abstract int getVersion()

Gets the database version.

abstract boolean inTransaction()

Returns true if the current thread has a transaction pending.

abstract long insert(String table, int conflictAlgorithm, ContentValues values)

Convenience method for inserting a row into the database.

abstract boolean isDatabaseIntegrityOk()

Runs 'pragma integrity_check' on the given database (and all the attached databases) and returns true if the given database (and all its attached databases) pass integrity_check, false otherwise.

abstract boolean isDbLockedByCurrentThread()

Returns true if the current thread is holding an active connection to the database.

default boolean isExecPerConnectionSQLSupported()

Returns true if execPerConnectionSQL(String, Object[]) is supported by the implementation.

abstract boolean isOpen()

Returns true if the database is currently open.

abstract boolean isReadOnly()

Returns true if the database is opened as read only.

abstract boolean isWriteAheadLoggingEnabled()

Returns true if write-ahead logging has been enabled for this database.

abstract boolean needUpgrade(int newVersion)

Returns true if the new version code is greater than the current database version.

abstract Cursor query(String query)

Runs the given query on the database.

abstract Cursor query(String query, Object[] bindArgs)

Runs the given query on the database.

abstract Cursor query(SupportSQLiteQuery query, CancellationSignal cancellationSignal)

Runs the given query on the database.

abstract Cursor query(SupportSQLiteQuery query)

Runs the given query on the database.

abstract void setForeignKeyConstraintsEnabled(boolean enable)

Sets whether foreign key constraints are enabled for the database.

abstract void setLocale(Locale locale)

Sets the locale for this database.

abstract void setMaxSqlCacheSize(int cacheSize)

Sets the maximum size of the prepared-statement cache for this database.

abstract long setMaximumSize(long numBytes)

Sets the maximum size the database will grow to.

abstract void setPageSize(long numBytes)

Sets the database page size.

abstract void setTransactionSuccessful()

Marks the current transaction as successful.