rtree/insertZipcode.c
static RDM_RETCODE insertZipCode (RDM_DB db)
{
POINTSOFINTEREST poi = {0};
/* Set the zip, city, and state column values */
poi.zip = 83686;
strcpy (poi.city, "Nampa");
strcpy (poi.state, "ID");
/* Set the location values (xmin, ymin), (xmax, ymax) */
poi.location[0] = -116.577610; /* Longitude is the 'x' value */
poi.location[1] = 43.529812; /* Latitude is the 'y' value */
poi.location[2] = -116.577610; /* Longitude is the 'x' value */
poi.location[3] = 43.529812; /* Latitude is the 'y' value */
/* Start an update transaction */
rc = rdm_dbStartUpdate (db, RDM_LOCK_ALL, 0, NULL, 0, NULL);
if (rc == sOKAY)
{
/* Insert the row */
db, TABLE_POINTSOFINTEREST, &poi, sizeof (POINTSOFINTEREST), NULL);
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_dbEnd(RDM_DB db)
End a transactional operation.
@ sOKAY
Definition: rdmretcodetypes.h:96
RDM_RETCODE rdm_dbEndRollback(RDM_DB db)
End and rollback a transactional operation.
RDM_RETCODE rdm_dbInsertRow(RDM_DB db, RDM_TABLE_ID tableId, const void *colValues, size_t bytesIn, RDM_CURSOR *pCursor)
Insert a new row into a table at the specified rowId.
struct RDM_DB_S * RDM_DB
Definition: rdmtypes.h:303
#define RDM_LOCK_ALL
Definition: rdmtypes.h:170
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.
RDM_RETCODE
RDM status and error return codes.
Definition: rdmretcodetypes.h:44