cursor/storeDNA.c
static RDM_RETCODE storeDNA (
RDM_CURSOR adult,
const char *dna,
uint64_t pos,
size_t len)
{
uint64_t size;
/* We do not need to check and set the size before we set the
* blob. Here we do this just to show how to call
* dc_getBlobSize and dc_setBlobSize */
rc = rdm_cursorGetBlobSize (adult, COL_ADULT_DNA, &size);
if (pos > size)
{
printf (
"We have a hole in the DNA, lets hope it will be filled in later");
}
if (rc == sOKAY)
{
rc = rdm_cursorSetBlobSize (adult, COL_ADULT_DNA, pos + len);
}
if (rc == sOKAY)
{
rc = rdm_cursorUpdateBlob (adult, COL_ADULT_DNA, pos, dna, len);
}
return rc;
}
RDM_RETCODE rdm_cursorSetBlobSize(RDM_CURSOR cursor, RDM_COLUMN_ID columnId, uint64_t size)
Set the size of a blob column.
struct RDM_CURSOR_S * RDM_CURSOR
Definition: rdmtypes.h:306
RDM_RETCODE rdm_cursorUpdateBlob(RDM_CURSOR cursor, RDM_COLUMN_ID columnId, uint64_t offset, const void *value, size_t bytesIn)
Update a blob column.
@ sOKAY
Definition: rdmretcodetypes.h:97
RDM_RETCODE
RDM status and error return codes.
Definition: rdmretcodetypes.h:43
RDM_RETCODE rdm_cursorGetBlobSize(RDM_CURSOR cursor, RDM_COLUMN_ID columnId, uint64_t *size)
Get the current size of a blob column.