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:347
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:100
enum RDM_RETCODE_E RDM_RETCODE
RaimaDB status and error return codes.
RDM_RETCODE rdm_cursorGetBlobSize(RDM_CURSOR cursor, RDM_COLUMN_ID columnId, uint64_t *size)
Get the current size of a blob column.