public class DbCreator
extends android.database.sqlite.SQLiteOpenHelper
| Modifier and Type | Field and Description |
|---|---|
protected static android.database.sqlite.SQLiteDatabase |
dbConnection |
| Modifier | Constructor and Description |
|---|---|
protected |
DbCreator(android.content.Context context,
org.droitateddb.PersistenceDefinition persistence) |
| Modifier and Type | Method and Description |
|---|---|
void |
consumeDatabase(DbConsumer dbConsumer)
Execute an action on the database.
|
<T> T |
functionOnDatabase(DbFunction<T> dbFunction)
Execute a function on the database, to return some values.
|
android.database.sqlite.SQLiteDatabase |
getDatabaseConnection()
Gives you a database connection you can access the database with.
|
static DbCreator |
getInstance(android.content.Context context) |
android.database.sqlite.SQLiteDatabase |
getReadableDatabase()
Deprecated.
Don't use this method any more. Use getDatabaseConnection.
|
android.database.sqlite.SQLiteDatabase |
getWritableDatabase()
Deprecated.
Don't use this method any more. Use getDatabaseConnection.
|
void |
onCreate(android.database.sqlite.SQLiteDatabase db) |
void |
onUpgrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion) |
android.database.Cursor |
query(java.lang.String table,
java.lang.String[] columns,
java.lang.String selection,
java.lang.String[] selectionArgs,
java.lang.String groupBy,
java.lang.String having,
java.lang.String orderBy)
Executes a query on the database.
|
android.database.Cursor |
rawQuery(java.lang.String sql)
Executes a raw query on the database.
|
void |
reduceDatabaseConnection()
Reduce the connection opened.
|
protected static volatile android.database.sqlite.SQLiteDatabase dbConnection
protected DbCreator(android.content.Context context,
org.droitateddb.PersistenceDefinition persistence)
public static DbCreator getInstance(android.content.Context context)
public android.database.sqlite.SQLiteDatabase getDatabaseConnection()
public void reduceDatabaseConnection()
public <T> T functionOnDatabase(DbFunction<T> dbFunction)
DbCreator#query or DbCreator#rawQuery method.CursorAdapterT - Resulting typedbFunction - Function you want to execute on the databasepublic void consumeDatabase(DbConsumer dbConsumer)
dbConsumer - Action you want to execute on the databasepublic android.database.Cursor query(java.lang.String table,
java.lang.String[] columns,
java.lang.String selection,
java.lang.String[] selectionArgs,
java.lang.String groupBy,
java.lang.String having,
java.lang.String orderBy)
table - Name of the tablecolumns - Used columns of the queried tableselection - Selection statementselectionArgs - Selection argumentsgroupBy - SQL group byhaving - SQL havingorderBy - SQL order bypublic android.database.Cursor rawQuery(java.lang.String sql)
sql - Raw SQL statement@Deprecated public android.database.sqlite.SQLiteDatabase getReadableDatabase()
getReadableDatabase in class android.database.sqlite.SQLiteOpenHelperjava.lang.UnsupportedOperationException - Use the getDatabaseConnection method and the reduceDatabaseConnection method to access the SQLiteDatabase@Deprecated public android.database.sqlite.SQLiteDatabase getWritableDatabase()
getWritableDatabase in class android.database.sqlite.SQLiteOpenHelperjava.lang.UnsupportedOperationException - Use the getDatabaseConnection method and the reduceDatabaseConnection method to access the SQLiteDatabasepublic void onCreate(android.database.sqlite.SQLiteDatabase db)
onCreate in class android.database.sqlite.SQLiteOpenHelperpublic void onUpgrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion)
onUpgrade in class android.database.sqlite.SQLiteOpenHelperCopyright © 2015 arconsis IT-Solutions GmbH. All Rights Reserved.