Dbgather()

From Recital Documentation Wiki
Jump to: navigation, search

PURPOSE

place individual field buffers back to the record buffer that was "scattered" using dbscatter()


SYNOPSIS

#include "dbl.h"
 
	int	dbgather(dbf, record, fldbuf)
 
	<input parameters>
 
	int	dbf;				/* Database file descriptor */
	char	record[1000];		/* Record buffer to refill */
	char	fldbuf[128][256];	/* Existing field buffers */
 
	<output parameters>
 
	none


RETURN VALUE

The dbgather() function returns 0 for success. Refer to the section on return codes for a detailed list of return code definitions.


DESCRIPTION

The dbgather() function "gathers" individual field values stored in a two dimensional character array (fldbuf[128][256]) back into the record buffer (record[1000]). The field buffers are filled with [[dbscatter() function. The dbgather() function is similar to The dbrecin() function with the exception that it requires fewer input parameters.


EXAMPLE

The following example retrieves (gathers) the data stored in the individual field buffers (fldbuf[128][255]) placed there with The dbscatter() function, and returns this information back to the record buffer (buffer[1000]).

#include "dbl.h"
	int	dbf;				/* Database file descriptor */
	char	record[1000];		/* Record buffer to fill */
	char	fldbuf[128][255];	/* Field buffers */
 
	rc = dbgather(dbf, record, fldbuf);
	if (rc != 0) {
 
		printf("Error gathering record: %d\n", rc);
		exit(1);
	}else{
		printf("Record gathered!\n");
	}


SEE ALSO

dbfield(), dbgcache(), dbgetr(), dbgetrk(), dbrecin(), dbrecout(), dbscatter()