LogLogicalRecord

Logs a logical record into the log table and optionally locks the record

Local Servers:blocking
Remote Servers:blocking
Classification:3.x, 4.x, 5.x, 6.x
Service:Server-Based Synchronization

Syntax

  #include <\nlm\nit\nwsync.h>  
   
  int LogLogicalRecord (  
     char   *logicalRecordName,  
     BYTE    lockDirective,  
     WORD    timeoutLimit); 
  

Parameters

logicalRecordName
(IN) NULL-terminated string containing the record name. (_MAX_LOGREC_NAME, defined in NWSYNC.H, is 128 characters, including the NULL terminator).
lockDirective
(IN) Indicates if and how the record should be locked:
  • 0x00 = Log record.
  • 0x01 = Log and lock record with an exclusive lock.
  • 0x03 = Log and lock record with a sharable read-only lock.
timeoutLimit
(IN) Timeout value (valid only if lockDirective is not 0).

Return Values

Decimal

Hex

Constant

0

(0x00)

ESUCCESS

150

(0x96)

ERR_SERVER_OUT_OF_MEMORY

254

(0xFE)

ERR_TIMEOUT_FAILURE

Timeout limit was reached before record was available for locking.

255

(0xFF)

ERR_FAILURE

Remarks

For cross-platform functionality, call NWLogLogicalRecord.

A log table contains data-locking information used by a server. The server tracks this information. Whenever a logical record is logged, information identifying the data being logged is placed in the log table. Normally, a set of files or records are logged and then locked as a set. However, a record can also be locked when it is placed in the log table.

When using log tables, an application first logs all records to complete a transaction. The application then attempts to lock the logged set of records. If some of the logged resources cannot be locked, the lock fails and none of the resources are locked. Therefore, either all of the resources needed to complete a transaction are locked or none of the resources are locked. This function cannot lock logical records that are exclusively locked by other applications.

Applications define logical record names. A logical record name represents a group of files, physical records, structures, and so on. When LogLogicalRecord or LockLogicalRecordSet locks one or more logical record names, it does not lock the actual files, physical records, structures, and so on, associated with each logical record name. It just locks the logical record name. Any uncooperative application can ignore a lock on the logical record name and directly lock or access physical files or records. Therefore, applications using logical record locks must not use other locking techniques simultaneously.

When the lockDirective parameter specifies that the record should be locked when it is logged, the timeoutLimit parameter indicates how long the server should wait if it cannot lock the record immediately. The timeoutLimit parameter is specified in units of 1/18 of a second (0 means no wait).

See Also

ClearLogicalRecord, ClearLogicalRecordSet, LockLogicalRecordSet, ReleaseLogicalRecord, ReleaseLogicalRecordSet