uk.org.ogsadai.client.toolkit.activity.sql
Class SQLUpdate

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.SQLUpdate

public class SQLUpdate
extends ParameterizedActivity

This activity executes the given SQL statement, which should be an SQL INSERT, UPDATE, or DELETE statement or an SQL statement that returns nothing, such as an SQL DDL statement.

The activity has no inputs and one output - the number of rows affected by the statement.

Author:
The OGSA-DAI Project Team

Field Summary
private static java.lang.String COPYRIGHT_NOTICE
          Copyright statement
private  java.lang.String mExpression
          SQL query
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.ParameterizedActivity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
 
Constructor Summary
SQLUpdate(java.lang.String expression)
          Constructs a SQL update with the given expression.
 
Method Summary
protected  java.lang.String generateXML()
          Generates the XML representing the activity.
 java.lang.String getExpression()
          Gets the SQL query expression.
 int getModifiedRowsCount()
          Returns the number of rows modified by the update.
 ActivityOutput getOutput()
          Gets the activity's only output - the count of rows affected.
 void setExpression(java.lang.String expression)
          Sets the SQL expression.
 
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, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setInput
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
getDataService, getName, getSession, setDataService, setSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT_NOTICE

private static final java.lang.String COPYRIGHT_NOTICE
Copyright statement

See Also:
Constant Field Values

mExpression

private java.lang.String mExpression
SQL query

Constructor Detail

SQLUpdate

public SQLUpdate(java.lang.String expression)
Constructs a SQL update with the given expression.

Parameters:
expression - SQL update.
Throws:
java.lang.IllegalArgumentException - If expression is null.
Method Detail

setExpression

public void setExpression(java.lang.String expression)
Sets the SQL expression.

Parameters:
expression - SQL query.
Throws:
java.lang.IllegalArgumentException - If expression is null.

getExpression

public java.lang.String getExpression()
Gets the SQL query expression.

Returns:
the SQL query expression

getModifiedRowsCount

public int getModifiedRowsCount()
                         throws NoActivityOutputException,
                                DataFormatException
Returns the number of rows modified by the update.

Returns:
number of rows modified by the update
Throws:
NoActivityOutputException - if there is no output data or the data has not yet been processed to this output or the activity that generates this output has not yet been executed.
DataFormatException - if the output from the activity cannot be parsed into a count.

getOutput

public ActivityOutput getOutput()
Gets the activity's only output - the count of rows affected.

Returns:
the activity output.

generateXML

protected java.lang.String generateXML()
Description copied from class: RequestComponent
Generates the XML representing the activity. This XML can then be inserted into a perform document that is sent to a data service.

Specified by:
generateXML in class Activity
Returns:
the XML for the activity