Hi All,
I am having a hard time trying to figure out how to make sense and read the Schema Description Section in the Data File Format.
With my assignment I got:
***************************************************************
Data file Format
The format of data in the database file is as follows:
Start of file
4 byte numeric, magic cookie value. Identifies this as a data file
2 byte numeric, number of fields in each record
Schema description section.
Repeated for each field in a record:
1 byte numeric, length in bytes of field name
n bytes (defined by previous entry), field name
1 byte numeric, field length in bytes
end of repeating block
Data section.
Repeat to end of file:
1 byte flag. 00 implies valid record, 0xFF 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
All numeric values are stored in the header information use the formats of the DataInputStream and DataOutputStream classes. All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field. The character encoding is 8 bit US ASCII.
Database schema
The database that URLyBird uses contains the following fields:
Field descriptive name Database field name Field length Detailed description
Hotel Name name 64 The name of the hotel this vacancy record relates to
City location 64 The location of this hotel
Maximum occupancy of this room size 4 The maximum number of people permitted in this room, not including infants
Is the room smoking or non-smoking smoking 1 Flag indicating if smoking is permitted. Valid values are "Y" indicating a smoking room, and "N" indicating a non-smoking room
Price per night rate 8 Charge per night for the room. This field includes the currency symbol
Date available date 10 The single night to which this record relates, format is yyyy/mm/dd.
Customer holding this record owner 8 The id value (an 8 digit number) of the customer who has booked this. Note that for this application,
you should assume that customers and CSRs know their customer ids. The system you are writing does not interact with these numbers, rather it simply records them. If this field is all blanks, the record is available for sale.
***************************************************************
I know once I figure out how to read the Schema Description Section of my Data File I will be able to calculate the offset to the first record.
However following the description above and trying to read the database file with the Solaris "od -A d -c" command it doesn't make any sense.
Is there any other command in Solaris or any other Operating System to read the file so I can make sense of the Schema Description Section and calculate the offset from the beginning of
the file to the first record?
Thanks in advance,
Carlos.