DecToTemp.c routine

/* {{FUNCTION(75fa3955-0d42-11d3-98b2-000000000000) (MergeSection) */

/*******************************************************************************
**
** Function name:
**
**	DecToTempCast
**
** Description:
**
** Special Comments:
**
**	Entrypoint for the SQL routine DecToTempCast (decimal) returns temperature.
**
**      A stack size of 32,767 bytes  has  been  requested  for
**      the routine.  Normally, this is sufficient memory for most
**      invocations of your UDR.  If you intend, however, to  call
**      this routine recursively or other routines that use  large
**      or unknown stack sizes, you must use mi_call().  mi_call
**      checks to insure that sufficient stack space is available.
**      For  more  details  regarding  this   function,  look  in:
**      The  DataBlade  API Programmer's  Manual  (see Stack Space
**      Allocation in Chapter 11).
**
** Parameters:
**
**	None
**
** Return value:
**
**	mi_double_precision
**
** History:
**
**	05/18/1999 - Generated by BladeSmith Version 4.00.517.
**
** Identification:
**
** NOTE:
**
**	BladeSmith will add and remove parameters from the function
**	prototype, and will generate tracing calls.  Only edit code
**	in blocks marked  Your_<section>.  Any other  modifications
**	will require manual merging.
**
********************************************************************************
*/
UDREXPORT mi_double_precision *DecToTempCast
(

mi_decimal *                 Argument1,
MI_FPARAM *                  Gen_fparam  /* Standard info - see DBDK docs. */
)
{
	mi_double_precision *      Gen_RetVal;  /* The return value. */
	MI_CONNECTION *      Gen_Con;     /* The connection handle.  */
	/* ------ {{Your_Declarations (PreserveSection) BEGIN ------ */
	/* ------ }}Your_Declarations (#0000) END ------             */

	/* Use the NULL connection. */
	Gen_Con = NULL;


	/* ------ {{Your_Code (PreserveSection) BEGIN ------ */
	/*
	

	/*
	** Allocate the return value.  It must be
	** allocated if it is a UDT or type whose
	** size is greater than 4 bytes.
	*/
	Gen_RetVal = (mi_double_precision *)mi_alloc( sizeof( mi_double_precision ) );
	if( Gen_RetVal == 0)
	{
		/*
		** Memory allocation has failed so issue
		** the following message and quit.
		**
		** 	"Memory allocation has failed in DecToTempCast."
		*/
		DBDK_TRACE_ERROR( "DecToTempCast", ERRORMESG2, 10 );

		/* not reached */
	}

	/* TO DO: Compute and store your value into Gen_RetVal. */
	if (dectodbl(Argument1, Gen_RetVal) < 0)
    {
            mi_db_error_raise(Gen_Con, MI_EXCEPTION, "dectodbl() failed.");
    }
	/* ------ }}Your_Code (#5TKQ) END ------ */
	
	/* Return the function's return value. */
	return Gen_RetVal;
}
/* }}FUNCTION (#0ODMD1JJ) */