Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbBatchLocked

Retrieves the number of locked batch records.

DECLARATION

LONG ctdbDECL ctdbBatchLocked(CTHANDLE Handle);

DESCRIPTION

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, ctdbBatchLocked() return the total number of records locked. If CTBATCH_LOCK_ONE is specified, or if no CTBATCH_LOCK_READ or CTBATCH_LOCK_WRITE modes are not specified, ctdbBatchLocked() return zero.

Handle must be a record handle associated with an opened table.

RETURNS

ctdbBatchLocked() returns the number of locked records. In case of an error, ctdbBatchLocked() returns a negative value and you may use ctdbGetError() function to retrieve the error code

EXAMPLE

/* set the partial target key */

ctdbClearRecord(hRecord);

ctdbSetFieldAsSigned(hRecord, 0, Invoice);


/* set the batch operation */

if (ctdbSetBatch(hRecord, (CTBATCH_GET | CTBATCH_LOK_READ), sizeof(Invoice), 0) != CTDBRET_OK)

printf("ctdbSetBatch failed with error %d\n", ctdbGetError(hRecord));


/* show how many records are locked */

printf("%d records are locked\n", ctdbBatchLoaded(hRecord));

SEE ALSO

ctdbBatchLoaded(), ctdbBatchMode(), ctdbBatchTotal(), ctdbEndBatch(), ctdbInsertBatch(),
ctdbIsBatchActive(), ctdbNextBatch(), ctdbSetBatch()

TOCIndex