public class SqlitexDatabaseSource extends SQLiteOpenHelper implements DatabaseProvider<SQLiteDatabase>
This class extends the support version of SQLiteOpenHelper and is used to create the
database. onCreate(SQLiteDatabase) will create the database tables & columns
automatically.
onUpgrade(SQLiteDatabase, int, int) will create any missing tables/columns, however
it will not remove any tables/columns more complex upgrades should be handled by overriding
onUpgrade(SQLiteDatabase, int, int) and implementing a script to handle the migration.
| Constructor and Description |
|---|
SqlitexDatabaseSource(android.content.Context context,
io.requery.meta.EntityModel model,
int version) |
SqlitexDatabaseSource(android.content.Context context,
io.requery.meta.EntityModel model,
java.lang.String name,
int version) |
| Modifier and Type | Method and Description |
|---|---|
io.requery.sql.Configuration |
getConfiguration() |
java.sql.Connection |
getConnection() |
protected void |
onConfigure(io.requery.sql.ConfigurationBuilder builder)
Callback for when the database should be configured.
|
void |
onCreate(SQLiteDatabase db)
Callback for when the database schema is to be created.
|
protected io.requery.sql.Mapping |
onCreateMapping(io.requery.sql.Platform platform) |
void |
onUpgrade(SQLiteDatabase db,
int oldVersion,
int newVersion)
Callback for when the database should be upgraded from an previous version to a new version.
|
void |
setLoggingEnabled(boolean enable)
Enables statement logging.
|
void |
setTableCreationMode(io.requery.sql.TableCreationMode mode)
Sets the
TableCreationMode to use when the database is created or upgraded. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, getReadableDatabase, getWritableDatabasepublic SqlitexDatabaseSource(android.content.Context context,
io.requery.meta.EntityModel model,
int version)
public SqlitexDatabaseSource(android.content.Context context,
io.requery.meta.EntityModel model,
java.lang.String name,
int version)
public void setLoggingEnabled(boolean enable)
DatabaseProvidersetLoggingEnabled in interface DatabaseProvider<SQLiteDatabase>enable - true to enable, false otherwise default is false.public void setTableCreationMode(io.requery.sql.TableCreationMode mode)
DatabaseProviderTableCreationMode to use when the database is created or upgraded.setTableCreationMode in interface DatabaseProvider<SQLiteDatabase>mode - to useprotected io.requery.sql.Mapping onCreateMapping(io.requery.sql.Platform platform)
protected void onConfigure(io.requery.sql.ConfigurationBuilder builder)
DatabaseProvideronConfigure in interface DatabaseProvider<SQLiteDatabase>builder - instancepublic io.requery.sql.Configuration getConfiguration()
getConfiguration in interface DatabaseProvider<SQLiteDatabase>Configuration used by the providerpublic void onCreate(SQLiteDatabase db)
DatabaseProvideronCreate in interface DatabaseProvider<SQLiteDatabase>db - instancepublic void onUpgrade(SQLiteDatabase db,
int oldVersion,
int newVersion)
DatabaseProvideronUpgrade in interface DatabaseProvider<SQLiteDatabase>db - instancepublic java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface io.requery.sql.ConnectionProviderjava.sql.SQLException