rtree/deleteZipcode.c
{
RDM_CURSOR cursor = NULL;
POINTSOFINTEREST_CITY_KEY keyVal = {{0}};
RDM_RANGE_KEY range = {0};
/* Set the key value for the lookup */
strcpy (keyVal.city, "Nampa");
/* Set key lookup information */
range.value = &keyVal;
range.numKeyCols = 1;
/* Start an update transaction */
if (rc == sOKAY)
{
/* Get a range cursor based on the city key */
db, KEY_POINTSOFINTEREST_CITY, &range, &range, &cursor);
if (rc == sOKAY)
{
/* Move to the first (should be only) row in the cursor */
rc = rdm_cursorMoveToFirst (cursor);
while (rc == sOKAY)
{
/* Delete the row */
rc = rdm_cursorDeleteRow (cursor);
if (rc == sOKAY)
{
rc = rdm_cursorMoveToNext (cursor);
}
}
/* We expect sENDOFCURSOR when we break out of the loop */
{
rc = sOKAY;
}
/* Free the cursor */
(void) rdm_cursorFree (cursor);
}
if (rc == sOKAY)
{
/* Commit the successful transaction */
rc = rdm_dbEnd (db);
}
else
{
/* Rollback the failed transaction */
(void) rdm_dbEndRollback (db);
}
}
return rc;
}
RDM_RETCODE rdm_dbEndRollback(RDM_DB db)
End and rollback a transactional operation.
RDM_RETCODE rdm_dbGetRowsByKeyInRangeKeyRange(RDM_DB db, RDM_KEY_ID keyId, const RDM_RANGE_KEY *startValue, const RDM_RANGE_KEY *endValue, RDM_CURSOR *pCursor)
Associate an RDM_CURSOR with rows in a specified key range.
RDM_RETCODE rdm_dbStartUpdate(RDM_DB db, const RDM_TABLE_ID *writeTableIds, uint32_t numWriteTableIds, const RDM_TABLE_ID *readTableIds, uint32_t numReadTableIds, RDM_TRANS *pTrans)
Get write locks.