PostGIS  2.1.10dev-r@@SVN_REVISION@@
int SHPAPI_CALL DBFWriteTuple ( DBFHandle  psDBF,
int  hEntity,
void *  pRawTuple 
)

Definition at line 1546 of file dbfopen.c.

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

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

Here is the call graph for this function: