de.msponer.android.yac.db
Class DatabaseHelper

java.lang.Object
  extended by android.database.sqlite.SQLiteOpenHelper
      extended by com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper
          extended by de.msponer.android.yac.db.DatabaseHelper

public class DatabaseHelper
extends com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper

ORM-Lite Database Helper class. For details see ORMLite manual.

Author:
msponer

Constructor Summary
DatabaseHelper(Context context)
          Constructor setting the required parameters.
 
Method Summary
 void close()
          Closes the database connections and clears any cached DAOs.
 void dropMobileWorkItemTable()
          Drops the mobile work item table.
 com.j256.ormlite.dao.Dao<MobileWorkItem,Integer> getMobileWorkItemDao()
          Returns the Database Access Object (DAO) for our MobileWorkItem class.
 void onCreate(SQLiteDatabase db, com.j256.ormlite.support.ConnectionSource connectionSource)
          This is called when the database is first created.
 void onUpgrade(SQLiteDatabase db, com.j256.ormlite.support.ConnectionSource connectionSource, int oldVersion, int newVersion)
          This is called when your application is upgraded and it has a higher version number.
 
Methods inherited from class com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper
getConnectionSource, getDao, onCreate, onUpgrade
 
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
 

Constructor Detail

DatabaseHelper

public DatabaseHelper(Context context)
Constructor setting the required parameters.

Parameters:
context - The application context.
Method Detail

onCreate

public void onCreate(SQLiteDatabase db,
                     com.j256.ormlite.support.ConnectionSource connectionSource)
This is called when the database is first created. Usually you should call createTable statements here to create the tables that will store your data.

Specified by:
onCreate in class com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper
Parameters:
db - The SQLite db.
connectionSource - The connection source.

onUpgrade

public void onUpgrade(SQLiteDatabase db,
                      com.j256.ormlite.support.ConnectionSource connectionSource,
                      int oldVersion,
                      int newVersion)
This is called when your application is upgraded and it has a higher version number. This allows you to adjust the various data to match the new version number.

Specified by:
onUpgrade in class com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper
Parameters:
db - The SQLite db.
connectionSource - The connection source.
oldVersion - The old db version.
newVersion - The new db version.

getMobileWorkItemDao

public com.j256.ormlite.dao.Dao<MobileWorkItem,Integer> getMobileWorkItemDao()
                                                                      throws SQLException
Returns the Database Access Object (DAO) for our MobileWorkItem class. It will create it or just give the cached value.

Returns:
The mobile work item dao.
Throws:
SQLException - Error during query.

dropMobileWorkItemTable

public void dropMobileWorkItemTable()
Drops the mobile work item table.


close

public void close()
Closes the database connections and clears any cached DAOs.

Overrides:
close in class com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper