Originally posted by Jared Chapman:
I wouldn't return this with the String[]. If the flag specifies that the record is deleted/invalid, then just throw a RecordNotFoundException.
I was thinking the same way myself but then I looked at method signature
and comment on supplied DB file
// Reads a record from the file. Returns an array where each
// element is a record value.
public String[] read(int recNo) throws RecordNotFoundException;
It doesn't preclude returning invlaid records.
And then the question is how do I delete a record.
If read return the flag in the array then I simply have delete do a read and then update returned string array to change flag and call update passing string array.
If not then I have to go SIZEOFRECORDINBYTES * recno - 1 into byte array and change the relevant byte.
Just seemed cleaner to return the flag but I'm prepared to be talked out of it
Do you do delete similar to way set out above ?