|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectandroid.database.sqlite.SQLiteOpenHelper
de.theappguys.winzigsql.WinzigDbScriptHelper
public class WinzigDbScriptHelper
Extension of SQLiteOpenHelper that handles initialization & upgrade of the database based on naming conventions for resources in the asset files. Works hand-in-hand with the WinzigDbProvider
| Field Summary | |
|---|---|
static String |
LOG_TAG
|
| Constructor Summary | |
|---|---|
WinzigDbScriptHelper(android.content.Context context,
String dbName,
int dbVersion)
Let your custom db provider extends this class and call the superconstructor like so: |
|
| Method Summary | |
|---|---|
boolean |
dropDb()
Only for debugging purposes. |
void |
onCreate(android.database.sqlite.SQLiteDatabase db)
(non-Javadoc) |
void |
onOpen(android.database.sqlite.SQLiteDatabase db)
We override onOpen to enable foreign keys. |
void |
onUpgrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion)
(non-Javadoc) |
| Methods inherited from class android.database.sqlite.SQLiteOpenHelper |
|---|
close, getReadableDatabase, getWritableDatabase |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String LOG_TAG
| Constructor Detail |
|---|
public WinzigDbScriptHelper(android.content.Context context,
String dbName,
int dbVersion)
private MyDbHelper(final Context context) {
super (context, "myDbName", 42);
}
Then, to obtain instances, implement a get Instance method like this:
private static MyDbHelper instance = null;
public static MyDbHelper(final Context context) {
if (instance == null) {
return (instance = new MyDbHelper(context))
} else {
return instance;
}
}
| Method Detail |
|---|
public void onCreate(android.database.sqlite.SQLiteDatabase db)
onCreate in class android.database.sqlite.SQLiteOpenHelperSQLiteOpenHelper.onCreate(android.database.sqlite.SQLiteDatabase)
public void onUpgrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion)
onUpgrade in class android.database.sqlite.SQLiteOpenHelperSQLiteOpenHelper.onUpgrade(android.database.sqlite.SQLiteDatabase, int, int)public void onOpen(android.database.sqlite.SQLiteDatabase db)
onOpen in class android.database.sqlite.SQLiteOpenHelperpublic boolean dropDb()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||