Adding your source code to the code generated by BladeSmith

About this task

You must implement the following functions for the Mercury DataBlade® module:
  • CTempAssign()
  • CTempCast()
  • DecToTempCast()
  • FTempAssign()
  • FTempCast()
  • IntToTempCast()

These functions are all in the udr.c file. Do not modify the other generated functions that begin with Gen_.

To implement the Assign() and cast support functions:

Procedure

  1. Double-click each function under the Globals node in the Class view and remove the following code from each of them:
    /*          
    ** TO DO: Remove this comment and call to              
    **        mi_db_error_raise after implementing              
    **        this function.              
    */              
    mi_db_error_raise( Gen_Con, MI_EXCEPTION,              
        "Function Distance has not been implemented." ) 
  2. Add code in the section marked TO DO: Compute and store your value into Gen_RetVal.
    To find the code that you need to add for each function, look at the final version of udr.c or view the changes function-by-function in the following table (the functions might not be in the same order as in your udr.c file).
    Function name Description of change
    CTempAssign() Verify that an entered CTemp value is greater than -273.15; send an error message if it is not.
    CTempCast() Verify that an entered FTemp value is greater than -459.6; perform conversion to Celsius if it is or send an error message if it is not.
    DecToTempCast() Because of data type impedance between SQL and C, use the ESQL/C conversion function dectodbl() to convert the HCL Informix® server decimal data type to the C type double. The double precision data type is defined as the C type double.
    FTempAssign() Verify that an entered FTemp value is greater than -459.6; send an error message if it is not.
    FTempCast() Verify that an entered CTemp value is greater than -273.15; perform conversion to Fahrenheit if it is or send an error message if it is not.
    IntToTempCast() Both integer and double precision are defined as C types, so you can make the conversion in C.
  3. Save the changes to udr.c.