public class DatabaseConnector
extends java.lang.Object
Constructor and Description |
---|
DatabaseConnector(Context context)
Constructor for the class.
|
Modifier and Type | Method and Description |
---|---|
Cursor |
advanceQueue(int forward)
[DATABASE_QUEUE] Advances the marker for the current item of the queue and returns a cursor containing that item
|
void |
appendToQueue(long identity,
boolean isStreaming,
boolean isVideo)
[DATABASE_QUEUE]
|
void |
clearCalendar()
Clears all events from the database
|
void |
clearQueue()
[DATABASE_QUEUE] Removes all items from the queue
|
void |
clearShow(java.lang.String show)
[DATABASE_TABLE] Clears all episodes out of a show.
|
void |
close()
Closes the database when you are done with it.
|
Cursor |
currentQueue()
[DATABASE_QUEUE] Gets the current item in the queue.
|
Cursor |
dayEvents(java.lang.String specificDay,
int dayOfWeek)
Retrieves all events for a specific day
|
void |
deleteEpisode(long id)
[DATABASE_TABLE] Deletes one episode
|
void |
deleteQueueItem(long id)
[DATABASE_QUEUE] Removes one item from the queue
|
int |
eventCount()
Retrieves the number of number of events
|
int |
getLength(long identity) |
Cursor |
getOneEpisode(long id)
[DATABASE_TABLE] Gets one specific episode from the database.
|
Cursor |
getOneEvent(long id)
Gets one event.
|
Cursor |
getQueue()
[DATABASE_QUEUE] Gets the entirety of the queue.
|
Cursor |
getShow(java.lang.String show,
boolean filter)
[DATABASE_TABLE] Gets episodes of a specific show
|
void |
insertEpisode(java.lang.String show,
java.lang.String title,
java.lang.String date,
java.lang.String description,
java.lang.String link,
java.lang.String audioLink,
long audioSize,
java.lang.String videoLink,
long videoSize)
[DATABASE_TABLE] Inserts a new episode into the database.
|
void |
insertEvent(java.lang.String show,
java.lang.String type,
java.lang.String date,
java.lang.String time,
int recurring)
[DATABASE_CALENDAR] Inserts a new event.
|
boolean |
isInQueue(long identity)
[DATABASE_QUEUE] Tests if an item is in the the queue
|
void |
markAllNew(java.lang.String show,
boolean is_new)
[DATABASE_TABLE] Marks an episode as either new or not new.
|
void |
markNew(long id,
boolean is_new)
[DATABASE_TABLE] Marks an episode as either new or not new.
|
void |
move(long id1,
int dir)
[DATABASE_QUEUE] Moves an item either forward or back in the queue
|
void |
moveQueue(int fromID,
int toID) |
void |
open()
Opens the database so that it can be read or written.
|
void |
putLength(java.lang.String title,
long length) |
long |
queueCount()
[DATABASE_QUEUE] Gets the number of items in the queue.
|
Cursor |
searchEpisodes(java.lang.String searchTerm,
java.lang.String searchShow)
[DATABASE_TABLE] Searches all shows for a term
|
void |
updatePosition(long id,
long position)
[DATABASE_TABLE] Updates the position of an episode entry.
|
public DatabaseConnector(Context context)
context
- The context to associate with the connector.public void open() throws SQLException
SQLException
public void close()
public void insertEpisode(java.lang.String show, java.lang.String title, java.lang.String date, java.lang.String description, java.lang.String link, java.lang.String audioLink, long audioSize, java.lang.String videoLink, long videoSize)
public void markNew(long id, boolean is_new)
public void markAllNew(java.lang.String show, boolean is_new)
public void updatePosition(long id, long position)
id
- The ID of the entry to setposition
- The new position for the entrypublic Cursor getShow(java.lang.String show, boolean filter)
show
- The show to retrievefilter
- True to only show new episodes, False to show allpublic void clearShow(java.lang.String show)
show
- The show to clearpublic Cursor getOneEpisode(long id)
id
- The ID of the entry to retrievepublic void deleteEpisode(long id)
id
- The ID of the entry to be deletedpublic Cursor searchEpisodes(java.lang.String searchTerm, java.lang.String searchShow)
searchTerm
- The search term that is to be searched....for....public Cursor getQueue()
public void appendToQueue(long identity, boolean isStreaming, boolean isVideo)
identity
- The identity (note, not ID) of what to be appendedisStreaming
- True if it is a streaming entry, false otherwisepublic void move(long id1, int dir)
id1
- The ID to move either forward or backdir
- The direction to move; + is up, - is down, 0 is deletepublic void moveQueue(int fromID, int toID)
public long queueCount()
public void clearQueue()
public boolean isInQueue(long identity)
identity
- public void deleteQueueItem(long id)
id
- The ID of the item to remove from the queuepublic Cursor advanceQueue(int forward)
forward
- True moves it forward forward, false moves backwardpublic Cursor currentQueue()
public void insertEvent(java.lang.String show, java.lang.String type, java.lang.String date, java.lang.String time, int recurring)
recurring
- 0 if the event is non-recurring, the day index otherwise (1-7 for Sun-Sat)public Cursor getOneEvent(long id)
id
- The ID of the event to retrievepublic Cursor dayEvents(java.lang.String specificDay, int dayOfWeek)
specificDay
- the specific day (e.g. 20120123)dayOfWeek
- The day....wait for it....of the week. 1-7 for Sun-Satpublic int eventCount()
public void clearCalendar()
public int getLength(long identity)
public void putLength(java.lang.String title, long length)