posted 16 years ago
Hi, I've two questions about the code accessing the db file:
1) It is correct to check the corrispondance between magic cookie and the current version of the DAO? In my case, for version 2x2, I use readInt (4 bytes) then I compare with 0x0202 (constant of my DAO Class), throwing an exception if it fails.
2) The format of the file is quite unclear on Sun's instructions. Based on this sentence:
"2 byte flag. 00 implies valid record, 0x8000 implies deleted record".
This flag (why two bytes for a boolean flag??) is expressend in two different formats. It is correct to use these two constants?
public final static short FLAG_DELETED_RECORD = 0x80;
public final static short FLAG_VALID_RECORD = 0x00;
I can't use 0x8000, like in instructions, because I can't assign 0x8000 to a short value, but to read the field I use readShort (two bytes) and I need to compare this value with the two constants.
Thanks in advance.