C API Functions P

ctdbPartAdminByKey

Performs an administrative partition operation on the partition specified by key value.

Declaration

CTDBRET ctdbPartAdminByKey(CTHANDLE handle,pVOID keyval,CTPART_MODE_E partmode,pCOUNT partstatus)

Description

ctdbPartAdminByKey() manages the partitions for a table.

  • Handle [in] - a table handle.
  • keyval [in] - pointer to a partition key value that has been transformed
  • partmode [in] - partition operation mode. partmode is one of:
CTPART_PURGE delete a partition
CTPART_ADD add a partition
CTPART_ARCHIVE archive a partition
CTPART_BASE modify the lower limit partition number value
CTPART_ACTIVATE activate an archived partition
CTPART_STATUS return the partition status in partstatus
  • partstatus [out] - status code of partition when partmode specifies CTPART_STATUS. partstatus returns one of the following values:
pmSTATUSnone 0 partition member does not exist
pmSTATUSexst 1 partition member is active
pmSTATUSopnd 2 partition member is active and currently open
pmSTATUSarhv 3 partition member is archived
pmSTATUSpurg 4 partition member was purged
pmSTATUSparc 19 partition member is pending archive
pmSTATUSppnd 20 partition member is pending purge

Returns

ctdbPartAdminByKey() returns CTDBRET_OK on success. BMOD_ERR (446) is returned with a bad partmode value. A FairCom DB API C API error on failure.

See also

ctdbPartAdminByName(), ctdbPartAdminByNumber()

 

ctdbPartAdminByName

Performs an administrative partition operation on the partition specified by partition name.

Declaration

CTDBRET ctdbPartAdminByName(CTHANDLE handle, pTEXT partname, CTPART_MODE_E partmode, pCOUNT partstatus)

Description

ctdbPartAdminByName() manages the partitions for a table.

  • Handle [in] - a table handle.
  • partname [in] - partition name.
  • partmode [in] - partition operation mode. partmode is one of:
ptADMINpurge delete a partition
ptADMINadd add a partition
ptADMINarchive archive a partition
ptADMINbase modify the lower limit partition number value
ptADMINactivate activate an archived partition
ptADMINstatus return the partition status in partstatus
  • partstatus [out] - status code of partition when partmode specifies ptADMINstatus. partstatus returns one of the following values:
pmSTATUSnone 0 partition member does not exist
pmSTATUSexst 1 partition member is active
pmSTATUSopnd 2 partition member is active and currently open
pmSTATUSarhv 3 partition member is archived
pmSTATUSpurg 4 partition member was purged
pmSTATUSparc 19 partition member is pending archive
pmSTATUSppnd 20 partition member is pending purge

Returns

ctdbPartAdminByName() returns CTDBRET_OK on success. BMOD_ERR (446) is returned with a bad partmode value. A FairCom DB API C API error on failure.

See also

ctdbPartAdminByKey(), ctdbPartAdminByNumber()

 

ctdbPartAdminByNumber

Performs an administrative partition operation on the partition specified by partition number.

Declaration

CTDBRET ctdbPartAdminByNumber(CTHANDLE handle,LONG partno,CTPART_MODE_E partmode,pCOUNT partstatus)

Description

ctdbPartAdminByNumber() manages the partitions for a table.

  • Handle [in] - a table handle.
  • partno [in] - partition number
  • partmode [in] - partition operation mode. partmode is one of:
ptADMINpurge delete a partition
ptADMINadd add a partition
ptADMINarchive archive a partition
ptADMINbase modify the lower limit partition number value
ptADMINactivate activate an archived partition
ptADMINstatus return the partition status in partstatus
  • partstatus [out] - status code of partition when partmode specifies ptADMINstatus. partstatus returns one of the following values:
pmSTATUSnone 0 partition member does not exist
pmSTATUSexst 1 partition member is active
pmSTATUSopnd 2 partition member is active and currently open
pmSTATUSarhv 3 partition member is archived
pmSTATUSpurg 4 partition member was purged
pmSTATUSparc 19 partition member is pending archive
pmSTATUSppnd 20 partition member is pending purge

Returns

ctdbPartAdminByNumber() returns CTDBRET_OK on success. BMOD_ERR (446) is returned with a bad partmode value. A FairCom DB API C API error on failure.

See also

ctdbPartAdminByName(), ctdbPartAdminByKey()

 

ctdbPrevRecord

Get the previous record in a table.

Declaration

CTDBRET ctdbPrevRecord(CTHANDLE Handle)

Description

ctdbPrevRecord() retrieves the previous record in a table and copies the record data from disk into the specified record handle’s record buffer, and moves the current record to the previous record in that table. Note that if session-wide record locking is enabled, this function will also lock the record it retrieves.

  • Handle [in] the record handle.

If sets are enabled by ctdbRecordSetOn(), ctdbPrevRecord() will retrieve the previous record in the set. Use ctdbFirstRecord() to retrieve the first record on a table, ctdbNextRecord() to retrieve the next record on a table, and ctdbLastRecord() to retrieve the last record on a table. Use ctdbFindRecord() to find a specific record on a table. ctdbNextRecord() and ctdbPrevRecord() must be used after at least one call was done to ctdbFirstRecord(), ctdbLastRecord(), or ctdbFindRecord().

Returns

ctdbPrevRecord() returns CTDBRET_OK on success, or INOT_ERR (101) if the current record was the first record in the table, or ICUR_ERR (100) if there is no current record, or a FairCom DB API C API error on failure.

See also

ctdbAllocRecord(), ctdbFirstRecord(), ctdbNextRecord(), ctdbLastRecord(), ctdbFindRecord(), ctdbRecordSetOn()