Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bodgitt and scraper, flag question

 
Hanna Habashy
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi:
I have just downloaded the assignment, and I am trying to decipher the requerments. In the data section of the database it says:
Repeat to end of file
1 byte "deleted" flag. 0 implies valid record, 1 implies deleted record.
can someone tell me what is the location of this byte withen a record. Is is in the begining of the record, or the end or it.
thanks
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hanna,
You will need to verify this in your instructions. Mine state:
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

So the deleted flag appears before each record:
  • Deleted flag
  • name (record 1)
  • location
  • ...
  • owner
  • Deleted flag
  • name (record 2)
  • location
  • ...
  • owner


  • Regards, Andrew
     
    Hanna Habashy
    Ranch Hand
    Posts: 532
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    hi Andrew:
    Thank you for your reply. I am going to write a simple test class to varify all the information. I have one more question. Is that mean the flag byte part of the record length or not?
    thanks
     
    Richard Everhart
    Ranch Hand
    Posts: 54
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    This stumped me for a bit. The deleted flag could be considered part of a record (that's the way I think of it) but it's not part of the the schema. So, I'd say that yes, the deleted flag is part of a record.
    Rich
     
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander
    Pie
    Posts: 12014
    220
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Hanna & Richard,
    Originally posted by Hanna Habashy:
    I am going to write a simple test class to varify all the information.

    Excellent. So you probably have already determined the answer to your question...
    Originally posted by Hanna Habashy:
    Is that mean the flag byte part of the record length or not?

    I believe you will find it is not part of the record length.
    My copy of the instructions state:

    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

    So according to this, the record is the size as specified in the record length, and the deleted flag is outside of the record and not counted in the size.
    Symantically this is correct: the deleted flag logically cannot be part of the record since you have to read the record to find out whether it exists or not. Getting all metaphysical there
    Regards, Andrew
     
    Hanna Habashy
    Ranch Hand
    Posts: 532
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    confirmed. The delete falg byte is not part of the record length.
    This is according to the .db file, which belongs to my project. I think other projects may vary.
     
    Richard Everhart
    Ranch Hand
    Posts: 54
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    My instructions are the same as yours, Andrew. However, while the deleted flag is not logically part of a record, as you say, you still have to read the byte containing the deleted flag value when you read a record. So, therefore, the deleted flag, while not part of a database schema, at least to me, is still part of a record's length for purposes of reading the record.
    Rich
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic