|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--uk.org.ogsadai.client.toolkit.activity.RequestComponent
|
+--uk.org.ogsadai.client.toolkit.activity.Activity
|
+--uk.org.ogsadai.client.toolkit.activity.ParameterizedActivity
|
+--uk.org.ogsadai.client.toolkit.activity.sql.SQLQuery
This activity evaluates an SQL statement that generates a single result set. It has no input and one output. The format of the output is WebRowSet XML, a standard XML representation for a result set.
Queries can be parameterized by using the '?' token in the query expression. These tokens can be replaced with parameter values hence allowing an activity to be reused with a slightly different configuration.
For example, the activity may have the following query expression:
SELECT * FROM MyTable WHERE id > ? AND id < ?
This query has two parameters whose values can be set using the
setParameter method, for example:
myActivity.setParameter( 1, "10" );
myActivity.setParameter( 2, "20" );
Would be equilavent to the query expression:
SELECT * FROM MyTable WHERE id > 10 AND id < 20
The getResultSet() method can be used to obtain a
ResultSet object containing the results of this query,
after it has been executed. This can be either of type
ResultSet.TYPE_FORWARD_ONLY or
ResultSet.TYPE_SCROLL_INSENSITIVE (with the former being
more memory efficient), specified by using the
setResultSetType(int) method.
Should you wish to obtain a "disconnected" result set, which only
reads rows from the data service as they are required, rather than receiving
all the results data from the data service and storing it locally, you should
use an OutputStreamActivity activity and connect its input
to this activity's output. The OutputStreamActivity
class has a getResultSet method which can be used to
obtain such a result set.
| Constructor Summary | |
SQLQuery(java.lang.String expression)
Constructs a query with the given query expression. |
|
| Method Summary | |
protected java.lang.String |
generateXML()
Generates the XML representing the activity. |
java.lang.String |
getExpression()
Gets the SQL query expression. |
ActivityOutput |
getOutput()
Gets the activity's only output. |
java.sql.ResultSet |
getResultSet()
Gets the result set containing the result of processing the query. |
int |
getResultSetType()
Return the type of ResultSet objects the getResultSet()
method returns. |
void |
setResultSetType(int i)
Set the type of ResultSet objects the getResultSet()
method returns. |
| Methods inherited from class uk.org.ogsadai.client.toolkit.activity.ParameterizedActivity |
clearParameters, generateParametersXML, setParameter, setParameter |
| Methods inherited from class uk.org.ogsadai.client.toolkit.activity.Activity |
addInput, addOutput, addOutputs, getDataResourceID, getDataServiceStub, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setDataServiceStub, setInput |
| Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent |
getName |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SQLQuery(java.lang.String expression)
expression - | Method Detail |
public int getResultSetType()
ResultSet objects the getResultSet()
method returns.
ResultSet typepublic void setResultSetType(int i)
ResultSet objects the getResultSet()
method returns.
i - either of ResultSet.TYPE_FORWARD_ONLY or
ResultSet.TYPE_SCROLL_INSENSITIVEpublic java.lang.String getExpression()
public java.sql.ResultSet getResultSet()
throws ActivityOutputException,
DataFormatException
ResultSet containing query result.
DataFormatException - If the output data is not in the expected format.
ActivityOutputException - If there is no output data.public ActivityOutput getOutput()
protected java.lang.String generateXML()
RequestComponent
generateXML in class Activity
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||