An existing resource can be updated by calling the following function:
CTDBRET ctdbDECL ctdbUpdateResource(CTHANDLE resource, pVOID data, VRLEN size);
You must call ctdbAllocResource() with specific resource type and number that will uniquely identify the resource being updated.
c-treeDB API C API Update Resource Example
CTDBRET UpdateMyResource(CTHANDLE Handle, ULONG type, ULONG number, pTEXT name, pVOID data, VRLEN size)
{
CTDBRET Retval;
CTHANDLE hRes = ctdbAllocResource(Handle, type, number, name);
if (hRes)
{
if ((Retval = ctdbUpdateResource(hRes, data, size)) != CTDBRET_OK)
printf("ctdbUpdateResource failed with error %d\n", Retval);
ctdbFreeResource(hRes);
}
else
{
printf("Failed to allocate resource handle\n");
Retval = CTDBRET_NOMEMORY;
}
return Retval;
}