• 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

question about unique identity of record and lock

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
// Reads a record from the file. Returns an array where each
// element is a record value.
public String[] read(int recNo) throws RecordNotFoundException;
what's the meaning of recNo?i think that is the position in the physical file.so it's not unique because this recNo can be reused.
so in the update synchronized block,we need to compare each field in the record to confirm the record state.and the client must send back all the field of the record which be booked?
It's truth? i want a Positive response! thanks!
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello "Hot Strong"

Welcome to JavaRanch and this forum.

We don't have many rules here, but one we do have is the JavaRanch Official policy on registered names which requires the display name to be a real name. Please read this policy document and change your display name to meet the requirements. You can change your display name here.

Thanks, Andrew
 
LianGuang Wang
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i'm sorry for my inattention!
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can't understand ur question clearly.
recNo is just a number which indicates position of record. to get the actual record you use something like this

dbFile.seek((recNo-1) * recordLength);
keep the recordLength calculated in the beginning only.
assuming recNo starts from 1...
in update method when you pass the recNo seek the location of file using the above code and write the content in form of bytes.
if its a string then use.
dbFile.write(contentString.getBytes());
 
It looks like it's time for me to write you a reality check! Or maybe a tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic