Package io.ebeaninternal.api
Class BindParams
- java.lang.Object
-
- io.ebeaninternal.api.BindParams
-
- All Implemented Interfaces:
Serializable
public class BindParams extends Object implements Serializable
Parameters used for binding to a statement.Supports ordered or named parameters.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BindParams.OrderedList
The bind parameters in the correct binding order.static class
BindParams.Param
A In Out capable parameter for the CallableStatement.
-
Constructor Summary
Constructors Constructor Description BindParams()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
buildQueryPlanHash(StringBuilder builder)
Calculate and return a query plan bind hash with total bind count.String
calcQueryPlanHash()
Return the hash that should be included with the query plan.BindParams
copy()
Return a deep copy of the BindParams.BindParams.OrderedList
createOrderedList()
Create a new positioned parameters orderedList.NaturalKeyBindParam
getNaturalKeyBindParam()
Return a Natural Key bind param if supported.BindParams.Param
getParameter(int position)
Return the Parameter for a given position.BindParams.Param
getParameter(String name)
Return the named parameter.String
getPreparedSql()
Return the sql with ? place holders (named parameters have been processed and ordered).boolean
isEmpty()
Return true if there are no bind parameters.boolean
isSameBindHash()
Return true if the bind hash and count has not changed.List<BindParams.Param>
positionedParameters()
Return the values of ordered parameters.int
queryBindHash()
void
registerOut(int position, int outType)
Register the parameter as an Out parameter using position.void
registerOut(String name, int outType)
Register the named parameter as an Out parameter.boolean
requiresNamedParamsPrepare()
Return true if named parameters are being used and they have not yet been ordered.void
reset()
Reset positioned parameters (usually due to bind parameter expansion).BindParams.Param
setEncryptionKey(String name, Object value)
Set an encryption key as a bind value.void
setNextParameter(Object value)
Bind the next positioned parameter.void
setNextParameters(Object... values)
void
setNullParameter(int position, int jdbcType)
Set a null parameter using position.void
setNullParameter(String name, int jdbcType)
Set a named In parameter that is null.void
setParameter(int position, Object value)
Using position set the In value of a parameter.void
setParameter(int position, Object value, int outType)
Set an In Out parameter using position.BindParams.Param
setParameter(String name, Object value)
Set a named In parameter that is not null.void
setParameter(String name, Object value, int outType)
Set a named In Out parameter.void
setPreparedSql(String preparedSql)
Set the sql with named parameters replaced with place holder ?.int
size()
-
-
-
Constructor Detail
-
BindParams
public BindParams()
-
-
Method Detail
-
reset
public void reset()
Reset positioned parameters (usually due to bind parameter expansion).
-
queryBindHash
public int queryBindHash()
-
calcQueryPlanHash
public String calcQueryPlanHash()
Return the hash that should be included with the query plan.This is to handle binding collections to in clauses. The number of values in the collection effects the query (number of bind values) and so must be taken into account when calculating the query hash.
-
buildQueryPlanHash
public void buildQueryPlanHash(StringBuilder builder)
Calculate and return a query plan bind hash with total bind count.
-
copy
public BindParams copy()
Return a deep copy of the BindParams.
-
isEmpty
public boolean isEmpty()
Return true if there are no bind parameters.
-
getNaturalKeyBindParam
public NaturalKeyBindParam getNaturalKeyBindParam()
Return a Natural Key bind param if supported.
-
size
public int size()
-
requiresNamedParamsPrepare
public boolean requiresNamedParamsPrepare()
Return true if named parameters are being used and they have not yet been ordered. The sql needs to be prepared (named replaced with ?) and the parameters ordered.
-
setNullParameter
public void setNullParameter(int position, int jdbcType)
Set a null parameter using position.
-
setParameter
public void setParameter(int position, Object value, int outType)
Set an In Out parameter using position.
-
setNextParameters
public void setNextParameters(Object... values)
-
setNextParameter
public void setNextParameter(Object value)
Bind the next positioned parameter.
-
setParameter
public void setParameter(int position, Object value)
Using position set the In value of a parameter. Note that for nulls you must use setNullParameter.
-
registerOut
public void registerOut(int position, int outType)
Register the parameter as an Out parameter using position.
-
setParameter
public void setParameter(String name, Object value, int outType)
Set a named In Out parameter.
-
setNullParameter
public void setNullParameter(String name, int jdbcType)
Set a named In parameter that is null.
-
setParameter
public BindParams.Param setParameter(String name, Object value)
Set a named In parameter that is not null.
-
setEncryptionKey
public BindParams.Param setEncryptionKey(String name, Object value)
Set an encryption key as a bind value.Needs special treatment as the value should not be included in a log.
-
registerOut
public void registerOut(String name, int outType)
Register the named parameter as an Out parameter.
-
getParameter
public BindParams.Param getParameter(int position)
Return the Parameter for a given position.
-
getParameter
public BindParams.Param getParameter(String name)
Return the named parameter.
-
positionedParameters
public List<BindParams.Param> positionedParameters()
Return the values of ordered parameters.
-
setPreparedSql
public void setPreparedSql(String preparedSql)
Set the sql with named parameters replaced with place holder ?.
-
getPreparedSql
public String getPreparedSql()
Return the sql with ? place holders (named parameters have been processed and ordered).
-
isSameBindHash
public boolean isSameBindHash()
Return true if the bind hash and count has not changed.
-
createOrderedList
public BindParams.OrderedList createOrderedList()
Create a new positioned parameters orderedList.
-
-