org.midao.jdbc.core.handlers.input.query
Class QueryInputHandler

java.lang.Object
  extended by org.midao.jdbc.core.handlers.input.AbstractInputHandler<T>
      extended by org.midao.jdbc.core.handlers.input.query.AbstractQueryInputHandler<QueryParameters>
          extended by org.midao.jdbc.core.handlers.input.query.QueryInputHandler
All Implemented Interfaces:
InputHandler<QueryParameters>

public class QueryInputHandler
extends AbstractQueryInputHandler<QueryParameters>

Query InputHandler allows accepting QueryParameters as an input. This is useful when you have to call Stored Procedures, as it is possible to specify Direction and Type of Stored Procedure parameters. If Metadata Handler cannot figure Stored Procedure/Function parameters for Named Input Handlers(Bean/Map Input Handlers) - this InputHandler should be used. In such case - please specify Direction and/or Type in QueryParameters


Field Summary
 
Fields inherited from class org.midao.jdbc.core.handlers.input.AbstractInputHandler
EMPTY_ARRAY, EMPTY_INT_ARRAY, processor
 
Constructor Summary
protected QueryInputHandler(QueryInputProcessor processor, java.lang.String encodedQuery, QueryParameters inputParameter, java.lang.String parameterName)
           
  QueryInputHandler(java.lang.String encodedQuery, QueryParameters inputParameter)
          Creates new QueryInputHandler instance
  QueryInputHandler(java.lang.String encodedQuery, QueryParameters inputParameter, java.lang.String parameterName)
          Creates new QueryInputHandler instance
 
Method Summary
 QueryParameters getQueryParameters()
          Returns named parameters and their values
 java.lang.String getQueryString()
          Returns parsed SQL String (without named parameters)
 QueryParameters update(java.lang.Object[] outParamValues)
          This implementation allows updating input parameters with values returned from Query call.
 
Methods inherited from class org.midao.jdbc.core.handlers.input.AbstractInputHandler
mergeMaps, validateSqlString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryInputHandler

public QueryInputHandler(java.lang.String encodedQuery,
                         QueryParameters inputParameter)
Creates new QueryInputHandler instance

Parameters:
encodedQuery - Original SQL string
inputParameter - QueryParameters input

QueryInputHandler

public QueryInputHandler(java.lang.String encodedQuery,
                         QueryParameters inputParameter,
                         java.lang.String parameterName)
Creates new QueryInputHandler instance

Parameters:
encodedQuery - Original SQL string
inputParameter - QueryParameters input
parameterName - Class name of the @inputParameter. If it is specified - it can be referenced by it's name. Example: class name: Animal. Key: Name. In SQL string it can be references as ":animal.name"

QueryInputHandler

protected QueryInputHandler(QueryInputProcessor processor,
                            java.lang.String encodedQuery,
                            QueryParameters inputParameter,
                            java.lang.String parameterName)
Method Detail

getQueryString

public java.lang.String getQueryString()
Description copied from class: AbstractQueryInputHandler
Returns parsed SQL String (without named parameters)

Specified by:
getQueryString in interface InputHandler<QueryParameters>
Specified by:
getQueryString in class AbstractQueryInputHandler<QueryParameters>
Returns:
parsed SQL String

getQueryParameters

public QueryParameters getQueryParameters()
Description copied from class: AbstractQueryInputHandler
Returns named parameters and their values

Specified by:
getQueryParameters in interface InputHandler<QueryParameters>
Specified by:
getQueryParameters in class AbstractQueryInputHandler<QueryParameters>
Returns:
QueryParameters filled with parameters and their values

update

public QueryParameters update(java.lang.Object[] outParamValues)
Description copied from class: AbstractQueryInputHandler
This implementation allows updating input parameters with values returned from Query call. Usually it is used when you have OUT parameters from Query execution and want to update original input with them. Only fields with Direction specified as OUT/INOUT would be updated. Doesn't actually updates input, but creates new instance with updated values. Might be removed in future, as can be replaced with: 1. getQueryParameters() 2. QueryParameters.update(Object[], boolean)

Specified by:
update in class AbstractQueryInputHandler<QueryParameters>
Parameters:
outParamValues - Array of values returned after Query execution from OUT/INOUT fields
Returns:
new instance of input parameters with updated values.


Copyright © 2013. All Rights Reserved.