ctdbGetFieldHandle
Retrieve a Field Handle.
Declaration
CTHANDLE ctdbGetFieldHandle(CTHANDLE Handle)
Description
ctdbGetFieldHandle() retrieves a Field Handle. This function can be used to test if a handle is really a field handle. For example, assume a function should take a field handle, but inside the function you cast the CTHANDLE type to the field CTDFIELD structure. For safety, it is a good idea to make sure that the handle is really a field handle as shown in the example below. Another minor reason for this call is to perform a ctdbSWTCREEI() call.
CTBOOL IsFieldNumeric(CTHANDLE hField)
{
CTBOOL Retval = FALSE;
pCTDBFIELD pField = (pCTDBFIELD)ctdbGetFieldHandle(hField);
if (!pField)
{
printf("Error: hField is not a field handle");
}
...
...
return Retval;
}
To allocate a field handle, use ctdbAllocField().
Returns
ctdbGetFieldHandle() returns a field handle on success or NULL on error.
See also
ctdbAllocField(), ctdbGetRecordHandle(), ctdbGetIndexHandle(), ctdbGetSegmentHandle()