示例#1
0
i4
IIgetfldio(i2 *ind, i4 variable, i4 type, i4 len, PTR data, char *name)
{
	char			*namestr;
	char			fbuf[MAXFRSNAME+1];
	DB_EMBEDDED_DATA	edv;
	DB_DATA_VALUE		*dbvptr;
	DB_DATA_VALUE		oper_dbv;
	DB_DATA_VALUE		dbvcop;
	i4			oper;
	ADF_CB			*cb;
	bool			errflag = FALSE;
	i4			getop = 0;
	i4			(*oldproc)();
	bool			disp_msgs = TRUE;

	/*	Check field name for validity  */

	namestr = IIstrconv(II_CONV, name, fbuf, (i4)MAXFRSNAME);
	if (namestr == NULL)
	{
		IIFDerror(RTRFFL, 2, IIfrmio->fdfrmnm, ERx(""));
		return(FALSE);
	}

	/*  Set up an EDV to describe the caller's parameters.  */

	edv.ed_type = type;
	edv.ed_length = len;
	edv.ed_data = (PTR) data;
	edv.ed_null = ind;
	
	cb = FEadfcb();

	if (IIfrscb->frs_globs->enabled & GETMSGS_OFF)
	{
	    disp_msgs = FALSE;
	    oldproc = IIseterr(IIFRgmoGetmsgsOff);
	}

	/*
	**  If getting an 'oper', not a value, special processing required.
	**  Operators are not returned from FRAME as DBV's, so we must build
	**  one so we can follow the normal path and convert to the final EDV.
	*/

	getop = IIgetoper( (i4) 0 );

	if ( getop )
	{
		oper_dbv.db_datatype = DB_INT_TYPE;
		oper_dbv.db_length = sizeof(i4);
		oper_dbv.db_prec = 0;
		oper_dbv.db_data = (PTR) &oper;

		/*
		** Make sure the frame is in Query mode, else return NOOP.
		*/
		if (IIfrmio->fdrunmd != fdrtQRY)
			oper = fdNOP;
		else
			FDqryop( IIfrmio->fdrunfrm, namestr, (i4 *)
				oper_dbv.db_data );

		dbvptr = &oper_dbv;
	}
	else if (IIfrmio->fdrunmd == fdrtQRY)
	{
		/*
		**	If in query mode, we must use a different routine
		**	to retrieve the data portion of the field.  This
		**	routine also strips off the operator.
		*/

		if (!FDqryfld(IIfrmio->fdrunfrm, namestr, &dbvptr))
			errflag = TRUE;
	}
	else
	{
		IIfrscb->frs_event->eval_aggs = TRUE;

		/*
		**	Get data portion of the field
		*/

		if (!FDgetfld(IIfrmio->fdrunfrm, namestr, &dbvptr))
			errflag = TRUE;

		IIfrscb->frs_event->eval_aggs = FALSE;
	}

	/*
	**  If "errflag" is set at this point, then it was not
	**  possible to get the DB_DATA_VALUE pointer for a field.
	**
	**  Trim trailing blanks on character-type fields
	*/
	if ( errflag == FALSE && ( IIftrim( dbvptr, &dbvcop ) != OK ) )
		errflag = TRUE;

	/*
	**  Convert the DBV containing the field's value to an EDV
	*/

	if ( errflag == FALSE && ( adh_dbcvtev( cb, &dbvcop, &edv ) != OK ) )
	{
		if (cb->adf_errcb.ad_errcode == E_AD1012_NULL_TO_NONNULL)
		{
			IIFDerror(RTRNLNNL, 2, IIfrmio->fdfrmnm, namestr);
		}
		else
		{
			IIFDerror(RTGFERR, 2, IIfrmio->fdfrmnm, namestr);
		}
		errflag = TRUE;
	}

	if (!disp_msgs)
	    _VOID_ IIseterr(oldproc);

	if ( errflag == TRUE )
		return (FALSE);
	else
		return (TRUE);
}
示例#2
0
/* IIseterr() in LIBQ is really defined with the error handler function
** returning a long with an argument that is a pointer to a long, but we have
** always documented to users that they should define their error handler
** to return an int.
**
** Bug fix 63205 - make the prototyped version return an int so
** we don't get an argument mismatch at compile time.
*/
i4 (*IIpseterr(i4 (*proc)(i4 *errno)))()
{
    return IIseterr(proc);
}