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

Data class questions

 
Hugh Johns
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two short questions on implementing some of the DBAccess methods in a Data class.
1. For the lock cookie, is a long number based on the record number Ok to use, i.e. 1002 for a lock cookie on record 2. I am assuming here that only one Data class instance will hold a record number / lock cookie combination at any one time. Or alternatively is a random generated number a safer bet.

2. In the description of deleteRecord, it states to make the record number available for reuse (set flag at start of record to 0xFF), and also make the associated disk storage available. With second point I am thinking of calling updateRecord and setting all fields following the flag to spaces, but would this release the associated disk storage space for reuse, or just update the record to all spaces.
More a question on define "release the associated disk storage space"
Hugh
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hugh,
1. Random.nextLong() is better.
2. "making the record number and associate disk storage available for reuse" means that the space (and record number) of the "deleted" record if eligible for reuse by a next call to createRecord(). You don't need to fill in the record with blanks, IMO.
Best,
Phil.
[ July 31, 2003: Message edited by: Philippe Maquet ]
 
Hugh Johns
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Philippe
Thank you for you help
Hugh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic