• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S - Some more questions according the database (see third post)

 
Daniel Haupt
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hi there, got a question according the data class design, more specific to the readRecord() function.

The assignment says the following about the first chapter of the file (database schema):

On 2nd place, there is a 4byte numeric indicating the total length in bytes of each record.

Another section of the sun assignment tells me that all fields that are less than the maximum lenght are null terminated. Means this they have to be terminated by n null bytes until the total length of the field?? Because if not so, it's controversial to the first conclusion telling about the total length of each record.

If so, the values from the original file inherited in the assignment; I read them and return them to the client via the string array[]. Did these values have whitespaces at the end because they are not null terminated? These are "ugly" values, that's because I'm unsure...

Thanks four your help,

Daniel

[ May 16, 2007: Message edited by: Daniel Haupt ]
[ May 23, 2007: Message edited by: Daniel Haupt ]
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Daniel Haupt:


Hi there, got a question according the data class design, more specific to the readRecord() function.

The assignment says the following about the first chapter of the file (database schema):

On 2nd place, there is a 4byte numeric indicating the total length in bytes of each record.

Another section of the sun assignment tells me that all fields that are less than the maximum lenght are null terminated. Means this they have to be terminated by n null bytes until the total length of the field?? Because if not so, it's controversial to the first conclusion telling about the total length of each record.

If so, the values from the original file inherited in the assignment; I read them and return them to the client via the string array[]. Did these values have whitespaces at the end because they are not null terminated? These are "ugly" values, that's because I'm unsure...

Thanks four your help,

Daniel

[ May 16, 2007: Message edited by: Daniel Haupt ]


Yes all records are padded out to the length as specified in the header. In my assignment it turned out that the fields were not padded with nulls but rather with spaces. It is a deliberate specification error designed to make you solve a conflict similar to what might happen on a real world project. Do you choose to follow the specification or go with the the actual file format? There is no wrong answr here.
 
Daniel Haupt
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand.

Thanks a thousand times.
 
Daniel Haupt
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some more questions:

I'm still not quite sure about my database design. My current decision is to create the data class that implements all the methods of the DBAccess interface. This class contains no cache (like a list of all records and all deleted records).

I want my gui to communicate (and later communicate via rmi) with a adapter class which deals with real Record and Criteria objects and i want this adapter class to hold a caching mechanism.

I also have implemented an iterator for the data class that allows the adapter class to easily iterate through all the records of the database and to init it's cache.

Not to have a cache in the data class makes me unsure, if the findByCriteria -Method that reads through the whole database file will be fast enough. But I'm also not sure, if I will use the findByCriteria-Method of my data class at all, but still implement an independend findByCriteria-Method in my adapter class that iterates through the cache.

I also does not have a clear idea about the sense of the lock- and unlock-methods of the DBAccess interface. Isn't it enough to make sure, that the update, delete and create methods are doing their work in a synchronized way?

For any helpful suggestions, ideas, reviews and answers according my design and my questions I would be grateful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic