rtree/retrieveAllZipcode.c
static RDM_RETCODE retrieveAllZipCode (RDM_DB db)
{
RDM_CURSOR cursor = NULL;
POINTSOFINTEREST poi = {0};
RDM_RTREE_KEY key = {0};
/* Set key lookup information */
key.type = RDM_RTREE_ALL; /* Lookup all values in the R-tree */
/* Start an update transaction */
rc = rdm_dbStartRead (db, RDM_LOCK_ALL, 0, NULL);
if (rc == sOKAY)
{
/* Get a cursor based on the r-tree key information */
db, KEY_POINTSOFINTEREST_LOCATION, &key, &cursor);
if (rc == sOKAY)
{
/* Move to the first (should be only) row in the cursor */
rc = rdm_cursorMoveToFirst (cursor);
while (rc == sOKAY)
{
/* Read the row */
cursor, &poi, sizeof (POINTSOFINTEREST), NULL);
if (rc == sOKAY)
{
rc = rdm_cursorMoveToNext (cursor);
}
}
/* We expect to break out of the while loop with sENDOFCURSOR */
if (rc == sENDOFCURSOR)
{
rc = sOKAY;
}
/* Free the cursor */
(void) rdm_cursorFree (cursor);
}
/* End the read transaction (free locks) */
(void) rdm_dbEnd (db);
}
return rc;
}