Java android.database.sqlite SQLiteDatabase fields, constructors, methods, implement or subclass

Example usage for Java android.database.sqlite SQLiteDatabase fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.database.sqlite SQLiteDatabase.

The text is from its open source code.

Field

intCONFLICT_FAIL
When a constraint violation occurs, the command aborts with a return code SQLITE_CONSTRAINT.
intCONFLICT_IGNORE
When a constraint violation occurs, the one row that contains the constraint violation is not inserted or changed.
intCONFLICT_REPLACE
When a UNIQUE constraint violation occurs, the pre-existing rows that are causing the constraint violation are removed prior to inserting or updating the current row.
intOPEN_READWRITE
Open flag: Flag for #openDatabase to open the database for reading and writing.
intOPEN_READONLY
Open flag: Flag for #openDatabase to open the database for reading only.
intNO_LOCALIZED_COLLATORS
Open flag: Flag for #openDatabase to open the database without support for localized collators.
intCREATE_IF_NECESSARY
Open flag: Flag for #openDatabase to create the database file if it does not already exist.

Method

voidacquireReference()
Acquires a reference to the object.
voidbeginTransaction()
Begins a transaction in EXCLUSIVE mode.
voidbeginTransactionNonExclusive()
Begins a transaction in IMMEDIATE mode.
voidbeginTransactionWithListener(SQLiteTransactionListener transactionListener)
Begins a transaction in EXCLUSIVE mode.
voidbeginTransactionWithListenerNonExclusive(SQLiteTransactionListener transactionListener)
Begins a transaction in IMMEDIATE mode.
voidclose()
Releases a reference to the object, closing the object if the last reference was released.
SQLiteStatementcompileStatement(String sql)
Compiles an SQL statement into a reusable pre-compiled statement object.
SQLiteDatabasecreate(@Nullable CursorFactory factory)
Create a memory backed SQLite database.
intdelete(String table, String whereClause, String[] whereArgs)
Convenience method for deleting rows in the database.
booleandeleteDatabase(@NonNull File file)
Deletes a database including its journal file and other auxiliary files that may have been created by the database engine.
booleanenableWriteAheadLogging()
This method enables parallel execution of queries from multiple threads on the same database.
voidendTransaction()
End a transaction.
voidexecSQL(String sql)
Execute a single SQL statement that is NOT a SELECT or any other SQL statement that returns data.
voidexecSQL(String sql, Object[] bindArgs)
Execute a single SQL statement that is NOT a SELECT/INSERT/UPDATE/DELETE.
StringgetPath()
Gets the path to the database file.
intgetThreadDefaultConnectionFlags(boolean readOnly)
Gets default connection flags that are appropriate for this thread, taking into account whether the thread is acting on behalf of the UI.
SQLiteSessiongetThreadSession()
Gets the SQLiteSession that belongs to this thread for this database.
intgetVersion()
Gets the database version.
longinsert(String table, String nullColumnHack, ContentValues values)
Convenience method for inserting a row into the database.
longinsertOrThrow(String table, String nullColumnHack, ContentValues values)
Convenience method for inserting a row into the database.
longinsertWithOnConflict(String table, String nullColumnHack, ContentValues initialValues, int conflictAlgorithm)
General method for inserting a row into the database.
booleaninTransaction()
Returns true if the current thread has a transaction pending.
booleanisDatabaseIntegrityOk()
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.
booleanisDbLockedByOtherThreads()
Always returns false.
booleanisOpen()
Returns true if the database is currently open.
booleanisReadOnly()
Returns true if the database is opened as read only.
SQLiteDatabaseopenDatabase(@NonNull String path, @Nullable CursorFactory factory, @DatabaseOpenFlags int flags, @Nullable DatabaseErrorHandler errorHandler)
Open the database according to the flags #OPEN_READWRITE #OPEN_READONLY #CREATE_IF_NECESSARY and/or #NO_LOCALIZED_COLLATORS .
SQLiteDatabaseopenDatabase(@NonNull String path, @Nullable CursorFactory factory, @DatabaseOpenFlags int flags)
Open the database according to the flags #OPEN_READWRITE #OPEN_READONLY #CREATE_IF_NECESSARY and/or #NO_LOCALIZED_COLLATORS .
SQLiteDatabaseopenOrCreateDatabase(@NonNull File file, @Nullable CursorFactory factory)
Equivalent to openDatabase(file.getPath(), factory, CREATE_IF_NECESSARY).
SQLiteDatabaseopenOrCreateDatabase(@NonNull String path, @Nullable CursorFactory factory)
Equivalent to openDatabase(path, factory, CREATE_IF_NECESSARY).
Cursorquery(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy)
Query the given table, returning a Cursor over the result set.
Cursorquery(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)
Query the given table, returning a Cursor over the result set.
Cursorquery(boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)
Query the given URL, returning a Cursor over the result set.
CursorrawQuery(String sql, String[] selectionArgs)
Runs the provided SQL and returns a Cursor over the result set.
CursorrawQueryWithFactory(CursorFactory cursorFactory, String sql, String[] selectionArgs, String editTable, CancellationSignal cancellationSignal)
Runs the provided SQL and returns a cursor over the result set.
intreleaseMemory()
Attempts to release memory that SQLite holds but does not require to operate properly.
voidreleaseReference()
Releases a reference to the object, closing the object if the last reference was released.
longreplace(String table, String nullColumnHack, ContentValues initialValues)
Convenience method for replacing a row in the database.
longreplaceOrThrow(String table, String nullColumnHack, ContentValues initialValues)
Convenience method for replacing a row in the database.
voidsetForeignKeyConstraintsEnabled(boolean enable)
Sets whether foreign key constraints are enabled for the database.
voidsetLockingEnabled(boolean lockingEnabled)
Control whether or not the SQLiteDatabase is made thread-safe by using locks around critical sections.
voidsetTransactionSuccessful()
Marks the current transaction as successful.
voidsetVersion(int version)
Sets the database version.
intupdate(String table, ContentValues values, String whereClause, String[] whereArgs)
Convenience method for updating rows in the database.
intupdateWithOnConflict(String table, ContentValues values, String whereClause, String[] whereArgs, int conflictAlgorithm)
Convenience method for updating rows in the database.
booleanyieldIfContendedSafely()
Temporarily end the transaction to let other threads run.
booleanyieldIfContendedSafely(long sleepAfterYieldDelay)
Temporarily end the transaction to let other threads run.