Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbGetFieldDataLength

Retrieve the field data actual length

Declaration

VRLEN ctdbGetFieldDataLength(CTHANDLE Handle, NINT FieldNbr)

Description

ctdbGetFieldDataLength() retrieves the actual length of the field data. This is the actual number of bytes being consumed by the data in a single field, in a single record (row) from a table. Use ctdbGetFieldSize() or ctdbGetFieldLength() to retrieve the defined field size from the table definition. Use ctdbGetFieldData() to retrieve the field data.

  • Handle [in] the record handle.
  • FieldNbr [in] the field number.

In V11 and later, a new field callback has been added. An array of function callbacks are available in c-treeDB API for table and field level control. These are extensively used by the FairCom DB SQL types SDK callback implementations. This is required, for example, when working with existing data types that are not compatible with expected SQL types. Several modifications were done to make this more effective across all data types.

When field callbacks are in place to manipulate field type and size, the SQL interface calls the following for LONG VARCHAR fields:

  1. ctdbGetFieldSize() - Given a record handle and a field number, it returns its defined field size from the table definition.
  2. ctdbGetFieldDataLength() - Given a record handle and a field number, it returns the field content size (the number of bytes actually being consumed by the data in the field).

To make these two functions work properly with field callback in place, these changes were made:

  1. ctdbGetFieldSize() now takes advantage of the existing CTDB_FIELD_GET_LENGTH callback.
  2. A new callback, CTDB_FIELD_DATA_LEN, is called by ctdbGetFieldDataLength().

Returns

ctdbGetFieldDataLength() returns the number of bytes being consumed by the data in this field.

See also

ctdbGetFieldSize()

TOCIndex