Package android.database.sqlite
Class SQLiteDatabaseConfiguration
- java.lang.Object
-
- android.database.sqlite.SQLiteDatabaseConfiguration
-
public final class SQLiteDatabaseConfiguration extends Object
Describes how to configure a database.The purpose of this object is to keep track of all of the little configuration settings that are applied to a database after it is opened so that they can be applied to all connections in the connection pool uniformly.
Each connection maintains its own copy of this object so it can keep track of which settings have already been applied.
-
-
Field Summary
Fields Modifier and Type Field Description ArrayList<SQLiteCustomFunction>customFunctionsThe custom functions to register.booleanforeignKeyConstraintsEnabledTrue if foreign key constraints are enabled.StringlabelThe label to use to describe the database when it appears in logs.LocalelocaleThe database locale.intmaxSqlCacheSizeThe maximum size of the prepared statement cache for each database connection.static StringMEMORY_DB_PATHSpecial path used by in-memory databases.intopenFlagsThe flags used to open the database.StringpathThe database path.
-
Constructor Summary
Constructors Constructor Description SQLiteDatabaseConfiguration(SQLiteDatabaseConfiguration other)Creates a database configuration as a copy of another configuration.SQLiteDatabaseConfiguration(String path, int openFlags)Creates a database configuration with the required parameters for opening a database and default values for all other parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisInMemoryDb()Returns true if the database is in-memory.voidupdateParametersFrom(SQLiteDatabaseConfiguration other)Updates the non-immutable parameters of this configuration object from the other configuration object.
-
-
-
Field Detail
-
MEMORY_DB_PATH
public static final String MEMORY_DB_PATH
Special path used by in-memory databases.- See Also:
- Constant Field Values
-
path
public final String path
The database path.
-
label
public final String label
The label to use to describe the database when it appears in logs. This is derived from the path but is stripped to remove PII.
-
openFlags
public int openFlags
The flags used to open the database.
-
maxSqlCacheSize
public int maxSqlCacheSize
The maximum size of the prepared statement cache for each database connection. Must be non-negative. Default is 25.
-
locale
public Locale locale
The database locale. Default is the value returned byLocale.getDefault().
-
foreignKeyConstraintsEnabled
public boolean foreignKeyConstraintsEnabled
True if foreign key constraints are enabled. Default is false.
-
customFunctions
public final ArrayList<SQLiteCustomFunction> customFunctions
The custom functions to register.
-
-
Constructor Detail
-
SQLiteDatabaseConfiguration
public SQLiteDatabaseConfiguration(String path, int openFlags)
Creates a database configuration with the required parameters for opening a database and default values for all other parameters.- Parameters:
path- The database path.openFlags- Open flags for the database, such asSQLiteDatabase.OPEN_READWRITE.
-
SQLiteDatabaseConfiguration
public SQLiteDatabaseConfiguration(SQLiteDatabaseConfiguration other)
Creates a database configuration as a copy of another configuration.- Parameters:
other- The other configuration.
-
-
Method Detail
-
updateParametersFrom
public void updateParametersFrom(SQLiteDatabaseConfiguration other)
Updates the non-immutable parameters of this configuration object from the other configuration object.- Parameters:
other- The object from which to copy the parameters.
-
isInMemoryDb
public boolean isInMemoryDb()
Returns true if the database is in-memory.- Returns:
- True if the database is in-memory.
-
-