Class BindParams

java.lang.Object
io.ebeaninternal.api.BindParams
All Implemented Interfaces:
Serializable

public final class BindParams extends Object implements Serializable
Parameters used for binding to a statement.

Supports ordered or named parameters.

See Also:
  • Constructor Details

    • BindParams

      public BindParams()
  • Method Details

    • reset

      public void reset()
      Reset positioned parameters (usually due to bind parameter expansion).
    • queryBindHash

      public void queryBindHash(BindValuesKey key)
    • 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.
    • naturalKeyBindParam

      public NaturalKeyBindParam naturalKeyBindParam()
      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.
    • parameter

      public BindParams.Param parameter(String name)
      Return the named parameter.
    • parameter

      public BindParams.Param parameter(int position)
      Return the Parameter for a given 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.
    • setArrayParameter

      public void setArrayParameter(String name, Collection<?> value)
      Set a named In parameter that is multi-valued.
    • 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.
    • 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 ?.
    • preparedSql

      public String preparedSql()
      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.
    • updateHash

      public void updateHash()
      Updates the hash.
    • createOrderedList

      public BindParams.OrderedList createOrderedList()
      Create a new positioned parameters orderedList.