The com.informix.udr.UDREnv
The UDREnv interface consists of methods for accessing and manipulating the routine state of the UDR. It exposes a subset of the routine-state information in the MI_FPARAM structure (which holds routine-state information for C UDRs). It also contains some utilities related to the JVP, such as logging and tracing.
The online examples in $INFORMIXDIR/extend/krakatoa/examples.tar include an example of the UDREnv class in Env.java.
public interface UDREnv
{
// Information about the UDR signature
String getName();
String[] getParamTypeName();
String getReturnTypeName();
// For maintaining state across UDR invocations
void setUDRState (Object state);
Object getUDRState();
// For set/iterator processing
public static final int UDR_SET_INIT = 1;
public static final int UDR_SET_RETONE = 2;
public static final int UDR_SET_END = 3;
int getSetIterationState();
void setSetIterationIsDone(boolean value);
// Logging and Tracing
UDRTraceable getTraceable();
UDRLog getLog();
}
The getName() method returns the name of the UDR as it is registered in the database.
The getParamTypeName() method returns the SQL data type names for the UDR arguments and getReturnTypeName() method returns the SQL data type names for the return value.
If you are using HCL OneDB™ JDBC Driver 2.0, use the getUDRs() method of the java.sql.DatabaseMetaData class to obtain more information about a data type.
The setUDRState() method sets the user-state pointer for the UDR. It stores a given object in the context of the UDR instance. The object might contain states that are shared across UDR invocations (such as the OneDB JDBC Driver connection handle or a UDRLog object). The getUDRState() method returns the object set by the latest call to setUDRState().
Iterator-status constant | Meaning | Use |
---|---|---|
UDR_SET_INIT | This is the first time that the iterator function is called. | Initialize the user state for the iterator function. |
UDR_SET_RETONE | This is an actual iteration of the iterator function. | Return items of the active set, one per iteration. |
UDR_SET_END | This is the last time that the iterator function is called. | Free any resources associated with the user state. |
The setSetIterationIsDone() method sets the iterator-completion flag for an iterator function. Use the setSetIterationIsDone() method to tell the database server whether the current iterator function has reached its end condition. An end condition indicates that the generation of the active set is complete. The database server calls the iterator function with the UDR_SET_RETONE iterator-status value as long as the end condition has not been set.
The getLog() method returns a UDRLog interface for logging uses.
The getTraceable() method returns a UDRTraceable interface for the UDRs to use.