|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
This interface is implemented by all classes which represent a database. This includes databases on the device, as well as those in any other storage.
| Field Summary | |
static int |
OPEN_DEFAULT
Opened with default settings (read/write, exclusive). |
static int |
OPEN_EXCLUSIVE
Opened for exclusive access. |
static int |
OPEN_READ
Opened for read access. |
static int |
OPEN_WRITE
Opened for write access. |
| Method Summary | |
void |
close()
Closes the database. |
AppBlock |
createAppBlock()
Create a new instance of an AppBlock that matches the Database. |
Pref |
createPref(int id)
Create a new instance of a Pref that matches the Database. |
Pref |
createPref(int id,
int version,
boolean backed_up)
Create a new instance of a Pref that matches the Database. |
Record |
createRecord()
Create a new Record with an unspecified RecordID (0). |
Record |
createRecord(byte[] contents,
RecordID id,
int index,
int attr,
int cat)
Create a new Record with the specified RecordID. |
Record |
createRecord(RecordID id)
Create a new Record with the specified RecordID. |
Resource |
createResource()
Create a new instance of a Resource that matches the Database. |
Resource |
createResource(byte[] contents,
Char4 type,
int id,
int index)
Create a new instance of a Resource that matches the Database. |
Resource |
createResource(Char4 type,
int id)
Create a new instance of a Resource that matches the Database. |
SortBlock |
createSortBlock()
Create a new instance of a SortBlock that matches the Database. |
void |
deleteAllRecords()
Delete ALL records in the database. |
void |
deleteAllResources()
Delete ALL resources. |
void |
deleteCategory(int category)
Delete all records from a specified category |
void |
deleteRecord(RecordID uid)
Delete the record with the specified UID from the database. |
void |
deleteResource(Char4 type,
int id)
Delete a single resource from the database. |
AppBlock |
getAppBlock()
Get a new instance of an AppBlock that matches the Database. |
DBInfo |
getDBInfo()
Return meta-information about the Database. |
Record |
getNextModifiedRecord()
Retrieve the next modified Record from the Database. |
Record |
getNextModifiedRecord(int category)
Retrieve the next modified Record within the specified category from the Database. |
Record |
getNextRecord(int category)
Retrieve the next Record within the specified category from the Database. |
Pref |
getPref(int id)
Get one of the preferences which are associated with the same app as the database. |
Pref |
getPref(int id,
boolean backed_up)
Get one of the preferences which are associated with the same app as the database. |
Record |
getRecord(int index)
Retrieve the Record with the specified index from the Database. |
Record |
getRecord(RecordID uid)
Retrieve the Record with the specified UID from the Database. |
int |
getRecordCount()
Return the number of records in the Database. |
RecordID[] |
getRecordIDs()
Return the UIDs of all records in the DB, in an unsorted fashion. |
RecordID[] |
getRecordIDs(boolean sort)
Return the UIDs of all records in the DB. |
RecordID[] |
getRecordIDs(boolean sort,
int start)
Return the UIDs of selected records in the DB. |
RecordID[] |
getRecordIDs(boolean sort,
int start,
int max)
Return the UIDs of selected records in the DB. |
Resource |
getResource(Char4 type,
int id)
Get a resource through the type and id. |
Resource |
getResource(int index)
Get a resource through the specified index. |
SortBlock |
getSortBlock()
Get a new instance of a SortBlock that matches the Database. |
void |
moveCategory(int from,
int to)
|
void |
purgeRecords()
Deletes all records which are marked as archived or deleted |
void |
putRecord(Record record)
Stores a record in the database. |
void |
putResource(Resource resource)
Store a resource in the database. |
void |
resetFlags()
For record databases, reset all dirty flags. |
void |
resetNext()
Resets the 'next record' index to the beginning |
void |
setAppBlock(AppBlock appblock)
Associate the AppBlock with the Database. |
void |
setDBInfo(DBInfo dbinfo)
Associate a complete set of meta-information with the Database. |
void |
setPref(Pref pref)
Store a Pref which is associated with the same app as the database to the database. |
void |
setSortBlock(SortBlock sortblock)
Associate the SortBlock with the Database. |
| Field Detail |
public static final int OPEN_READ
public static final int OPEN_WRITE
public static final int OPEN_EXCLUSIVE
public static final int OPEN_DEFAULT
| Method Detail |
public AppBlock getAppBlock()
throws DatabaseException
public void setAppBlock(AppBlock appblock)
throws DatabaseException
public AppBlock createAppBlock()
Note: Avoid using the new-operator in order to create an AppBlock.
public SortBlock getSortBlock()
throws DatabaseException
public void setSortBlock(SortBlock sortblock)
throws DatabaseException
public SortBlock createSortBlock()
Note: Avoid using the new-operator in order to create a SortBlock.
public Record getRecord(int index)
throws DatabaseException
index - the index of the Recordnull, if the specified Record could not be found.
public Record getRecord(RecordID uid)
throws DatabaseException
uid - the UID of the Recordnull, if the specified Record could not be found.
public Record getNextRecord(int category)
throws DatabaseException
category - the category from which the Record shall be takennull, if the specified Record could not be found.resetNext()
public Record getNextModifiedRecord()
throws DatabaseException
null, if the specified Record could not be found.resetNext()
public Record getNextModifiedRecord(int category)
throws DatabaseException
category - the category from which the Record shall be takennull, if the specified Record could not be found.resetNext()
public void resetNext()
throws DatabaseException
public void putRecord(Record record)
throws DatabaseException
public Record createRecord()
Note: Avoid using the new-operator in order to create a Record.
public Record createRecord(RecordID id)
Note: Avoid using the new-operator in order to create a Record.
id - the unique ID of the record
public Record createRecord(byte[] contents,
RecordID id,
int index,
int attr,
int cat)
Note: Avoid using the new-operator in order to create a Record.
contents - the raw contents of the Recordid - the unique ID of the recordindex - the index of the record within the databaseattr - the attributes of the recordcat - the category of the record
public void deleteRecord(RecordID uid)
throws DatabaseException
uid - the UID (not the index!) of the record
public void deleteAllRecords()
throws DatabaseException
public void deleteCategory(int category)
throws DatabaseException
category - the category
public void moveCategory(int from,
int to)
throws DatabaseException
public RecordID[] getRecordIDs()
throws DatabaseException
public RecordID[] getRecordIDs(boolean sort)
throws DatabaseException
public RecordID[] getRecordIDs(boolean sort,
int start)
throws DatabaseException
public RecordID[] getRecordIDs(boolean sort,
int start,
int max)
throws DatabaseException
public void purgeRecords()
throws DatabaseException
public Resource getResource(int index)
throws DatabaseException
public Resource getResource(Char4 type,
int id)
throws DatabaseException
public void putResource(Resource resource)
throws DatabaseException
public Resource createResource()
Note: Avoid using the new-operator in order to create an Resource.
public Resource createResource(Char4 type,
int id)
Note: Avoid using the new-operator in order to create an Resource.
type - the type of the Resourceid - the id of the Resource
public Resource createResource(byte[] contents,
Char4 type,
int id,
int index)
Note: Avoid using the new-operator in order to create an Resource.
contents - the raw contents of the Resourcetype - the type of the Resourceid - the id of the Resourceindex - the index of the Resource with in the database
public void deleteResource(Char4 type,
int id)
throws DatabaseException
type - the type of the Resourceid - the id of the Resource
public void deleteAllResources()
throws DatabaseException
public Pref getPref(int id)
throws DatabaseException,
NoCreatorException
id - the id of the preference
public Pref getPref(int id,
boolean backed_up)
throws DatabaseException,
NoCreatorException
id - the id of the preferencebacked_up - Shall the Pref be taken from the saved (true) or from the unsaved (false) preferences?
public void setPref(Pref pref)
throws DatabaseException
public Pref createPref(int id)
Note: Avoid using the new-operator in order to create a Pref.
id - the id of the preference
public Pref createPref(int id,
int version,
boolean backed_up)
Note: Avoid using the new-operator in order to create a Pref.
id - the id of the preferenceversion - the version number of the applicationbacked_up - Shall the Pref be taken from the saved (true) or from the unsaved (false) preferences?
public void close()
throws DatabaseException
public void resetFlags()
throws DatabaseException
public int getRecordCount()
throws DatabaseException
public DBInfo getDBInfo()
throws DatabaseException
public void setDBInfo(DBInfo dbinfo)
throws DatabaseException
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||