| Author |
question about unique identity of record and lock
|
LianGuang Wang
Greenhorn
Joined: Mar 26, 2006
Posts: 11
|
|
// 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!
|
 |
Andrew Monkhouse
author and jackaroo
Marshal Commander
Joined: Mar 28, 2003
Posts: 10816
|
|
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
|
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
|
 |
LianGuang Wang
Greenhorn
Joined: Mar 26, 2006
Posts: 11
|
|
i'm sorry for my inattention!
|
 |
Animesh Saxena
Ranch Hand
Joined: Jan 15, 2006
Posts: 62
|
|
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());
|
Animesh Saxena<br /> <br />Open Source Developer
|
 |
 |
|
|
subject: question about unique identity of record and lock
|
|
|