|
The QMRelease() function releases a record lock. It is analogous to the QMBasic RELEASE statement.
the function arguments are:
| FileNo | is the file number returned by a previous QMOpen() call. If zero, all locks are released. |
| Id | is the id of the record to be unlocked. If given as a null string, all locks in the file identified by FileNo are released. |
The QMRelease function can be used to release a lock without writing or deleting the record. One common use of this function is to release the lock obtained by a call to QMReadl() or QMReadu() where the record was not found and the function returned the SV_ELSE status.
The example program fragments below attempt to read a record with an update lock. If the record is not found, the lock is released
void QMRelease(int FileNo, char * Id)
Rec = QMReadu(fClients, ClientNo, TRUE, Err);
if (Err == SV_ELSE)
{
QMRelease(fClients, ClientNo);
QMFree(Rec);
}
Note use of QMFree() to release the memory dynamically allocated by QMReadu() to return the record.
|
QMRelease ByVal FileNo as Integer, ByVal Id as String
Rec = QMReadu(fClients, ClientNo, True, Err)
If Err = SV_ELSE Then
QMRelease(fClients, ClientNo)
End If
|
Release(FileNo, Id)
Rec = session->Readu(fClients, ClientNo, @true, Err)
if Err = SV_ELSE then
session->Release(fClients, Id)
end
|
void Release(int FileNo, String Id)
Rec = qm.Readu(fClients, ClientNo, true);
if (qm.ServerError == SV_ELSE)
{
qm.Release(fClients, ClientNo);
}
|
Release(FileNo, Id)
Rec, Err = qm.Readu(fClients, ClientNo, true)
if Err = SV_ELSE:
qm.Release(fClients, Id)
|
|