|
The QMRecordlock() function locks a record. It is analogous to the QMBasic RECORDLOCKL and RECORDLOCKU statements.
The function arguments are:
| FileNo | is the file number returned by a previous QMOpen() call. |
| Id | is the id of the record to be locked. |
| Update | is a Boolean value specifying the type of lock to be obtained: |
| Wait | is a Boolean value indicating the action to be taken if the record is currently locked by another user: |
| True | wait for the record to become available |
| False | return an error code of SV_LOCKED |
The QMRecordlock function can be used to obtain a lock on a record without reading the record.
The example program fragments below write a new record into the file opened as fClients. To comply with recommended locking rules, a record should never be written unless the program holds an update lock on it. Use of QMRecordlock() gets this lock before the write.
void QMRecordlock(int FileNo, char * Id, int Update, int Wait)
QMRecordlock(fClients, ClientNo, TRUE, TRUE);
QMWrite(fClients, ClientNo, Rec2);
|
QMRecordlock ByVal FileNo as Integer, ByVal Id as String, ByVal Update as Integer, ByVal Wait as Integer
QMRecordlock(fClients, ClientNo, True, True)
QMWrite fClients, ClientNo, Rec
|
Recordlock(FileNo, Id, Update, Wait)
session->Recordlock(fClients, ClientNo, @true, @true)
session->Write(fClients, Id, Rec)
|
Recordlock(int FileNo, String Id, boolean Update, boolean Wait)
qm.Recordlock(fClients, ClientNo, true, true);
qmWrite(fClients, ClientNo, Rec);
|
Recordlock(FileNo, Id, Update, Wait)
qm.Recordlock(fClients, ClientNo, True, True)
qm.Write(fClients, Id, Rec)
|
See also:
QMRecordlocked()
|