@SupportsOutputStreaming public abstract class JdbcQuerySenderBase<H> extends JdbcSenderBase<H>
Modifier and Type | Class and Description |
---|---|
static class |
JdbcQuerySenderBase.QueryType |
HasStatistics.Action
Modifier and Type | Field and Description |
---|---|
static String |
UNP_END |
static String |
UNP_START |
connection, paramList
Constructor and Description |
---|
JdbcQuerySenderBase() |
Modifier and Type | Method and Description |
---|---|
protected String |
adjustQueryAndParameterListForNamedParameters(ParameterList parameterList,
String query) |
protected boolean |
canProvideOutputStream() |
protected void |
closeConnectionForSendMessage(Connection connection,
PipeLineSession session) |
protected void |
closeStatementSet(QueryExecutionContext queryExecutionContext,
PipeLineSession session) |
void |
configure()
configure() is called once at startup of the framework in the configure method of the owner of this sender. |
protected void |
convertQuery(Connection connection,
QueryExecutionContext queryExecutionContext) |
protected Message |
executeOtherQuery(Connection connection,
PreparedStatement statement,
String query,
PreparedStatement resStmt,
Message message,
PipeLineSession session,
ParameterList parameterList) |
protected Message |
executeOtherQuery(QueryExecutionContext queryExecutionContext,
Message message,
PipeLineSession session) |
protected Message |
executePackageQuery(QueryExecutionContext queryExecutionContext) |
protected PipeRunResult |
executeSelectQuery(PreparedStatement statement,
Object blobSessionVar,
Object clobSessionVar,
javax.servlet.http.HttpServletResponse response,
String contentType,
String contentDisposition,
PipeLineSession session,
IForwardTarget next) |
protected PipeRunResult |
executeSelectQuery(PreparedStatement statement,
Object blobSessionVar,
Object clobSessionVar,
PipeLineSession session,
IForwardTarget next) |
protected PipeRunResult |
executeStatementSet(QueryExecutionContext queryExecutionContext,
Message message,
PipeLineSession session,
IForwardTarget next) |
protected Message |
executeUpdateBlobQuery(PreparedStatement statement,
Message contents) |
protected Message |
executeUpdateClobQuery(PreparedStatement statement,
Message contents) |
protected String |
fillParamArray(Object[] paramArray,
String message) |
int |
getBatchSize() |
protected CallableStatement |
getCallWithRowIdReturned(Connection con,
String query) |
protected Connection |
getConnectionForSendMessage(H blockHandle) |
protected abstract String |
getQuery(Message message)
Obtain a query to be executed.
|
QueryExecutionContext |
getQueryExecutionContext(Connection connection,
Message message,
PipeLineSession session) |
JdbcQuerySenderBase.QueryType |
getQueryTypeEnum() |
protected Message |
getResult(ResultSet resultset) |
protected Message |
getResult(ResultSet resultset,
Object blobSessionVar,
Object clobSessionVar) |
protected PipeRunResult |
getResult(ResultSet resultset,
Object blobSessionVar,
Object clobSessionVar,
javax.servlet.http.HttpServletResponse response,
String contentType,
String contentDisposition,
PipeLineSession session,
IForwardTarget next) |
protected ResultSet |
getReturnedColumns(String[] columns,
PreparedStatement st) |
protected PreparedStatement |
getStatement(Connection con,
QueryExecutionContext queryExecutionContext) |
void |
open()
This method will be called to start the sender.
|
protected PreparedStatement |
prepareQuery(Connection con,
QueryExecutionContext queryExecutionContext) |
protected QueryExecutionContext |
prepareStatementSet(H blockHandle,
Connection connection,
Message message,
PipeLineSession session) |
MessageOutputStream |
provideOutputStream(PipeLineSession session,
IForwardTarget next)
return a
MessageOutputStream that can be used to write a message to, that then will be processed in a streaming way. |
protected PipeRunResult |
sendMessageOnConnection(Connection connection,
Message message,
PipeLineSession session,
IForwardTarget next) |
void |
setAvoidLocking(boolean avoidLocking)
If true, then select queries are executed in a way that avoids taking locks, e.g.
|
void |
setBlobBase64Direction(Base64Pipe.Direction value)
controls whether the streamed blobdata will need to be base64
encode or decode or not. |
void |
setBlobCharset(String string)
Charset that is used to read and write BLOBs.
|
void |
setBlobColumn(int i)
Only for querytype 'updateBlob': column that contains the BLOB to be updated
|
void |
setBlobsCompressed(boolean b)
controls whether blobdata is stored compressed in the database
|
void |
setBlobSessionKey(String string)
For querytype 'updateBlob': key of session variable that contains the data (String or InputStream) to be loaded to the BLOB.
|
void |
setBlobSmartGet(boolean b)
Controls automatically whether blobdata is stored compressed and/or serialized in the database
|
void |
setClobColumn(int i)
Only for querytype 'updateClob': column that contains the CLOB to be updated
|
void |
setClobSessionKey(String string)
For querytype 'updateClob': key of session variable that contains the CLOB (String or InputStream) to be loaded to the CLOB.
|
void |
setCloseInputstreamOnExit(boolean b)
Deprecated.
|
void |
setCloseOutputstreamOnExit(boolean b)
When set to
false , the Outputstream is not closed after BLOB or CLOB has been written to it |
void |
setColumnsReturned(String string)
Comma separated list of columns whose values are to be returned.
|
void |
setIncludeFieldDefinition(boolean b)
when
true , the result contains besides the returned rows also includes a header with information about the fetched fields |
void |
setLockRows(boolean b)
When set
true , exclusive row-level locks are obtained on all the rows identified by the select statement (e.g. |
void |
setLockWait(int i)
when set and >=0, ' FOR UPDATE WAIT #' is used instead of ' FOR UPDATE NOWAIT SKIP LOCKED'
|
void |
setMaxRows(int i)
The maximum number of rows to be returned from the output of
select queries, -1 means unlimited rows |
void |
setNullValue(String string)
Value used in result as contents of fields that contain no value (sql-null)
|
void |
setOutputFormat(DocumentFormat outputFormat)
The type of output.
|
void |
setPackageContent(String packageContent)
Controls wheter the returned package content is db2 format or xml format.
|
void |
setPrettyPrint(boolean prettyPrint)
If true and scalar=false, multiline indented XML is produced
|
void |
setQueryType(String queryType)
Type of query to be executed
|
void |
setResultQuery(String string)
Query that can be used to obtain result of side-effect of update-query, like generated value of sequence.
|
void |
setRowIdSessionKey(String string)
If specified, the rowid of the processed row is put in the pipelinesession under the specified key (only applicable for
querytype=other ). |
void |
setScalar(boolean b)
When
true , the value of the first column of the first row (or the startrow) is returned as the only result, as a simple non-xml value |
void |
setScalarExtended(boolean b)
When
true and scalar is also true , but returns no value, one of the following is returned:
'[absent]' no row is found
'[null]' a row is found, but the value is a SQL-NULL
'[empty]' a row is found, but the value is a empty string
|
void |
setSqlDialect(String string)
If set, the SQL dialect in which the queries are written and should be translated from to the actual SQL dialect
|
void |
setStartRow(int i)
The number of the first row to be returned from the output of
select queries. |
void |
setStreamCharset(String string)
Charset used when reading a stream (that is e.g.
|
void |
setStreamResultToServlet(boolean b)
Deprecated.
|
void |
setSynchronous(boolean synchronous)
When
true , the result of sendMessage is the reply of the request. |
void |
setTrimSpaces(boolean b)
Remove trailing blanks from all result values.
|
void |
setUseNamedParams(Boolean b)
Named parameters will be auto detected by default.
|
boolean |
supportsOutputStreamPassThrough()
Implementations should return
true when they do not require an OutputStream, but can
provide one to the preceding pipe if they are themselves provided with one from the next pipe. |
addParameter, close, getParameterList, getTimeout, sendMessage, setTimeout, toString
getAuthAlias, getConnection, getConnectionWithTimeout, getDatasource, getDatasourceInfo, getDatasourceName, getDbmsSupport, getLogPrefix, getPassword, getPhysicalDestinationName, getUsername, isConnectionsArePooled, isTransacted, iterateOverStatistics, setAuthAlias, setConnectionsArePooled, setDatasourceName, setDbmsSupportFactory, setJmsRealm, setPassword, setTransacted, setUsername
getContext, getJndiEnv, setAuthentication, setCredentials, setInitialContextFactoryName, setJndiAuthAlias, setJndiContextPrefix, setJndiProperties, setName, setPrincipal, setProviderURL, setSecurityProtocol, setUrlPkgPrefixes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
closeBlock, openBlock, sendMessage
sendMessage
consumesSessionVariable
isSynchronous, sendMessageOrThrow
getName, setName
getApplicationContext, getName
getConfigurationClassLoader
setApplicationContext
getDomain
public static final String UNP_START
public static final String UNP_END
public void configure() throws ConfigurationException
ISender
configure()
is called once at startup of the framework in the configure method of the owner of this sender.
Purpose of this method is to check whether the static configuration of the sender is correct.
As much as possible class-instantiating should take place in the configure()
or open()
method, to improve performance.configure
in interface IConfigurable
configure
in interface ISender
configure
in class JdbcSenderBase<H>
ConfigurationException
protected abstract String getQuery(Message message) throws SenderException
SenderException
protected final PreparedStatement getStatement(Connection con, QueryExecutionContext queryExecutionContext) throws JdbcException, SQLException
JdbcException
SQLException
public void open() throws SenderException
ISender
sendMessage()
method.open
in interface ISender
open
in class JdbcSenderBase<H>
SenderException
protected void convertQuery(Connection connection, QueryExecutionContext queryExecutionContext) throws JdbcException, SQLException
JdbcException
SQLException
protected PreparedStatement prepareQuery(Connection con, QueryExecutionContext queryExecutionContext) throws SQLException, JdbcException
SQLException
JdbcException
protected CallableStatement getCallWithRowIdReturned(Connection con, String query) throws SQLException
SQLException
protected ResultSet getReturnedColumns(String[] columns, PreparedStatement st) throws SQLException
SQLException
public QueryExecutionContext getQueryExecutionContext(Connection connection, Message message, PipeLineSession session) throws SenderException, SQLException, ParameterException, JdbcException
protected Connection getConnectionForSendMessage(H blockHandle) throws JdbcException, TimeoutException
JdbcException
TimeoutException
protected void closeConnectionForSendMessage(Connection connection, PipeLineSession session) throws JdbcException, TimeoutException
JdbcException
TimeoutException
protected QueryExecutionContext prepareStatementSet(H blockHandle, Connection connection, Message message, PipeLineSession session) throws SenderException
SenderException
protected void closeStatementSet(QueryExecutionContext queryExecutionContext, PipeLineSession session)
protected PipeRunResult sendMessageOnConnection(Connection connection, Message message, PipeLineSession session, IForwardTarget next) throws SenderException, TimeoutException
SenderException
TimeoutException
protected PipeRunResult executeStatementSet(QueryExecutionContext queryExecutionContext, Message message, PipeLineSession session, IForwardTarget next) throws SenderException, TimeoutException
SenderException
TimeoutException
protected String adjustQueryAndParameterListForNamedParameters(ParameterList parameterList, String query) throws SenderException
SenderException
protected Message getResult(ResultSet resultset) throws JdbcException, SQLException, IOException, javax.jms.JMSException
JdbcException
SQLException
IOException
javax.jms.JMSException
protected Message getResult(ResultSet resultset, Object blobSessionVar, Object clobSessionVar) throws JdbcException, SQLException, IOException, javax.jms.JMSException
JdbcException
SQLException
IOException
javax.jms.JMSException
protected PipeRunResult getResult(ResultSet resultset, Object blobSessionVar, Object clobSessionVar, javax.servlet.http.HttpServletResponse response, String contentType, String contentDisposition, PipeLineSession session, IForwardTarget next) throws JdbcException, SQLException, IOException
JdbcException
SQLException
IOException
protected Message executeUpdateBlobQuery(PreparedStatement statement, Message contents) throws SenderException
SenderException
protected Message executeUpdateClobQuery(PreparedStatement statement, Message contents) throws SenderException
SenderException
protected boolean canProvideOutputStream()
public boolean supportsOutputStreamPassThrough()
IOutputStreamingSupport
true
when they do not require an OutputStream, but can
provide one to the preceding pipe if they are themselves provided with one from the next pipe.public MessageOutputStream provideOutputStream(PipeLineSession session, IForwardTarget next) throws StreamingException
IOutputStreamingSupport
MessageOutputStream
that can be used to write a message to, that then will be processed in a streaming way.
If a target MessageOutputStream is required to stream output to, this can be obtained from next
, if specified.
If the implementor of this method is a pipe, and it is the last one in the chain of streaming pipes, it must provide the appropriate
forward in the provide MessageOutputStream.
If the class cannot provide an outputstream, it must return null.
If the provider of an outputstream is a pipe itself, it must provide a proper pipeforward in the provided outputstreamStreamingException
protected PipeRunResult executeSelectQuery(PreparedStatement statement, Object blobSessionVar, Object clobSessionVar, PipeLineSession session, IForwardTarget next) throws SenderException
SenderException
protected PipeRunResult executeSelectQuery(PreparedStatement statement, Object blobSessionVar, Object clobSessionVar, javax.servlet.http.HttpServletResponse response, String contentType, String contentDisposition, PipeLineSession session, IForwardTarget next) throws SenderException
SenderException
protected Message executePackageQuery(QueryExecutionContext queryExecutionContext) throws SenderException, JdbcException, IOException, javax.jms.JMSException
SenderException
JdbcException
IOException
javax.jms.JMSException
protected Message executeOtherQuery(QueryExecutionContext queryExecutionContext, Message message, PipeLineSession session) throws SenderException
SenderException
protected Message executeOtherQuery(Connection connection, PreparedStatement statement, String query, PreparedStatement resStmt, Message message, PipeLineSession session, ParameterList parameterList) throws SenderException
SenderException
protected String fillParamArray(Object[] paramArray, String message) throws SenderException
SenderException
public void setPackageContent(String packageContent)
public void setQueryType(String queryType)
public JdbcQuerySenderBase.QueryType getQueryTypeEnum()
public void setScalar(boolean b)
true
, the value of the first column of the first row (or the startrow) is returned as the only result, as a simple non-xml valuepublic void setScalarExtended(boolean b)
true
and scalar
is also true
, but returns no value, one of the following is returned:
public void setMaxRows(int i)
select
queries, -1 means unlimited rowspublic void setStartRow(int i)
select
queries. Rows before this are skipped from the output.public void setNullValue(String string)
public void setResultQuery(String string)
public void setColumnsReturned(String string)
public void setUseNamedParams(Boolean b)
"?{"paramname"}"
will be replaced by the value of the corresponding parameter. The parameters don't need to be in the correct order and unused parameters are skipped.public void setIncludeFieldDefinition(boolean b)
true
, the result contains besides the returned rows also includes a header with information about the fetched fieldspublic void setTrimSpaces(boolean b)
public void setRowIdSessionKey(String string)
querytype=other
). Note: If multiple rows are processed a SqlException is thrown.@Deprecated public void setStreamResultToServlet(boolean b)
public void setSqlDialect(String string)
public void setLockRows(boolean b)
true
, exclusive row-level locks are obtained on all the rows identified by the select statement (e.g. by appending ' FOR UPDATE NOWAIT SKIP LOCKED' to the end of the query)public void setLockWait(int i)
public void setSynchronous(boolean synchronous)
true
, the result of sendMessage is the reply of the request.public void setBlobColumn(int i)
public void setBlobSessionKey(String string)
public void setBlobsCompressed(boolean b)
public void setBlobBase64Direction(Base64Pipe.Direction value)
encode
or decode
or not.public void setBlobCharset(String string)
public void setBlobSmartGet(boolean b)
public void setClobColumn(int i)
public void setClobSessionKey(String string)
@Deprecated public void setCloseInputstreamOnExit(boolean b)
false
, the Inputstream is not closed after it has been used to update a BLOB or CLOBpublic void setCloseOutputstreamOnExit(boolean b)
false
, the Outputstream is not closed after BLOB or CLOB has been written to itpublic void setStreamCharset(String string)
public void setAvoidLocking(boolean avoidLocking)
public void setPrettyPrint(boolean prettyPrint)
public void setOutputFormat(DocumentFormat outputFormat)
public int getBatchSize()
Copyright © 2023 Frank!Framework. All rights reserved.