Using ITRoutineManager

The ITRoutineManager class provides an alternative way to execute server routines. The functionality of the ITRoutineManager class is only supported with HCL Informix® databases.

When using ITRoutineManager, a connection does not have to be checked out to get or execute a routine (and a value object, therefore, can use it), and the execution of the routine commences faster since there is no SQL to parse.

The following excerpts from routine.cpp illustrate the use of ITRoutineManager.
  1. To use ITRoutineManager, the application creates an instance of it on an open connection object.
    ITRoutineManager routine(conn);
  2. The GetRoutine() method retrieves the function descriptor for the function whose signature is passed as an argument.
    ITBool bret = routine.GetRoutine("function sum(int,int)");
  3. The application sets parameter values by using ITValue::FromPrintable().
    val = routine.Param(0);
    val->FromPrintable("1");
    val->Release();

    It can also set parameter values by using ITRoutineManager::SetParam().

  4. The routine is executed with ExecForValue(), which returns a pointer to ITValue corresponding to the return value of the routine.
    val2 = routine.ExecForValue();
  5. A Release() call releases the ITValue instance.
    val2->Release();
    }