aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: about delete record... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: about delete record..." Watch "NX: about delete record..." New topic
Author

NX: about delete record...

Barry Tsai
Greenhorn

Joined: Jul 16, 2003
Posts: 12
hi, all
I got a problem about deleting record. When I delete a record from file,
Should I actually delete it or just mark it as deleted one???
Best Regards,

Thx a lot.....
Tony Collins
Ranch Hand

Joined: Jul 03, 2003
Posts: 435
I marked it as deleted, so it can be used again, plus deleting a record doesn't change the structure of the file.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11476
    
  94

Hi Barry
I agree with Tony's implementation.
I think just marking it as deleted (using the flag provided in the data file) is all you need do.
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Barry Tsai
Greenhorn

Joined: Jul 16, 2003
Posts: 12
Originally posted by Tony Collins:
I marked it as deleted, so it can be used again, plus deleting a record doesn't change the structure of the file.

Ok,I mark it as deleted. That's means when I want to add a new record, I
should search file to judge whether have deleted record in the file.If yes,
I should insert into there , right??
Tony Collins
Ranch Hand

Joined: Jul 03, 2003
Posts: 435
Yeah that's right and if you haven't deleted a record you put the record at the end of the file. Therefore under this scheme a record always starts at the same position in a file.
Tony
Richard Jackson
Ranch Hand

Joined: Jun 25, 2003
Posts: 128
Hi,all
Tony's idea looks correct.
And in my assignment,there are states as below:
1 byte flag. 00 implies valid record, 0xFF implies deleted record

Please teach me the way to implement marking the deleted flag.
Thanks in advance.
Regards,
Richard.


Regards, Richard
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11476
    
  94

Hi Richard,
Please look at this topic where this is being discussed.
Regards, Andrew
 
wood burning stoves
 
subject: NX: about delete record...