QMRecordlock()

QMRecordlock()

Top  Previous  Next

 

The QMRecordlock() function locks a record. It is analogous to the QMBasic RECORDLOCKL and RECORDLOCKU statements.

 

The function arguments are:

 

FileNois the file number returned by a previous QMOpen() call.

 

Idis the id of the record to be locked.

 

Updateis a Boolean value specifying the type of lock to be obtained:
TrueUpdate lock
FalseShareable read lock

 

Waitis a Boolean value indicating the action to be taken if the record is currently locked by another user:
Truewait for the record to become available
Falsereturn 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.

 

 

hmtoggle_plus1C

 

hmtoggle_plus1VB.Net

 

hmtoggle_plus1QMBasic Class Module

 

hmtoggle_plus1Java

 

hmtoggle_plus1Python

 

 

See also:

QMRecordlocked()