Product Documentation

c-treeDB API API for C

Previous Topic

Next Topic

ctdbDeleteResource

Delete an existing resource from a table.

DECLARATION

CTDBRET ctdbDECL ctdbDeleteResource(CTHANDLE resource);

DESCRIPTION

ctdbDeleteResource() delete a resource from a table. Before a resource can be deleted, the table must be opened exclusive. The resource type and resource number that identify this resource must be passed to ctdbAllocResource(). Resource is a handle allocated by ctdbAllocResource().

RETURN

ctdbDeleteResource() returns CTDBRET_OK on success

EXAMPLE


/* delete a resource */

CTDBRET DelMyResource(CTHANDLE Handle, ULONG type, ULONG number, pTEXT name)

{

CTDBRET Retval;

CTHANDLE hRes = ctdbAllocResource(Handle, type, number, name);

if (hRes)

{

if ((Retval = ctdbDeleteResource(hRes)) != CTDBRET_OK)

printf("ctdbDeleteResource failed with error %d\n", Retval);

ctdbFreeResource(hRes);

}

else

{

printf("Failed to allocate resource handle\n");

Retval = CTDBRET_NOMEMORY;

}

return Retval;

}

SEE ALSO

ctdbAllocResource(), ctdbFreeResource(), ctdbAddResource(), ctdbFirstResource(), ctdbNextResource(), ctdbFindResource(), ctdbFindResourceByName(), ctdbGetResourceType(), ctdbSetResourceType(), ctdbGetResourceNumber(), ctdbSetResourceNumber(), ctdbGetResourceName(), ctdbSetResourceName(), ctdbGetResourceDataLength(), ctdbGetResourceData(), ctdbSetResourceData(), ctdbIsResourceLocked(), ctdbUpdateResource(), ctdbUnlockResource()

TOCIndex