org.inria.ns.reflex.modules.rdbms
Class UpdateAction

java.lang.Object
  extended by org.inria.ns.reflex.processor.core.AbstractAction
      extended by org.inria.ns.reflex.processor.core.AbstractSetAction
          extended by org.inria.ns.reflex.modules.rdbms.QueryAction
              extended by org.inria.ns.reflex.modules.rdbms.UpdateAction
All Implemented Interfaces:
Computable, Executable, Presentable, Unwrappable, NamespaceContextFactory

public class UpdateAction
extends QueryAction

At runtime, the <rdbms:update> element perform an SQL INSERT, UPDATE or DELETE statement.

<rdbms:update connection="{Expression}"
     query="UPDATE EMPLOYEES SET SALARY = ? WHERE ID = ?"
     name="result-count"
     xmlns:rdbms="http://ns.inria.org/active-tags/rdbms">
   <xcl:param value="{ $employee-salary }"/>
   <xcl:param value="{ $employee-id }"/>
 </rdbms:update>

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from class org.inria.ns.reflex.processor.core.AbstractAction
AbstractAction.ParameterAdapter, AbstractAction.UselessAction
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Unwrappable
Unwrappable.Unwrapper
 
Field Summary
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractSetAction
NO_VALUE
 
Fields inherited from class org.inria.ns.reflex.processor.core.AbstractAction
actions, parent, processorInstance
 
Fields inherited from interface org.inria.ns.reflex.structures.Unwrappable
UNWRAPPER
 
Constructor Summary
UpdateAction(Expression connection, String statement, Element element, AbstractAction parent)
          Create a new instance of UpdateAction.
 
Method Summary
 Object runQuery(PreparedStatement statement)
          Run the query.
static AbstractAction unmarshal(AbstractAction parent, Element element)
          XML unmarshaller for UpdateAction.
 
Methods inherited from class org.inria.ns.reflex.modules.rdbms.QueryAction
getComputedValue, getStatement, unwrap
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractSetAction
addProperty, getComputedName, getName, getValue, runAction, scope, unmarshalScope
 
Methods inherited from class org.inria.ns.reflex.processor.core.AbstractAction
addAction, addFallbackAction, createContext, getCanonicalPath, getFallbackAction, getLocalFallbackAction, getLogger, getNamespaceContext, getNode, getParent, recover, recover, removeFallbackAction, reorganize, run, runActions, toPrettyString, toPrettyString, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UpdateAction

public UpdateAction(Expression connection,
                    String statement,
                    Element element,
                    AbstractAction parent)
             throws XMLException
Create a new instance of UpdateAction.

Parameters:
connection - The connection to use for execute this query, that will be the value of the property, as an Expression.
statement - The statement to perform.
node - The node from which the action has been unmarshalled. Used for namespace prefix resolution when performing XPath expressions.
parent - The action depending from.
Throws:
XMLException - When the action can't be created.
Method Detail

unmarshal

public static AbstractAction unmarshal(AbstractAction parent,
                                       Element element)
                                throws XMLException
XML unmarshaller for UpdateAction.

Parameters:
parent - The action depending from.
e - The XML element to unmarshall.
Returns:
The DeleteAction created.
Throws:
XMLException - When the element and its content is not those expected.

runQuery

public Object runQuery(PreparedStatement statement)
                throws SQLException
Run the query.

Specified by:
runQuery in class QueryAction
Parameters:
statement - The statement to run. The parameters, if any, have already been set.
Returns:
The result of the statement :
  • the number of rows affected by the query,
  • a set of browsable result.
Throws:
SQLException
See Also:
QueryAction.runQuery(java.sql.PreparedStatement)