Example usage for Java android.database.sqlite SQLiteDatabase fields, constructors, methods, implement or subclass
The text is from its open source code.
int | CONFLICT_FAIL When a constraint violation occurs, the command aborts with a return code SQLITE_CONSTRAINT. |
int | CONFLICT_IGNORE When a constraint violation occurs, the one row that contains the constraint violation is not inserted or changed. |
int | CONFLICT_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. |
int | OPEN_READWRITE Open flag: Flag for #openDatabase to open the database for reading and writing. |
int | OPEN_READONLY Open flag: Flag for #openDatabase to open the database for reading only. |
int | NO_LOCALIZED_COLLATORS Open flag: Flag for #openDatabase to open the database without support for localized collators. |
int | CREATE_IF_NECESSARY Open flag: Flag for #openDatabase to create the database file if it does not already exist. |
void | acquireReference() Acquires a reference to the object. |
void | beginTransaction() Begins a transaction in EXCLUSIVE mode. |
void | beginTransactionNonExclusive() Begins a transaction in IMMEDIATE mode. |
void | beginTransactionWithListener(SQLiteTransactionListener transactionListener) Begins a transaction in EXCLUSIVE mode. |
void | beginTransactionWithListenerNonExclusive(SQLiteTransactionListener transactionListener) Begins a transaction in IMMEDIATE mode. |
void | close() Releases a reference to the object, closing the object if the last reference was released. |
SQLiteStatement | compileStatement(String sql) Compiles an SQL statement into a reusable pre-compiled statement object. |
SQLiteDatabase | create(@Nullable CursorFactory factory) Create a memory backed SQLite database. |
int | delete(String table, String whereClause, String[] whereArgs) Convenience method for deleting rows in the database. |
boolean | deleteDatabase(@NonNull File file) Deletes a database including its journal file and other auxiliary files that may have been created by the database engine. |
boolean | enableWriteAheadLogging() This method enables parallel execution of queries from multiple threads on the same database. |
void | endTransaction() End a transaction. |
void | execSQL(String sql) Execute a single SQL statement that is NOT a SELECT or any other SQL statement that returns data. |
void | execSQL(String sql, Object[] bindArgs) Execute a single SQL statement that is NOT a SELECT/INSERT/UPDATE/DELETE. |
String | getPath() Gets the path to the database file. |
int | getThreadDefaultConnectionFlags(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. |
SQLiteSession | getThreadSession() Gets the SQLiteSession that belongs to this thread for this database. |
int | getVersion() Gets the database version. |
long | insert(String table, String nullColumnHack, ContentValues values) Convenience method for inserting a row into the database. |
long | insertOrThrow(String table, String nullColumnHack, ContentValues values) Convenience method for inserting a row into the database. |
long | insertWithOnConflict(String table, String nullColumnHack, ContentValues initialValues, int conflictAlgorithm) General method for inserting a row into the database. |
boolean | inTransaction() Returns true if the current thread has a transaction pending. |
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. |
boolean | isDbLockedByOtherThreads() Always returns false. |
boolean | isOpen() Returns true if the database is currently open. |
boolean | isReadOnly() Returns true if the database is opened as read only. |
SQLiteDatabase | openDatabase(@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 . |
SQLiteDatabase | openDatabase(@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 . |
SQLiteDatabase | openOrCreateDatabase(@NonNull File file, @Nullable CursorFactory factory) Equivalent to openDatabase(file.getPath(), factory, CREATE_IF_NECESSARY). |
SQLiteDatabase | openOrCreateDatabase(@NonNull String path, @Nullable CursorFactory factory) Equivalent to openDatabase(path, factory, CREATE_IF_NECESSARY). |
Cursor | query(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. |
Cursor | query(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. |
Cursor | query(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. |
Cursor | rawQuery(String sql, String[] selectionArgs) Runs the provided SQL and returns a Cursor over the result set. |
Cursor | rawQueryWithFactory(CursorFactory cursorFactory, String sql, String[] selectionArgs, String editTable, CancellationSignal cancellationSignal) Runs the provided SQL and returns a cursor over the result set. |
int | releaseMemory() Attempts to release memory that SQLite holds but does not require to operate properly. |
void | releaseReference() Releases a reference to the object, closing the object if the last reference was released. |
long | replace(String table, String nullColumnHack, ContentValues initialValues) Convenience method for replacing a row in the database. |
long | replaceOrThrow(String table, String nullColumnHack, ContentValues initialValues) Convenience method for replacing a row in the database. |
void | setForeignKeyConstraintsEnabled(boolean enable) Sets whether foreign key constraints are enabled for the database. |
void | setLockingEnabled(boolean lockingEnabled) Control whether or not the SQLiteDatabase is made thread-safe by using locks around critical sections. |
void | setTransactionSuccessful() Marks the current transaction as successful. |
void | setVersion(int version) Sets the database version. |
int | update(String table, ContentValues values, String whereClause, String[] whereArgs) Convenience method for updating rows in the database. |
int | updateWithOnConflict(String table, ContentValues values, String whereClause, String[] whereArgs, int conflictAlgorithm) Convenience method for updating rows in the database. |
boolean | yieldIfContendedSafely() Temporarily end the transaction to let other threads run. |
boolean | yieldIfContendedSafely(long sleepAfterYieldDelay) Temporarily end the transaction to let other threads run. |