PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ DBFWriteTuple()

int SHPAPI_CALL DBFWriteTuple ( DBFHandle  psDBF,
int  hEntity,
void *  pRawTuple 
)

Definition at line 1545 of file dbfopen.c.

References DBFFlushRecord(), DBFLoadRecord(), DBFReadTuple(), DBFWriteHeader(), FALSE, SHPAPI_CALL1, and TRUE.

1547 {
1548  int i;
1549  unsigned char *pabyRec;
1550 
1551 /* -------------------------------------------------------------------- */
1552 /* Is this a valid record? */
1553 /* -------------------------------------------------------------------- */
1554  if( hEntity < 0 || hEntity > psDBF->nRecords )
1555  return( FALSE );
1556 
1557  if( psDBF->bNoHeader )
1558  DBFWriteHeader(psDBF);
1559 
1560 /* -------------------------------------------------------------------- */
1561 /* Is this a brand new record? */
1562 /* -------------------------------------------------------------------- */
1563  if( hEntity == psDBF->nRecords )
1564  {
1565  if( !DBFFlushRecord( psDBF ) )
1566  return FALSE;
1567 
1568  psDBF->nRecords++;
1569  for( i = 0; i < psDBF->nRecordLength; i++ )
1570  psDBF->pszCurrentRecord[i] = ' ';
1571 
1572  psDBF->nCurrentRecord = hEntity;
1573  }
1574 
1575 /* -------------------------------------------------------------------- */
1576 /* Is this an existing record, but different than the last one */
1577 /* we accessed? */
1578 /* -------------------------------------------------------------------- */
1579  if( !DBFLoadRecord( psDBF, hEntity ) )
1580  return FALSE;
1581 
1582  pabyRec = (unsigned char *) psDBF->pszCurrentRecord;
1583 
1584  memcpy ( pabyRec, pRawTuple, psDBF->nRecordLength );
1585 
1586  psDBF->bCurrentRecordModified = TRUE;
1587  psDBF->bUpdated = TRUE;
1588 
1589  return( TRUE );
1590 }
static int DBFLoadRecord(DBFHandle psDBF, int iRecord)
Definition: dbfopen.c:291
static void DBFWriteHeader(DBFHandle psDBF)
Definition: dbfopen.c:197
static int DBFFlushRecord(DBFHandle psDBF)
Definition: dbfopen.c:258
#define FALSE
Definition: dbfopen.c:168
#define TRUE
Definition: dbfopen.c:169
Here is the call graph for this function: