CTempAssign.c routine

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

/*******************************************************************************
**
** Function name:
**
**  CTempAssign
**
** Description:
**
** Special Comments:
**
**  Entrypoint for the SQL routine assign (CTemp) returns CTemp.
**
**      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 *CTempAssign
(

mi_double_precision *        temperature,
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 CTempAssign."
        */
        DBDK_TRACE_ERROR( "CTempAssign", ERRORMESG2, 10 );

        /* not reached */
    }

    /* TO DO: Compute and store your value into Gen_RetVal. */
    
    if (*temperature < -273.15)
    {
             DBDK_TRACE_ERROR("CTempAssign", "UMRC0", 10 );
    }

    *Gen_RetVal = *temperature;
    /* ------ }}Your_Code (#T1R9) END ------ */
    /* Return the function's return value. */
    return Gen_RetVal;
}
/* }}FUNCTION (#C8QQ17MC) */