The new record flag indicates if a record has been cleared and not written to disk yet. The record manager uses this flag to decide if a record should be added or updated.
The new record flag is set when the record handle is allocated or when the record is cleared by ctdbClearRecord(). The new record flag is cleared when a record is read from disk by calling ctdbFirstRecord(), ctdbLastRecord(), ctdbNextRecord(), ctdbPrevRecord(), ctdbSeekRecord(), ctdbFindRecord(), or ctdbFindTarget() functions.
A record is only written to disk if the edited record flag is set. This flag is set when the record buffer is modified with a call to one of the ctdbSetFieldAs() functions or by calling ctdbSetEditedRecord().
This property holds the current record offset of a record. If a record is cleared, the record offset property is zero. All records in a table, even the first record, will have a record offset value greater than zero.
You can retrieve the record offset value by calling ctdbGetRecordPos(). You can set the record offset property, and load the record data at the offset, by calling ctdbSeekRecord().
Use ctdbGetRecordCount() to retrieve the total number of records in a table. This is a read only property.
/* check if table is empty */
CTUINT64 count;
ctdbGetRecordCount(hRecord, &count);
if (count > 0) then
printf("Table is not empty\n");
Use ctdbGetRowid() to retrieve the ROWID value for the current record. This is a read only property.
/* retrieve the first record rowid */
CTROWID rowid;
ctdbFirstRecord(hRecord);
if (ctdbGetRowid(hRecord, &rowid) != CTDBRET_OK)
printf("Table has no ROWID index\n");