• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX:Question about dealing with a record

 
HaoZhe Xu
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question 1 : in the instruction, above the method delete of DBMain interface, it says:" Deletes a record, making the record number and associated disk storage available for reuse." Does it mean I should do:
change the flag at the beginning of that record from 0x00 to 0xFF
(What about it's already 0xFF?)
Question 2 : there's a find(String [] criteria) method, does it make sense to a deleted record? What about others (e.g. read, update etc), should they just throw a RecordNotFoundException if the specific record is marked deleted?
Question 3 : Assume there're three record: A B and C, the number is 0, 1 and 2, if B was deleted, then should I skip B and directly use C as the number 1 record, so there 're A (B) C number: 0 (1) 1 ???
Sorry for trouble you.
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Question 1 : in the instruction, above the method delete of DBMain interface, it says:" Deletes a record, making the record number and associated disk storage available for reuse." Does it mean I should do:
change the flag at the beginning of that record from 0x00 to 0xFF

yes.

(What about it's already 0xFF?)

The system should throw RecordNotFoundException

Question 2 : there's a find(String [] criteria) method, does it make sense to a deleted record? What about others (e.g. read, update etc), should they just throw a RecordNotFoundException if the specific record is marked deleted?

They just throw RecordNotFoundException

Question 3 : Assume there're three record: A B and C, the number is 0, 1 and 2, if B was deleted, then should I skip B and directly use C as the number 1 record, so there 're A (B) C number: 0 (1) 1 ???

I keep the original sequence. i.e.
0 A
[1 B] // Do not display
2 C
And in order to reduce the appearence of the layout, I decide NOT to display the record number.
Hope this help.
Nick.
 
HaoZhe Xu
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand, thanks a lot.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic