planetj.database
Interface IDataEngineListener

All Superinterfaces:
EventListener

public interface IDataEngineListener
extends EventListener

DataEngineListeners register with SQLContext objects, and are alerted whenever that SQLContext is used in a DataEngine operation.


Field Summary
static int SQL_EXECUTE
           
static int SQL_QUERY
           
static int SQL_UPDATE
           
 
Method Summary
 void exceptionOccurred(SQLContext context, CMException cme, int sqlOperation)
          This method is invoked when a SQLContext object with which this listener is registered is used in a DataEngine operation which throws an exception.
 void executionCompleted(SQLContext context)
          Invoked whenever a SQLContext to which this object is listening is used to execute a SQL statement.
 void queryCompleted(SQLContext context, RowCollection rc)
          This method is invoked when a SQLContext object with which this listener is registered is used in a DataEngine query.
 void updateCompleted(SQLContext context, int updated)
          Invoked whenever a SQLContext to which this object is listening is used to update a database.
 

Field Detail

SQL_QUERY

public static final int SQL_QUERY
See Also:
Constant Field Values

SQL_UPDATE

public static final int SQL_UPDATE
See Also:
Constant Field Values

SQL_EXECUTE

public static final int SQL_EXECUTE
See Also:
Constant Field Values
Method Detail

exceptionOccurred

public void exceptionOccurred(SQLContext context,
                              CMException cme,
                              int sqlOperation)
This method is invoked when a SQLContext object with which this listener is registered is used in a DataEngine operation which throws an exception.

Parameters:
context - The SQLContext with which this listener was registered. The connection which was in use when the exception was thrown has been released; any future operations done with the SQLContext object will take a (possible different) connection from the DatabaseManager.
cme - The exception that was thrown.
sqlOperation - The type of operation that caused the exception. This will be one of the constants defined in the DataEngineListener interface.

executionCompleted

public void executionCompleted(SQLContext context)
Invoked whenever a SQLContext to which this object is listening is used to execute a SQL statement.

Parameters:
context - The SQLContext with which this listener was registered. The connection which was used in the statement is still contained in the SQLContext. If this connection was set in the SQLContext with the setConnection() method, then it needs to be freed (possibly in this method). If the connection was automatically retrieved from the system alias (specified with the setSystemAlias() method), then it is not necessary to free it.

queryCompleted

public void queryCompleted(SQLContext context,
                           RowCollection rc)
This method is invoked when a SQLContext object with which this listener is registered is used in a DataEngine query. If the query was not run in a background thread then this method will be invoked before the getRows() method returns.

Parameters:
context - The SQLContext with which this listener was registered. If the connection was specifically set in the SQLContext with the setConnection() method, then it is still present in the SQLContext. Otherwise, the connection which ran the query has already been returned to the pool.
rc - The RowCollection resulting from the query.

updateCompleted

public void updateCompleted(SQLContext context,
                            int updated)
Invoked whenever a SQLContext to which this object is listening is used to update a database.

Parameters:
context - The SQLContext with which this listener was registered. The connection which was used in the statement is still contained in the SQLContext. If this connection was set in the SQLContext with the setConnection() method, then it needs to be freed (possibly in this method). If the connection was automatically retrieved from the system alias (specified with the setSystemAlias() method), then it is not necessary to free it.
updated - The number of rows in the database which were altered as a result of the update