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

delete method

 
xi brian
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
// Deletes a record, making the record number and associated disk
// storage available for reuse.
// Throws SecurityException if the record is locked with a cookie
// other than lockCookie.
public void deleteRecord(long recNo, long lockCookie)

for the delete method, should i actually delete the record or just write the 2 bytes flag from 00 to 0x8000 which indicate the file is not avaiable?


thank you in advance
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do something like this:

So you overwrite the 00 with 0x8000 for a deleted record. I'm still working on how to deal with the RecordNotFoundException, but when you do your read, use something like this:

Hope this helps.
 
xi brian
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you
 
xi brian
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
en...
so delete method actually does not delete the record info, but it overwrite the 00 by using 0x800. the record file is retrievable!

am i right?
 
mohamed sulibi
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi;


en...
so delete method actually does not delete the record info, but it overwrite the 00 by using 0x800. the record file is retrievable!

am i right?


you are right. but through the read method it must throw the RNFE .

Best Regards.
Mohamed Darim.
 
Ronggen Liu
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi xi brian and all,

here:


does it mean it's better(or must) to delete the record in the file. make the disk is free.

Thank you!
Ronggen
 
Alex Belisle Turcot
Ranch Hand
Posts: 516
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Liu Ronggen:
Hi xi brian and all,

here:


does it mean it's better(or must) to delete the record in the file. make the disk is free.

Thank you!
Ronggen


It is rather a fact.. You must allow deleting records, by replacing the starting value of the record. By doing so, the record will be available for reuse.

I believe it is then not a must to actually reuse the space, you could always add new records at the end... I believe.. I personally reused the space.

Regards,
Alex
[ March 26, 2008: Message edited by: Alex Belisle Turcot ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic