This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer Study Guide: Exam 1Z0-830 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Bodgitt and scraper, flag question

 
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
     
    Ranch Hand
    Posts: 54
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
    Posts: 12200
    280
    Mac IntelliJ IDE Firefox Browser Oracle C++ Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
      Number of slices to send:
      Optional 'thank-you' note:
    • 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
     
    You don't like waffles? Well, do you like this tiny ad?
    Gift giving made easy with the permaculture playing cards
    https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
    reply
      Bookmark Topic Watch Topic
    • New Topic