| org.isqlviewer.sql.ResultSetRenderer
All known Subclasses: org.isqlviewer.util.NullResultSetViewer, org.isqlviewer.ui.TabbedResultsetRenderer,
ResultSetRenderer | public interface ResultSetRenderer (Code) | | Protocol for defining a client that can render results from an JDBC command execution.
author: Mark A. Kobold <mkobold at isqlviewer dot com> version: 1.0 |
Method Summary | |
public void | finalizeStatement(String stmtID) handler if the statement has been interrupted or cancelled. | public void | handleSQLException(SQLException e) Delegates an SQLException from a given ResultSet. | public void | initialize() Basic initialization method to allocate resource prior to executing a query. | public boolean | isCancelled() | public void | processGeneratedKeys(String stmtID, ResultSet keys, String nativeSQL) Process generated keys result set after initial result set is processed.
If this ResultSetViewer supports processing generated keys, this method should called if and only the statement
provides generated keys resultset. | public long | processResultSet(String stmtID, ResultSet set, String nativeSQL, int count) Processes ResultSet objects from a statement execution.
This is the common method for dispatching a result set for processing outside the database connection object.
Once a Statement has executed and has results this method will be invoked. | public void | processRowUpdates(String stmtID, int updateCount, String nativeSQL) Processes row updates from a statement execution. | public void | recieveResultsetWarnings(ResultSet set, SQLWarning warnings) Delegates SQLWarnings from the given ResultSet to be handled. | public void | recieveStatementWarnings(Statement stmt, SQLWarning warnings) Statement warnings from a resultset can be delegated here. | public void | statementInitialized(String stmtID, Statement statement) Notifcation that the a statement object has been created and is ready to execute.
Simple callback method for indicating that the Statement object has been created and will be executing shortly
after this method. | public String | substituteVariable(String variableName) Allows the renderer to substitute the variable by name with something else.
When an SQL Statement is executed and inline variables in the Jav variable form of ${variable.name} are detect
the SQL executor will request a substitution for the variable name.
Parameters: variableName - to substitute. | public boolean | supportsGeneratedKeys() Determines if this object wants to view generated keys.
If this method returns true, a second call should be made to processGeneratedKeys so that the can be properly
handled. | public boolean | supportsUpdateableResultSets() Determining if this resultset viewer can edit updatable resultsets.
If a ResultSet is deemed updateable and this method returns true, then the DatabaseConnection object will not
automatically close the resultset when it is done processing it. |
finalizeStatement | public void finalizeStatement(String stmtID)(Code) | | handler if the statement has been interrupted or cancelled.
if an error occurs in the realm that the statement execution was interuppted threading wise or through the use of
the cancel method on the statement this method will be used to indicate that the statement was interrupted and no
further processing will be be executed on the statement.
Implementations can use the statement identifier to clean up and resources if nessecary, no further calls to this
object should be made with the given statement ID, if so exceptions should be thrown.
Parameters: stmtID - unqiue identifier for the statement that was cancelled. |
handleSQLException | public void handleSQLException(SQLException e)(Code) | | Delegates an SQLException from a given ResultSet.
If performing some processing of the given ResultSet, results with an SQLException, than it should be delegated
here.
Code may send a null ResultSet to indicate a general SQLException.
Parameters: set - ResultSet as the source of the Exception, can be null. Parameters: e - Exception that has occured. |
initialize | public void initialize()(Code) | | Basic initialization method to allocate resource prior to executing a query.
|
isCancelled | public boolean isCancelled()(Code) | | |
processGeneratedKeys | public void processGeneratedKeys(String stmtID, ResultSet keys, String nativeSQL)(Code) | | Process generated keys result set after initial result set is processed.
If this ResultSetViewer supports processing generated keys, this method should called if and only the statement
provides generated keys resultset. Like the other methods implementations are not required to close the
resultset, the invoking code should close the resultset after this method is closed.
A Side note that the generated keys is a JDBC 3.0 feature so make sure that the JDBC driver has been updated to
be uses in the JDK 1.4.x+ runtimes as the JDK 1.4.x runtimes support the JDBC 3.0 specification.
See Also: ResultSetRenderer.supportsGeneratedKeys() See Also: Statement.getGeneratedKeys Parameters: nativeSQL - SQL statement that the keys originated from. Parameters: stmtID - unique identifier for this statement. Parameters: keys - generated keys as a result of the previous resultset. |
processResultSet | public long processResultSet(String stmtID, ResultSet set, String nativeSQL, int count)(Code) | | Processes ResultSet objects from a statement execution.
This is the common method for dispatching a result set for processing outside the database connection object.
Once a Statement has executed and has results this method will be invoked. Implementations are not required to
nor are they encouraged to close the resultset as the code calling this method should ensure that the resultset
is closed properly. If the statement is returning multiple resultsets this method will be called for each
resultset recieved. The exception for closing ResultSets is described in the supportsUpdateableResultSets()
method.
The count parameter is for convience to indicate which resultset this is in a series of resultsets, if the
statement is returning only one resultset or is executing a single statement the count should always be 0. There
are situations where multiple queries can be executed in a single statement the count parameter in this situation
will also represent the resultset count in the series.
See Also: ResultSetRenderer.supportsUpdateableResultSets() See Also: Statement.getResultSet Parameters: nativeSQL - SQL that created the given ResultSet. Parameters: stmtID - unique identifier for this statement. Parameters: set - ResultSet returned from the statement's execution. Parameters: count - in the situation of multiple resultsets this will be a counter for the resultset. number of rows processed from the result set. |
processRowUpdates | public void processRowUpdates(String stmtID, int updateCount, String nativeSQL)(Code) | | Processes row updates from a statement execution.
If a Statement execution does not return any resultsets then it most likely was an UPDATE or something similar.
This allows for notification for the that update count returned by the statement.
See Also: Statement.getUpdateCount Parameters: nativeSQL - the SQL that created the update count. Parameters: stmtID - unique identifier for the executing statement. Parameters: updateCount - the update count as a result of statement execution. |
recieveResultsetWarnings | public void recieveResultsetWarnings(ResultSet set, SQLWarning warnings)(Code) | | Delegates SQLWarnings from the given ResultSet to be handled.
Any code that invokes this method should clear all warnings from the given ResultSet to help insure that the same
warning is not processed more than it needs to be.
Parameters: set - ResultSet source where the given warnings came from. Parameters: warnings - detected from the given resultset. |
recieveStatementWarnings | public void recieveStatementWarnings(Statement stmt, SQLWarning warnings)(Code) | | Statement warnings from a resultset can be delegated here.
Any code that invokes this method should clear all warnings from the given Statement to help insure that the same
warning is not processed more than it needs to be.
Parameters: stmt - Source statement object the warnings are coming from. Parameters: warnings - from a statement. |
statementInitialized | public void statementInitialized(String stmtID, Statement statement)(Code) | | Notifcation that the a statement object has been created and is ready to execute.
Simple callback method for indicating that the Statement object has been created and will be executing shortly
after this method. Implementations can use the stmtID for ensuring each resultset is processed correctly, if
implementation are responding to multiple statement executions.
Parameters: stmtID - unique identifier for the statement currently executing. |
substituteVariable | public String substituteVariable(String variableName)(Code) | | Allows the renderer to substitute the variable by name with something else.
When an SQL Statement is executed and inline variables in the Jav variable form of ${variable.name} are detect
the SQL executor will request a substitution for the variable name.
Parameters: variableName - to substitute. the value to be substituted for the given variable name. |
supportsGeneratedKeys | public boolean supportsGeneratedKeys()(Code) | | Determines if this object wants to view generated keys.
If this method returns true, a second call should be made to processGeneratedKeys so that the can be properly
handled. Note if there are no generated keys and or they are supported for a paticular JDBC platform.
You can check support for generated keys through the DatabaseMetaData object.
See Also: java.sql.DatabaseMetaData.supportsGetGeneratedKeys true to process generated keys or not process them. |
supportsUpdateableResultSets | public boolean supportsUpdateableResultSets()(Code) | | Determining if this resultset viewer can edit updatable resultsets.
If a ResultSet is deemed updateable and this method returns true, then the DatabaseConnection object will not
automatically close the resultset when it is done processing it. This allows this object to keeps a reference to
it and provide updates to the Resultset as needed.
If the ResultSet is not updatable or the statement is generating multiple results then the value returned here
will be ignored as with multiple resultsets it says in the JDBC API that one and only one resultset should be
open per statement object. so with that if multiple results are being returned all results will be automatically
closed.
Since the resultset is not automatically closed, it is strongly encouraged that extra steps are taken to ensure
that a resultset is closed, as open resultsets can cause erratic problems on certain JDBC platforms.
if this object can perform updates on the ResultSet. |
|
|