Is it possible to specify a database schema name when using Room for Android applications?
I am trying to set some Sqlite PRAGMA values and want to ensure I am only affecting my applications local database and not any others such as the sqlite database associated with Android WorkerManager.
PRAGMA schema.auto_vacuum = 0 | NONE | 1 | FULL | 2 | INCREMENTAL;
CodePudding user response:
By default the schema name is main i.e. the main database. If not the default or main then the schema must be an ATTACH
ed database or temp (for a temporary database).
- A pragma may have an optional schema-name before the pragma name. The schema-name is the name of an ATTACH-ed database or "main" or "temp" for the main and the TEMP databases. If the optional schema name is omitted, "main" is assumed. In some pragmas, the schema name is meaningless and is simply ignored. In the documentation below, pragmas for which the schema name is meaningful are shown with a "schema." prefix. As per
PRAGMA Statements
If you aren't ATTACH
ing a database then there is no need for the schema.
i.e. PRAGMA is only relevant/affects the database or an ATTACH
ed database, if the schema is provided and is not main. It will not affect other databases, so other databases will not be affected.
You may wish to refer to ATTACH
and or