public class AlarmClockDBHelper
extends android.database.sqlite.SQLiteOpenHelper
Constructor and Description |
---|
AlarmClockDBHelper(android.content.Context context)
Default constructor requiring context.
|
Modifier and Type | Method and Description |
---|---|
void |
addAlarmClock(AlarmClock alarmClock)
Adds an alarm clock to the database, including the time for its alarm, and whether it is
currently set or not.
|
int |
deleteAlarmClock(java.util.UUID uuid)
Deletes the alarm clock that has UUID uuid.
|
android.database.Cursor |
getAlarmClock(java.util.UUID uuid)
Gets the alarm clock with UUID uuid, if it exists in the database.
|
int |
getAlarmClockCount()
Returns the number of alarm clocks in the database, active or not.
|
android.database.Cursor |
getAllAlarmClocks()
Returns a list of all alarm clocks currently in the database, active or not.
|
void |
onCreate(android.database.sqlite.SQLiteDatabase db)
Creates all tables for the database.
|
void |
onUpgrade(android.database.sqlite.SQLiteDatabase db,
int oldVersion,
int newVersion)
Will drop all tables if they exist and recreate them.
|
int |
updateAlarmClock(AlarmClock alarmClock)
Updates an existing alarm clock to the parameters of the passed in alarm clock.
|
public AlarmClockDBHelper(android.content.Context context)
context
- The context of the database.public void onCreate(android.database.sqlite.SQLiteDatabase db)
onCreate
in class android.database.sqlite.SQLiteOpenHelper
db
- The database we create tables for.AlarmClockDBSchema
public void onUpgrade(android.database.sqlite.SQLiteDatabase db, int oldVersion, int newVersion)
onUpgrade
in class android.database.sqlite.SQLiteOpenHelper
db
- The database to drop and recreate.oldVersion
- Old version of the database.newVersion
- New version of the database.AlarmClockDBSchema
public void addAlarmClock(AlarmClock alarmClock)
alarmClock
- The AlarmClock object to add to the database.public android.database.Cursor getAlarmClock(java.util.UUID uuid)
uuid
- The UUID of the alarm clock to get.public android.database.Cursor getAllAlarmClocks()
public int getAlarmClockCount()
public int updateAlarmClock(AlarmClock alarmClock)
alarmClock
- The alarm clock whose values to copy into the alarm clock with UUID uuid.public int deleteAlarmClock(java.util.UUID uuid)
uuid
- The UUID of the alarm clock to delete.