|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdata.Database
public class Database
The database implements all the database functionality such as adding updating, and deleting records
Field Summary |
---|
Fields inherited from interface |
---|
AND, OR |
Constructor Summary | |
---|---|
Database()
Upon the initialization of the database, it will load the content from the file |
Method Summary | |
---|---|
int |
addRecord(String[] data)
Creates a new record in the database (possibly re-using a deleted record identifier). |
void |
deleteRecord(int recNo)
Deletes a record, making the record identifier and database file position available for re-use. |
int[] |
findRecords(String[] criteria,
int bool)
Returns an array of record identifiers that map to records that match the specified search criteria. |
int[] |
getAllRecords()
Query all the record number of all data stored |
String[] |
readRecord(int recNo)
Returns record data from the database specified by the record identifier supplied. |
void |
save()
Save the database to a file |
void |
updateRecord(int recNo,
String[] data)
Modifies the fields of a record. |
Methods inherited from class |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Database()
Method Detail |
---|
public int addRecord(String[] data) throws DuplicateIndexException
addRecord
in interface DAO
data
- the values for the new record
DuplicateIndexException
public void deleteRecord(int recNo) throws RecordNotFoundException
deleteRecord
in interface DAO
recNo
- the record to be deleted
RecordNotFoundException
public int[] findRecords(String[] criteria, int bool)
findRecords
in interface DAO
criteria
- the values of the search criteriabool
- indicates an AND or OR search
public int[] getAllRecords()
public String[] readRecord(int recNo) throws RecordNotFoundException
readRecord
in interface DAO
recNo
- an index to directly access the list of record
RecordNotFoundException
public void save()
public void updateRecord(int recNo, String[] data) throws RecordNotFoundException
updateRecord
in interface DAO
recNo
- the record to be updateddata
- the new values of the record
RecordNotFoundException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |