flux
Interface DatabaseQueryAction

All Superinterfaces:
Action, java.lang.Cloneable, DatabaseActionInfo, RuntimeDataMap, java.io.Serializable

public interface DatabaseQueryAction
extends DatabaseActionInfo

Executes an SQL query in the engine's database and makes the resulting JDBC result set available to flow chart actions.

When this action runs, it returns a facade over a JDBC result set. The facade exposes the first row of data returned by the SQL query. Each time the current execution flow context reaches this action again, the next row in the JDBC result set is fetched.

Finally, when the JDBC result set is exhausted, the result set is closed. The result set is also closed when the current execution flow context reaches a transaction break, since JDBC result sets must be closed before the open transaction commets.

Once the JDBC result set is closed, the next time the current execution flow context executes this action, the SQL query is issued again, and the entire process repeats.

Open JDBC result sets are stored in a transient flow context variable whose name is referenced from SqlSelectAction.RESULT_SET_FLOW_CONTEXT_KEY.

The Database Query Action returns its result in the flow context variable "RESULT". The following table contains more information on accessing and using the result.

Flow Context Variable Field Java Type Description
RESULTresultbooleanA boolean value indicating whether there are more results available in the underlying JDBC result set.
RESULTrowjava.util.List<java.lang.Object>A List representing the current row in the result set.

Author:
Copyright 2014 Flux Corporation. All rights reserved.

Nested Class Summary
static class DatabaseQueryAction.DatabaseQueryActionResult
          A facade over a JDBC result set that is returned after this action runs.
 
Field Summary
static java.lang.String RESULT_SET_FLOW_CONTEXT_KEY
          The key to a flow context variable that may hold an open JDBC result set from a previous iteration over this action within the same transaction.
 
Method Summary
 Flow addFlow(Action action)
          The flow that is followed when this Database Query Action fires with unconsumed result set data from the stored procedure call.
 java.util.List<java.lang.Object> getParameters()
          Returns the parameters for the SQL query to be executed.
 java.lang.String getQuery()
          Returns the SQL query that is used to query a database.
 void setParameters(java.util.List<java.lang.Object> parameters)
          Sets the parameters for the SQL query to be executed.
 void setQuery(java.lang.String query)
          Sets the SQL query that is used to query a database.
 
Methods inherited from interface flux.DatabaseActionInfo
getDataSource, getDataSourceInitialContextFactory, getDataSourceInitialContextPassword, getDataSourceInitialContextProviderUrl, getDataSourceInitialContextUsername, getDataSourcePassword, getDataSourceUsername, getJdbcDriver, getJdbcPassword, getJdbcUrl, getJdbcUsername, isBuiltinDatabaseConnectionUsed, setBuiltinDatabaseConnectionUsed, setDataSource, setDataSourceInitialContextFactory, setDataSourceInitialContextPassword, setDataSourceInitialContextProviderUrl, setDataSourceInitialContextUsername, setDataSourcePassword, setDataSourceUsername, setJdbcDriver, setJdbcPassword, setJdbcUrl, setJdbcUsername
 
Methods inherited from interface flux.Action
addFlow, addSignalFlow, clone, execute, getDescription, getFlows, getHiddenVariableNames, getJoinExpression, getName, getPostscript, getPostscriptLanguage, getPrescript, getPrescriptLanguage, getResultInfo, getSignalsToMonitor, getTimeoutBusinessInterval, getTimeoutBusinessIntervalNamespace, getTimeoutExpression, getVariableManager, isEndOfRun, isJoinPoint, isSkippable, isStartAction, isStartOfRun, isTransactionBreak, removeFlow, reset, setDescription, setElseFlow, setEndOfRun, setErrorFlow, setErrorFlowWithoutRollback, setErrorFlowWithRollback, setJoinExpression, setJoinPoint, setName, setPostscript, setPostscriptLanguage, setPrescript, setPrescriptLanguage, setSignalsToMonitor, setSkippable, setStartAction, setStartOfRun, setTimeoutBusinessInterval, setTimeoutBusinessIntervalNamespace, setTimeoutExpression, setTimeoutFlow, setTransactionBreak, verify, verifyOnClient
 
Methods inherited from interface flux.runtimedatamap.RuntimeDataMap
getRuntimeDataMap, setRuntimeDataMap
 

Field Detail

RESULT_SET_FLOW_CONTEXT_KEY

static final java.lang.String RESULT_SET_FLOW_CONTEXT_KEY
The key to a flow context variable that may hold an open JDBC result set from a previous iteration over this action within the same transaction.

See Also:
Constant Field Values
Method Detail

addFlow

Flow addFlow(Action action)
The flow that is followed when this Database Query Action fires with unconsumed result set data from the stored procedure call. Delegates to addFlow(Action, EngineHelper.useLastResult("result")).

To add a flow that is followed under different conditions with this Database Query Action, use a different flow condition by calling addFlow(Action action, String condition). For example, to unconditionally follow a flow to a certain action, call DatabaseQueryAction.addFlow(action, "true"). Alternately, to follow a flow after all result set data has been consumed, call DatabaseQueryAction.setElseFlow(action).

Note that with actions other than Database Query Action, addFlow(Action) may not delegate to addFlow(Action, EngineHelper.useLastResult("result")). Most actions do not delegate in this manner. When using these other actions, use caution to ensure the flow condition is as intended.

Specified by:
addFlow in interface Action
Parameters:
action - The flow that is followed when this Database Query Action fires.
Returns:
The newly created flow.
See Also:
Action.addFlow(Action, String), EngineHelper.useLastResult(String)

getParameters

java.util.List<java.lang.Object> getParameters()
Returns the parameters for the SQL query to be executed.

Returns:
The parameters for the SQL query to be executed.

getQuery

java.lang.String getQuery()
Returns the SQL query that is used to query a database.

Returns:
The SQL query that is used to query a database.

setParameters

void setParameters(java.util.List<java.lang.Object> parameters)
Sets the parameters for the SQL query to be executed.

Parameters:
parameters - The parameters for the SQL query to be executed.

setQuery

void setQuery(java.lang.String query)
Sets the SQL query that is used to query a database.

Parameters:
query - The query that is used to query a database.


© 2014 Flux Corporation. All rights reserved.