Package org.robolectric.shadows
Class ShadowSQLiteConnection
java.lang.Object
org.robolectric.shadows.ShadowSQLiteConnection
- Direct Known Subclasses:
ShadowLegacySQLiteConnection
,ShadowNativeSQLiteConnection
@Implements(className="android.database.sqlite.SQLiteConnection",
isInAndroidSdk=false,
shadowPicker=Picker.class)
public class ShadowSQLiteConnection
extends Object
The base shadow class for
SQLiteConnection
shadow APIs.
The actual shadow class for SQLiteConnection
will be selected during runtime by the
Picker.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
dispose
(boolean finalized) static void
reset()
static void
setDefaultJournalMode
(String value) Sets the default journal mode for SQLite databases.static void
setDefaultSyncMode
(String value) Sets the default sync mode for SQLite databases.static void
setUseInMemoryDatabase
(boolean value) static SQLiteMode.Mode
-
Field Details
-
useInMemoryDatabase
-
-
Constructor Details
-
ShadowSQLiteConnection
public ShadowSQLiteConnection()
-
-
Method Details
-
dispose
-
setUseInMemoryDatabase
public static void setUseInMemoryDatabase(boolean value) -
sqliteMode
-
setDefaultSyncMode
Sets the default sync mode for SQLite databases. Robolectric uses "OFF" by default in order to improve SQLite performance. The Android default is "FULL" in order to be more resilient to process crashes. However, this is not a requirement for Robolectric processes, where all database files are temporary and get deleted after each test.This also updates the default sync mode used when SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING (WAL) is used.
If your test expects SQLite files being synced to disk, such as having multiple processes interact with the database, or deleting SQLite files while connections are open and having this reflected in the open connection, use "FULL" mode.
-
setDefaultJournalMode
Sets the default journal mode for SQLite databases. Robolectric uses "MEMORY" by default in order to improve SQLite performance. The Android default isPERSIST
in SDKs <= 25 andTRUNCATE
in SDKs > 25.Similarly to
setDefaultSyncMode(java.lang.String)
, if your test expects SQLite rollback journal to be synced to disk, usePERSIST
orTRUNCATE
. -
reset
-