|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.database.sqlite.SQLiteOpenHelper
com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper
public abstract class OrmLiteSqliteOpenHelper
SQLite database open helper which can be extended by your application to help manage when the application needs to create or upgrade its database.
| Field Summary | |
|---|---|
protected boolean |
cancelQueriesEnabled
|
protected AndroidConnectionSource |
connectionSource
|
protected static com.j256.ormlite.logger.Logger |
logger
|
| Constructor Summary | |
|---|---|
OrmLiteSqliteOpenHelper(android.content.Context context,
String databaseName,
android.database.sqlite.SQLiteDatabase.CursorFactory factory,
int databaseVersion)
|
|
OrmLiteSqliteOpenHelper(android.content.Context context,
String databaseName,
android.database.sqlite.SQLiteDatabase.CursorFactory factory,
int databaseVersion,
File configFile)
Same as the other constructor with the addition of a config-file. |
|
OrmLiteSqliteOpenHelper(android.content.Context context,
String databaseName,
android.database.sqlite.SQLiteDatabase.CursorFactory factory,
int databaseVersion,
InputStream stream)
Same as the other constructor with the addition of a input stream to the table config-file. |
|
OrmLiteSqliteOpenHelper(android.content.Context context,
String databaseName,
android.database.sqlite.SQLiteDatabase.CursorFactory factory,
int databaseVersion,
int configFileId)
Same as the other constructor with the addition of a file-id of the table config-file. |
|
| Method Summary | ||
|---|---|---|
void |
close()
Close any open connections. |
|
com.j256.ormlite.support.ConnectionSource |
getConnectionSource()
Get the connection source associated with the helper. |
|
|
getDao(Class<T> clazz)
Get a DAO for our class. |
|
|
getRuntimeExceptionDao(Class<T> clazz)
Get a RuntimeExceptionDao for our class. |
|
boolean |
isOpen()
Return true if the helper is still open. |
|
void |
onCreate(android.database.sqlite.SQLiteDatabase db)
Satisfies the SQLiteOpenHelper.onCreate(SQLiteDatabase) interface method. |
|
abstract void |
onCreate(android.database.sqlite.SQLiteDatabase database,
com.j256.ormlite.support.ConnectionSource connectionSource)
What to do when your database needs to be created. |
|
abstract void |
onUpgrade(android.database.sqlite.SQLiteDatabase database,
com.j256.ormlite.support.ConnectionSource connectionSource,
int oldVersion,
int newVersion)
What to do when your database needs to be updated. |
|
void |
onUpgrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion)
Satisfies the SQLiteOpenHelper.onUpgrade(SQLiteDatabase, int, int) interface method. |
|
String |
toString()
|
|
| Methods inherited from class android.database.sqlite.SQLiteOpenHelper |
|---|
getDatabaseName, getReadableDatabase, getWritableDatabase, onConfigure, onDowngrade, onOpen, setWriteAheadLoggingEnabled |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static com.j256.ormlite.logger.Logger logger
protected AndroidConnectionSource connectionSource
protected boolean cancelQueriesEnabled
| Constructor Detail |
|---|
public OrmLiteSqliteOpenHelper(android.content.Context context,
String databaseName,
android.database.sqlite.SQLiteDatabase.CursorFactory factory,
int databaseVersion)
context - Associated content from the application. This is needed to locate the database.databaseName - Name of the database we are opening.factory - Cursor factory or null if none.databaseVersion - Version of the database we are opening. This causes onUpgrade(SQLiteDatabase, int, int) to be
called if the stored database is a different version.
public OrmLiteSqliteOpenHelper(android.content.Context context,
String databaseName,
android.database.sqlite.SQLiteDatabase.CursorFactory factory,
int databaseVersion,
int configFileId)
OrmLiteConfigUtil for details.
context - Associated content from the application. This is needed to locate the database.databaseName - Name of the database we are opening.factory - Cursor factory or null if none.databaseVersion - Version of the database we are opening. This causes onUpgrade(SQLiteDatabase, int, int) to be
called if the stored database is a different version.configFileId - file-id which probably should be a R.raw.ormlite_config.txt or some static value.
public OrmLiteSqliteOpenHelper(android.content.Context context,
String databaseName,
android.database.sqlite.SQLiteDatabase.CursorFactory factory,
int databaseVersion,
File configFile)
OrmLiteConfigUtil for details.
context - Associated content from the application. This is needed to locate the database.databaseName - Name of the database we are opening.factory - Cursor factory or null if none.databaseVersion - Version of the database we are opening. This causes onUpgrade(SQLiteDatabase, int, int) to be
called if the stored database is a different version.configFile - Configuration file to be loaded.
public OrmLiteSqliteOpenHelper(android.content.Context context,
String databaseName,
android.database.sqlite.SQLiteDatabase.CursorFactory factory,
int databaseVersion,
InputStream stream)
OrmLiteConfigUtil for details.
context - Associated content from the application. This is needed to locate the database.databaseName - Name of the database we are opening.factory - Cursor factory or null if none.databaseVersion - Version of the database we are opening. This causes onUpgrade(SQLiteDatabase, int, int) to be
called if the stored database is a different version.stream - Stream opened to the configuration file to be loaded.| Method Detail |
|---|
public abstract void onCreate(android.database.sqlite.SQLiteDatabase database,
com.j256.ormlite.support.ConnectionSource connectionSource)
NOTE: You should use the connectionSource argument that is passed into this method call or the one returned by getConnectionSource(). If you use your own, a recursive call or other unexpected results may result.
database - Database being created.connectionSource - To use get connections to the database to be created.
public abstract void onUpgrade(android.database.sqlite.SQLiteDatabase database,
com.j256.ormlite.support.ConnectionSource connectionSource,
int oldVersion,
int newVersion)
NOTE: You should use the connectionSource argument that is passed into this method call or the one returned by getConnectionSource(). If you use your own, a recursive call or other unexpected results may result.
database - Database being upgraded.connectionSource - To use get connections to the database to be updated.oldVersion - The version of the current database so we can know what to do to the database.newVersion - The version that we are upgrading the database to.public com.j256.ormlite.support.ConnectionSource getConnectionSource()
public final void onCreate(android.database.sqlite.SQLiteDatabase db)
SQLiteOpenHelper.onCreate(SQLiteDatabase) interface method.
onCreate in class android.database.sqlite.SQLiteOpenHelper
public final void onUpgrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion)
SQLiteOpenHelper.onUpgrade(SQLiteDatabase, int, int) interface method.
onUpgrade in class android.database.sqlite.SQLiteOpenHelperpublic void close()
close in class android.database.sqlite.SQLiteOpenHelperpublic boolean isOpen()
close() is called then this will return false.
public <D extends com.j256.ormlite.dao.Dao<T,?>,T> D getDao(Class<T> clazz)
throws SQLException
DaoManager to cache the DAO for future gets.
NOTE: This routing does not return Dao
SQLExceptionpublic <D extends com.j256.ormlite.dao.RuntimeExceptionDao<T,?>,T> D getRuntimeExceptionDao(Class<T> clazz)
DaoManager to cache the DAO for future gets.
NOTE: This routing does not return RuntimeExceptionDao
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||