Public Methods |
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.
|
SQLiteStatement | compileStatement(String sql)
Compiles an SQL statement into a reusable pre-compiled statement object.
|
static SQLiteDatabase | create(SQLiteDatabase.CursorFactory factory)
Create a memory backed SQLite database.
|
int | delete(String table, String whereClause, String[] whereArgs)
Convenience method for deleting rows in the database.
|
static boolean | deleteDatabase(File file)
Deletes a database including its journal file and other auxiliary files that may have been created by the database engine.
|
void | disableWriteAheadLogging()
|
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.
|
static String | findEditTable(String tables)
Finds the name of the first table, which is editable.
|
List<Pair<String, String>> | getAttachedDbs()
Returns list of full pathnames of all attached databases including the main database by executing 'pragma database_list' on the database.
|
long | getMaximumSize()
Returns the maximum size the database may grow to.
|
long | getPageSize()
Returns the current database page size, in bytes.
|
final String | getPath()
Gets the path to the database file.
|
Map<String, String> | getSyncedTables()
This method was deprecated in API level 11. This method no longer serves any useful purpose and has been deprecated.
|
int | getVersion()
Gets the database version.
|
boolean | inTransaction()
Returns true if the current thread has a transaction pending.
|
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 | 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 | isDbLockedByCurrentThread()
Returns true if the current thread is holding an active connection to the database.
|
boolean | isDbLockedByOtherThreads()
This method was deprecated in API level 16. Always returns false. Do not use this method.
|
boolean | isOpen()
Returns true if the database is currently open.
|
boolean | isReadOnly()
Returns true if the database is opened as read only.
|
boolean | isWriteAheadLoggingEnabled()
Returns true if write-ahead logging has been enabled for this database.
|
void | markTableSyncable(String table, String foreignKey, String updateTable)
This method was deprecated in API level 11. This method no longer serves any useful purpose and has been deprecated.
|
void | markTableSyncable(String table, String deletedTable)
This method was deprecated in API level 11. This method no longer serves any useful purpose and has been deprecated.
|
boolean | needUpgrade(int newVersion)
Returns true if the new version code is greater than the current database version.
|
static SQLiteDatabase | openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags, DatabaseErrorHandler errorHandler)
|
static SQLiteDatabase | openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags)
|
static SQLiteDatabase | openOrCreateDatabase(String path, SQLiteDatabase.CursorFactory factory, DatabaseErrorHandler errorHandler)
Equivalent to openDatabase(path, factory, CREATE_IF_NECESSARY, errorHandler).
|
static SQLiteDatabase | openOrCreateDatabase(String path, SQLiteDatabase.CursorFactory factory)
Equivalent to openDatabase(path, factory, CREATE_IF_NECESSARY).
|
static SQLiteDatabase | openOrCreateDatabase(File file, SQLiteDatabase.CursorFactory factory)
Equivalent to openDatabase(file.getPath(), factory, CREATE_IF_NECESSARY).
|
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, CancellationSignal cancellationSignal)
Query the given URL, returning a Cursor over the result set.
|
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(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 | queryWithFactory(SQLiteDatabase.CursorFactory cursorFactory, boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit, CancellationSignal cancellationSignal)
Query the given URL, returning a Cursor over the result set.
|
Cursor | queryWithFactory(SQLiteDatabase.CursorFactory cursorFactory, 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, CancellationSignal cancellationSignal)
Runs the provided SQL and returns 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(SQLiteDatabase.CursorFactory cursorFactory, String sql, String[] selectionArgs, String editTable)
Runs the provided SQL and returns a cursor over the result set.
|
Cursor | rawQueryWithFactory(SQLiteDatabase.CursorFactory cursorFactory, String sql, String[] selectionArgs, String editTable, CancellationSignal cancellationSignal)
Runs the provided SQL and returns a cursor over the result set.
|
static int | releaseMemory()
Attempts to release memory that SQLite holds but does not require to operate properly.
|
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 | setLocale(Locale locale)
Sets the locale for this database.
|
void | setLockingEnabled(boolean lockingEnabled)
This method was deprecated in API level 16. This method now does nothing. Do not use.
|
void | setMaxSqlCacheSize(int cacheSize)
Sets the maximum size of the prepared-statement cache for this database.
|
long | setMaximumSize(long numBytes)
Sets the maximum size the database will grow to.
|
void | setPageSize(long numBytes)
Sets the database page size.
|
void | setTransactionSuccessful()
Marks the current transaction as successful.
|
void | setVersion(int version)
Sets the database version.
|
String | toString()
Returns a string containing a concise, human-readable description of this object.
|
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 | yieldIfContended()
This method was deprecated in API level 3. if the db is locked more than once (becuase of nested transactions) then the lock will not be yielded. Use yieldIfContendedSafely instead.
|
boolean | yieldIfContendedSafely(long sleepAfterYieldDelay)
Temporarily end the transaction to let other threads run.
|
boolean | yieldIfContendedSafely()
Temporarily end the transaction to let other threads run.
|