Why not? A match is a match. I don't see why it would be different because some other field of the record is empty.Also records with empty fields should be displayed (if matching search criteria)?
Should be booking allowed on them?
That's a corrupted data file, which I don't process. An error message will be shown. Trying to handle this will require some extra code, and is it really needed to work on a corrupted file? Maybe other data got corrupted too (but is still according to the database schema) and turns out to be complete nonsense.Eventually when reaching the offset of the last record but not enough bytes to read (length of a record) it will stop and ignore that particular incomplete chunk of "record" data.
SCJP 6 , OCMJD 6 ,
http://www.robertbenson.ie/
Roel De Nijs wrote:
I read the database file (dynamically) as follows (I didn't use constants to jump directly to the data section for example):
check magic cookie read database schema calculate how many records the database file contains for every record read the "deleted" flag and all fields (I only check the flag for "deleted" status)
..............
Roel De Nijs wrote: What's the benefit of hard coding the number of fields in your assignment?
If you hard-code number of fields and you also get 2 extra fields, you'll just keep writing every record to the database file and after 1 write it will be corrupted (because you write 6 fields and the record structure is expecting 8) (unless you throw an exception when the number of fields you read from database file doesn't match with your hard-coded value).
If they don't: when you update/create a record in my application I validate the size of data-array (still 6, because no changes to program) with the number of fields (changed to 8, because dynamically read). So 6 vs 8 is not a match, and an exception will be raised and no changes could be made
Seetharaman Iyer wrote:That's I do check, No of fields per record should match with hard-coded number of fields value.
Seetharaman Iyer wrote:According to this, you are also using hard-coded expected value, but using it in different way.
Mine is check-on-load mechanism. Yours is lazy-check mechanism.
So Is it safe to assume that, if magic cookie matches, then this database file must have only 6 fields in each record (2 bytes flag is taken care) or based on number of fields, I've to act upon?
Seriously Rick? Seriously? You might as well just read this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|