Hi, the instruction doesn't tell us to lock the database file when creating a record, but it is a kind of operation to modify the databse, it should be locked, am I right, need your help. Regards, Damu
But what should be locked? The update() and delete() methods modify a record, and require that you lock that record before calling those methods. But for create(), the record doesn't even exist yet, so what do you lock? You may well need to do something to prevent problems in case another thread tries to read/update/delete the record while it's still being created, or tries to create another new record. (Make sure both records don't get the same record number, for example.) Probably you will find that some sort of synchonization is helpful. But beware that it won't (can't) work the same as locking of records, because the record you;d need to lock doesn't exist yet. So you'll have to think about how to handle this problem in your code...
"I'm not back." - Bill Harding, Twister
Joined: Feb 26, 2003
Hi, thank you Jim
subject: NX: Should I lock the database when createRecord?