Hi all,
my assignment is going well. Bu some db points are confusing me.
1- In networked and standalone mode, the db file will be accessed. But in the assingment, there is not any clue about where this db file will reside?
I just wonder if it is under the working directory like properties file?
I assume the working directory is where we run the program using java.
2- I am using singleton pattern for Data.java, as the assignment says only one program will be accessing it. Am I right?
3- In the db interface, there is a cookie whic is generated by the lock method. How is this number generated?
And when updating a record, I should send the cookie parameter which was generated by the lock of the atomic operation?
4- My assignment shows the database file schema. I know how to use the data section as I will be playing on this section. But what about the first two section? I just wonder if I should use the two sections as well. If so how should I use them? The schema is as follows:
Start of file
4 byte numeric, magic cookie value. Identifies this as a data file
4 byte numeric, total overall length in bytes of each record
2 byte numeric, number of fields in each record
Schema description section.
Repeated for each field in a record:
2 byte numeric, length in bytes of field name
n bytes (defined by previous entry), field name
2 byte numeric, field length in bytes
end of repeating block
Data section.
Repeat to end of file:
1 byte "deleted" flag. 0 implies valid record, 1 implies deleted record
Record containing fields in order specified in schema section, no separators between fields, each field fixed length at maximum specified in schema information
End of file
any idea is highly appreciated.
Kind regards,
syucel