• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

delete method

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the database interface
// Deletes a record, making the record number and associated disk
// storage available for reuse.
public void delete(int recNo) throws RecordNotFoundException;

but later its 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'

I have just been marking the records as deleted when I delete them as that is how they have been givenm to me in the data file
'2 byte flag. 00 implies valid record, 0x8000 implies deleted record'

Just thought I would ask what people thought?

Thanks
Lee
(ps whats the String value of 0x8000?)
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before deleting a record, check if a record exists at the given number. You can do this by analyzing the two-byte pattern.

If a record exists, the byte pattern will be 0000000000000000. Delete the record and mark the two-byte pattern as ox8000. Else, throw a RecordNotFoundException.
 
Lee Sunter
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, once again sorry if I am being slow but how would one mark the record as deleted is it a case of puting an Integer with a value of 1 at the front as the data file i have has no examples and the active files are all 00 at the front?
Thank
Lee
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Lee Sunter:
Thanks, once again sorry if I am being slow but how would one mark the record as deleted is it a case of puting an Integer with a value of 1 at the front as the data file i have has no examples and the active files are all 00 at the front?
Thank
Lee




shouldn't it be just like this:


 
Ranch Hand
Posts: 284
Netbeans IDE Firefox Browser Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,
maybe this link could be interesting...

Code Conventions

and necessary for passing the SCJD exam, dont you think?

Regards
[ September 27, 2005: Message edited by: Oricio Ocle ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic