Dbrecin()

From Recital Documentation Wiki
Jump to: navigation, search

PURPOSE

fill a single record buffer from field buffers


SYNOPSIS

#include "dbl.h"
 
	int	dbrecin(dbf, fields, fldpos, buffer, fldbuffer)
 
	<input parameters>
	char		*dbffd;			/* Database file descriptor */
	dBFIELD	fields;			/* Array of record fields */
	int		*fldpos;			/* Array of field offsets	 */
	char		*buffer;			/* Address of a buffer where record starts */
	char		fldbuffer[128][256];	/* Address of a buffer from which to update the record */
 
	<output parameters>
	none


RETURN VALUE

The dbrecin() function returns 0 for success, or < 0 if an error occurs. See the section on return code values for a detailed list of return codes.


DESCRIPTIOIN

The dbrecin() function fills component fields in a record from the individual field buffers specified. The "fields" and "fldpos" are provided by The dbgetfx() function. This provides a simple mechanism for transferring data to and from records with the use of dbputr(). If the individual field buffer is shorter than the expected length of the field, dbrecin() will pad with the appropriate blank spaces to the left.


EXAMPLE

This example fills the buffer record with field data stored in "char fieldbuf".

#include "dbl.h"
 
	int		nfields;			/* Number of fields */
	dBFIELD	fields[128];		/* Return code */
	int		fieldpos[128];		/* Field positions */
	char		record[1000];		/* Record buffer */
	char		fieldbuf[128][256];	/* Field buffers */
 
	rc = dbrecin(nfields, fields, fieldpos, record, fieldbuf);
	if (rc == SUCCESS) printf("record filled \n");
	else {
		printf("error number %d \n", rc);
		exit (1);
	}


SEE ALSO

dbgather(), dbgetfx(), dbputr(), dbrecout(), dbrecout()