Hi all-
I am using the informix objects interface for c++ and I can't figure how to retrieve several values returned by a function.
Let's say that I have a function that returns 5 variables: (RETURN h_time, d_time, w_time, m_time, y_time
but the command:
ITRoutineManager routine(conn);
ITvalue val2;
val2 = routine.ExecForValue();
allows to retreive only 1 value.
Do I am missing something?
Thanks for your help,
Manu
===============================
Piece of code that I am using:
ITRoutineManager routine(conn);
ITBool bret = routine.GetRoutine("function get_time(int,int)"); //RETURN h_time, d_time, w_time, m_time, y_time;
ITValue *val, *val1, *val2;
val = routine.Param(0);
ITRoutineManager routine(conn);
ITBool bret = routine.GetRoutine("function get_time(int,int)");
ITValue *val, *val1, *val2;
val = routine.Param(0); //
val->FromPrintable("1");
val->Release();
//
val1 = routine.Param(1);
val1->FromPrintable("2");
val1->Release();
val2 = routine.ExecForValue();
cout << "Type of get_time return value is " << (routine.ResultType())->Name()<<":" <<(routine.ResultType())->ColumnCount()<< endl;
//output=> Type of get_time return value is integer:-1
=============================
piece of code from the function:
CREATE FUNCTION get_time(w_last smallint, perf smallint)
DEFINE p_sql_err integer;
DEFINE h_time_id integer;
DEFINE w_time_id integer;
DEFINE d_time_id integer;
DEFINE m_time_id integer;
DEFINE y_time_id integer;
[...]
RETURN h_time_id, d_time_id, w_time_id, m_time_id, y_time_id;
END FUNCTION
I am using the informix objects interface for c++ and I can't figure how to retrieve several values returned by a function.
Let's say that I have a function that returns 5 variables: (RETURN h_time, d_time, w_time, m_time, y_time
but the command:
ITRoutineManager routine(conn);
ITvalue val2;
val2 = routine.ExecForValue();
allows to retreive only 1 value.
Do I am missing something?
Thanks for your help,
Manu
===============================
Piece of code that I am using:
ITRoutineManager routine(conn);
ITBool bret = routine.GetRoutine("function get_time(int,int)"); //RETURN h_time, d_time, w_time, m_time, y_time;
ITValue *val, *val1, *val2;
val = routine.Param(0);
ITRoutineManager routine(conn);
ITBool bret = routine.GetRoutine("function get_time(int,int)");
ITValue *val, *val1, *val2;
val = routine.Param(0); //
val->FromPrintable("1");
val->Release();
//
val1 = routine.Param(1);
val1->FromPrintable("2");
val1->Release();
val2 = routine.ExecForValue();
cout << "Type of get_time return value is " << (routine.ResultType())->Name()<<":" <<(routine.ResultType())->ColumnCount()<< endl;
//output=> Type of get_time return value is integer:-1
=============================
piece of code from the function:
CREATE FUNCTION get_time(w_last smallint, perf smallint)
DEFINE p_sql_err integer;
DEFINE h_time_id integer;
DEFINE w_time_id integer;
DEFINE d_time_id integer;
DEFINE m_time_id integer;
DEFINE y_time_id integer;
[...]
RETURN h_time_id, d_time_id, w_time_id, m_time_id, y_time_id;
END FUNCTION