|
||||||||||
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 AndroidConnectionSource |
connectionSource
|
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. |
Methods inherited from class android.database.sqlite.SQLiteOpenHelper |
---|
getReadableDatabase, getWritableDatabase, onOpen |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected AndroidConnectionSource connectionSource
Constructor Detail |
---|
public OrmLiteSqliteOpenHelper(android.content.Context context, String databaseName, android.database.sqlite.SQLiteDatabase.CursorFactory factory, int databaseVersion)
public OrmLiteSqliteOpenHelper(android.content.Context context, String databaseName, android.database.sqlite.SQLiteDatabase.CursorFactory factory, int databaseVersion, int configFileId)
OrmLiteConfigUtil
for details.
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.
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.
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.SQLiteOpenHelper
public void close()
close
in class android.database.sqlite.SQLiteOpenHelper
public 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
SQLException
public <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
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |