java.lang.Object | ||
↳ | android.database.sqlite.SQLiteOpenHelper | |
↳ | com.kinvey.android.offline.FileCacheSqlHelper |
This class manages a sqlite database for maintaining metadata about cached files. Each file must have a unique identifier and a filename. If the filename is unique, that can be used as the unique id.
This class provides methods for saving new records, retrieving records, and deleting records.Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
deleteRecord(String id)
Remove a record from the table
| ||||||||||
void |
dump()
Dump the contents of the database to the logs, used for debugging purposes.
| ||||||||||
String |
getFileNameForId(String id)
Return the filename of the file on disc relavant to the provided id
| ||||||||||
synchronized static FileCacheSqlHelper |
getInstance(Context context)
This class is a synchronized Singleton, and this is how you get an instance of it.
| ||||||||||
void |
insertRecord(Client client, FileMetaData meta)
Insert a new record into the file cache metadata table.
| ||||||||||
void |
onCreate(SQLiteDatabase sqLiteDatabase)
Called by android first time this database is accessed, to create it.
| ||||||||||
void | onUpgrade(SQLiteDatabase sqLiteDatabase, int current, int next) | ||||||||||
void |
runCommand(String command, SQLiteDatabase db)
Execute an arbitrary sqlite command against a sqlite database.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Remove a record from the table
id | the id of the record to remove |
---|
Dump the contents of the database to the logs, used for debugging purposes.
Return the filename of the file on disc relavant to the provided id
id | the id of the filename to look up |
---|
null
This class is a synchronized Singleton, and this is how you get an instance of it.
context | the current active application context |
---|
Insert a new record into the file cache metadata table.
client | a Kinvey Client, needed for JSON serialization |
---|---|
meta | the FileMetaData object for the file, containing an id and a filename
|
Called by android first time this database is accessed, to create it.
Execute an arbitrary sqlite command against a sqlite database.
no validation is performed here.command | the command to execute |
---|---|
db | the database to execute the command against |