• 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

cookies/deleting

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
and how do i decide what value to use as a cookie?

- also when a record is deleted from the file i set ValidByte to 0XFF.

BUT what to do with record in the List I keep in memory - set first elem in data to 0XFF or set elem to null, or remove from list?

thanks
 
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Laura:
As I understand form the project specification, we should use the original magic cookie value, which is supplied in the original .db file, to validate any other .db files.
If you are keeing all the records in the memory, I recommend you remove the deleted files. Otherwise, your program will waste memory resources.
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Laura,

I'm not sure which 'cookie' you're referring to.

If you are referring to the lock cookie then there have been several threads on this topic that you should find helpful. I am just using an integer. As for the 'magic cookie' value, this value is siimply part of the .db file (the first value in the file actually) and identifies it as such.

As for deleting, my instructions say that I can reuse deleted records. So, when a record is to be deleted I set its flag to '1', or 0xFF as you say, but I don't remove it. Instead, the next time I need to create a record I reuse the first deleted record I find in the database. If there are not deleted records, then I actually add a new record when I need to create one.


Rich
 
Laura Williamson
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
apols - i'm talking about lockCookie. but the int used must be unique to each client no? so I' m wondering about that...will search on lock cookie.
 
Laura Williamson
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok i got it - read old threads, no probs, thanks
 
Laura Williamson
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RE " as for deleting, my instructions say that I can reuse deleted records. So, when a record is to be deleted I set its flag to '1', or 0xFF as you say, but I don't remove it. Instead, the next time I need to create a record I reuse the first deleted record I find in the database. If there are not deleted records, then I actually add a new record when I need to create one"

-- you are definitely talking the list in memory here rather than the DB File - right? I do that in the DB file but wondering if that is the best approach for the list of record I keep in memory
 
Richard Everhart
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

-- you are definitely talking the list in memory here rather than the DB File - right? I do that in the DB file but wondering if that is the best approach for the list of record I keep in memory



Yes, I am referring to the db file, but I don't actually remove the record from the memory cache after I've set it to be deleted in the db file. Instead, I just set the cached record to deleted.

Rich
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic