Product Documentation

FairCom DB API for C

Previous Topic

Next Topic

ctdbGetFieldDefaultValue

Retrieves the current field default value.

DECLARATION

pTEXT ctdbGetFieldDefaultValue(CTHANDLE Handle, pVRLEN pLength);

DESCRIPTION

If no default value is set ctdbGetFieldDefaultValue() returns NULL and no value is set to pLength. You can use ctdbIsFieldDefaultValueSet() function to check if a field default value is set or not. Handle must be a field handle. If pLength is not NULL, returns the length of the default value string.

RETURN

Returns the current field default value or NULL if no default value was set for the field.

EXAMPLE

/* check if default field value is 'USA' */

hField = ctdbGetField(hTable, 5);

if (hField)

{

VRLEN len;

pTEXT value = ctdbGetFieldDefaultValue(hField, &len);

if (value)

{

if (strcmp(value, "USA") == 0)

printf("Default value is 'USA'\n");

else

printf("Default value is not 'USA'\n");

}

else

printf("No default value set\n");

}

SEE ALSO

ctdbSetFieldDefaultValue(), ctdbGetFieldDefaultValue(), ctdbClearFieldDefaultValue(), ctdbIsFieldDefaultValueSet(), ctdbClearAllFieldDefaultValue(), ctdbSetFieldDefaultDateTimeType(), ctdbGetFieldDefaultTimeType()

TOCIndex