Hi all, in the instruction file I receive from Sun, I see both the field length (specified explicitly such as: name - 64, size - 4, smoking - 1), and the schema description which allows me to get the length of the field programmatically: --------------------------- 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 ---------------------------
My question is that since I can determine the fields' lengths by examine the schema description, why on earth they already explicitly show me that name is of length 64, smoking is of length 1 and so on??? Should I just use one mechanism, either use constants or read the schema, to extract the fields' values and ignore the other?
The schema description vary from a file to an other - more simpe you can have different database file with different (data) scheme. If the database format changes in the future your applcation must be flexible enought to support this changes with minimal (or preferable with none) code changing. The docuement from sun presents the actual database form but as I said this can change in the future.
Regards Mihai [ April 10, 2006: Message edited by: Mihai Radulescu ]
Its a design decision you need to make. Using constants is easier, but will require program changes if the database changes. Using the schema description may allow the program to continue to work if the database changes, but such design will be complex. I said may because you have to ask yourself, would you be able to anticipate all possible database changes and properly design and code for them?
SCJD<br />SCJP 1.4
posted 14 years ago
Thanks, Mihai & Chen. I guess I would use the schema instead of the constants.
Now I am super curious what sports would be like if we allowed drugs and tiny ads.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop