• 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

update() what? delete() from disk or memery?

 
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
In urlyBird, I am not sure about tow methods of Data.One is update(), i want to know in what cases should call update()?The other is delete(), when called, should data is db file be removed or just the collection class in memery which store records be removed?
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm, I don't think we can comment on that, since the methods vary. IF your update and delete methods are same as mine:

update(int recNo, String[] data)
Changes the record (replaces the record with the given record number with the one you are passing as parameter)

delete(int recNo)
Makes the record ready for reuse (mark the record with the deleted flag so create(String[]) invocations will reuse it's space).
Notice that you don't need to phisycally remove the record from the file. You just mark the space it takes as free.
 
Eiji Seki
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course, if you are using memory cache of the data, you need to make sure your cache reflects the changes made to the file.
OR, if that is your case, just change the memory cache and then make sure all operations are persisted when shutting down.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is a design decision that can only be answered by you.

However, you really need to start searching the board for your questions before you ask them. I know its tempting to just come here and post whenever something comes to mind, but all of your questions have been answered on this board, most of them within the past few days and weeks.

You have to make some design decisions yourself.

For my commentary on your question, see this thread

Kevin
reply
    Bookmark Topic Watch Topic
  • New Topic