Reference Guide > Java APIs for Custom Procedures > ExecutionEnvironment
 
ExecutionEnvironment
ExecutionEnvironment provides an interface between a custom procedure and the TDV Server.
public interface ExecutionEnvironment
 
Method Summary
void
ExecutionEnvironement
java.sql.ResultSet
int
String
void
ProcedureReference
ProcedureReference
void
Method Detail
commit
public void commit()
 
This method commits an open transaction.
Throws
This method throws CustomProcedureException if invoked for the parent transaction; it throws SQLException if an error occurs during the commit.
 
createTransaction
public ExecutionEnvironment createTransaction(int flags)
 
This method starts an independent transaction, letting custom procedures have multiple independent transactions open at the same time.
Parameter
flags—Used to pass in transaction options for compensate mode, recovery mode, and recovery level.
Legal flag values are:
COMPENSATE* | NO_COMPENSATE
ROLLBACK* | BEST_EFFORT
IGNORE_INTERRUPT* | LOG_INTERRUPT | FAIL_INTERRUPT
 
Asterisks indicate the default values used if no flags are specified.
 
executeQuery
public java.sql.ResultSet executeQuery (String sql, Object[] args)
 
This method is used to execute a SELECT statement from inside the stored procedure. It should not return NULL.
Parameters
sql—SQL statement.
args—Arguments for the query. Can be NULL if there are no arguments.
The args objects should comply with the Java to SQL typing conventions listed in Types. Input cursors are accepted as CustomCursor and java.sql.ResultSet.
Throws
This method throws CustomProcedureException or SQLException.
executeUpdate
public int executeUpdate (String sql)
 
This method executes an INSERT, UPDATE, or DELETE statement from inside the stored procedure call.
Parameter
sql—SQL statement to execute.
Returns
Number of rows affected; -1 if number of rows affected is unknown.
Throws
This method throws CustomProcedureException if there is a problem executing the SQL.
 
getProperty
public String getProperty(String name)
 
This method gets environmental properties.
Parameter
name—Property to get.
Four property options are available: userName, userDomain, caseSensitive and ignoreTrailingSpaces. Property names are not case-sensitive.
Returns
This method returns NULL if the property is not defined.
 
log
public void log(int level, String log_message)
 
This method sends an entry to the system log.
Parameters
level—ERROR, INFO, or DEBUG
log_message—Log entry.
 
lookupNextHook
public ProcedureReference lookupNextHook()
 
This method is used by hook procedures to invoke the next hook in the list. It should not return NULL.
Throws
This method throws CustomProcedureException.
 
lookupProcedure
public lookupProcedure (String procedureName)
 
This method looks up a procedure reference from the query.
Call the close method on the returned procedure when it is no longer needed. This method does not return NULL.
Parameter
procedureName—Name of the procedure to look up.
Throws
This method throws CustomProcedureException if the procedure is not found.
 
rollback
public void rollback()
 
This method rolls back an open transaction.
Throws
This method throws CustomProcedureException if invoked for the parent transaction, or SQLException if an error occurs.