CTRecord::BatchLocked
Retrieves the number of locked batch records.
Declaration
LONG CTRecord::BatchLocked();
Description
CTRecord::BatchLocked() retrieves the number of records locked during a CTBATCH_GET, CTBATH_RANGE or CTBATCH_PHYS operation. If CTBATCH_LOCK_READ or CTBATCH_LOCK_WRITE are specified in the batch mode, the CTRecord::BatchLocked() method returns the total number of records locked. If CTBATCH_LOCK_ONE is specified, or if either the CTBATCH_LOCK_READ or CTBATCH_LOCK_WRITE modes are not specified, CTRecord::BatchLocked() returns zero.
Return
CTRecord::BatchLocked() returns the number of locked records. In case of an error, CTRecord::BatchLocked() throws a CTException exception.
Example
try
{
// set the partial target key
hRecord.Clear();
hRecord.SetFieldAsSigned("Invoice", Invoice);
// set the batch operation
hRecord.SetBatch(CTBATCH_GET, sizeof(Invoice), 0);
// show how many records are ready
printf("%d records are locked\n", hRecord.BatchLocked());
}
catch (CTException& err)
{
printf("Batch failed with error %d\n", hRecord.GetError());
}
See Also
TRecord::BatchLoaded(), CTRecord::BatchMode(), CTRecord::BatchTotal(), CTRecord::EndBatch(), CTRecord::InsertBatch(), CTRecord::IsBatchActive(), CTRecord::NextBatch(), CTRecord::SetBatch()