Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

ctdbSetRecordBuffer

Set the record buffer with user supplied data.

Declaration

CTDBRET ctdbSetRecordBuffer(CTHANDLE Handle, pVOID pBuffer,

VRLEN reclen, CTRECBUF_MODE mode)

Description

ctdbSetRecordBuffer() sets the record buffer with user supplied data. The record buffer NEW and MODIFIED flags are set to YES. After a call to ctdbSetRecordBuffer(), a call to ctdbWriteRecord() will add a new record to the record's table.

  • Handle [in] the record handle.
  • pBuffer [in] the pointer to a user buffer containing the record data. If the record buffer is NULL, the record is set to automatic.
  • reclen [in] the length in bytes of the user record buffer
  • mode [in] the mode of operation. Valid values are given in the table below.

    Mode

    Explanation

    CTRECBUF_AUTO

    This is the default mode for the record buffer operation. The record manager will allocate or reallocate the record buffer as needed to hold the record data.

    CTRECBUF_STATIC

    The user is responsible for supplying a record buffer large enough to handle any record data. If a record operation is attempted and the record buffer is not long enough to hold the data, an CTDBRET_INVRECBUF is returned to indicate that the record buffer is not large enough.

    CTRECBUF_RAW

    OR this mode in to indicate that the record manager is not supposed to update the internal control structures of the record buffer.

Returns

ctdbSetRecordBuffer() returns CTDBRET_OK on success, or a FairCom DB API C API error code on failure. The error CTDBRET_INVRECBUF (4063) means that the buffer is not large enough to hold the data. Increase the buffer or use the mode CTRECBUF_AUTO.

See also

ctdbWriteRecord(), ctdbSetRecordPos(), ctdbSetRecordOffset()

TOCIndex