• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S 2.3.2 record number

 
Patrick Jansen
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to be sure if I understood correctly what means "recNo" in the "read" method signature.

In my DBMain interface "read" method has the following signature:

My assignment says Any methods that throw RecordNotFoundException should do so if a specified record does not exist or is marked as deleted in the database file.

If a have in my file:

not deleted first record
not deleted second record
not deleted third record
not deleted fourth record

then
read(0) return "first record"
read(1) return "second record"

If the record 1 is deleted then the file has the following structure:

not deleted first record
DELETED second record
not deleted third record
not deleted fourth record

Now, if I call read(1) again, the method returns "third record" (because this record is logically after "first record" as not beeing deleted) or returns "RecordNotFoundException" because "second record" has its flag marked as "DELETED"?

I think that "recNo" refers to the physical position of a record in the database file and each record has its own recNo forever as long as the records are not physically deleted.
So, I think read(1) throws "RecordNotFoundException".
What do you think?

Thanks.
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Patrick Jansen wrote:So, I think read(1) throws "RecordNotFoundException".

Exactly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic