Class PreparedStatementWrapper

java.lang.Object
org.tentackle.dbms.StatementWrapper
org.tentackle.dbms.PreparedStatementWrapper
All Implemented Interfaces:
AutoCloseable, BackendPreparedStatement

public class PreparedStatementWrapper extends StatementWrapper implements BackendPreparedStatement
A wrapper for prepared statements.
Will catch and report SQLExceptions and keep track of being used only once after Db.getPreparedStatement(StatementKey, boolean, int, int, SqlSupplier).
Author:
harald
  • Constructor Details

    • PreparedStatementWrapper

      public PreparedStatementWrapper(ManagedConnection con, PreparedStatement stmt, StatementKey statementKey, String sql)
      Creates a wrapper for a prepared statement.
      Parameters:
      con - the connection
      stmt - the jdbc statement
      statementKey - the statement key if not a one-shot
      sql - the original SQL string that created the stmt
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class StatementWrapper
    • close

      public void close()
      Description copied from class: StatementWrapper
      Closes this statement.
      Specified by:
      close in interface AutoCloseable
      Overrides:
      close in class StatementWrapper
    • getStatement

      public PreparedStatement getStatement()
      Gets the wrapped prepared statement.
      Overrides:
      getStatement in class StatementWrapper
      Returns:
      the prepared statement, null if closed
    • getStatementKey

      public StatementKey getStatementKey()
      Gets the statement key.
      Returns:
      the key, null if one-shot
    • setColumnOffset

      public void setColumnOffset(int columnOffset)
      Sets the column offset. Useful for eager loading or joining in general.
      Parameters:
      columnOffset - (default is 0)
    • getColumnOffset

      public int getColumnOffset()
      Gets the column offset.
      Returns:
      the current columnOffset
    • rememberParameter

      protected void rememberParameter(int p, Object value)
      Sets the parameter to be remembered for diagnostics.
      Parameters:
      p - the effective SQL position
      value - the value of the parameter
    • detachSession

      protected void detachSession()
      Description copied from class: StatementWrapper
      Detach the session from the connection.
      Statements detach the session on executeUpdate or on close() in the ResultSetWrapper after executeQuery.
      Overrides:
      detachSession in class StatementWrapper
    • markReady

      public void markReady()
      Description copied from class: StatementWrapper
      Marks the statement to be ready for being consumed by a Db attached to a ConnectionManager.
      This is an additional measure to enforce the programming rule that a statement is being used only once after Db.createStatement() (for non-prepared statements) or after Db.getPreparedStatement(StatementKey, boolean, int, int, SqlSupplier) for prepared statements.

      If a statement is marked ready more than once, i.e. an open result exists (which would be closed according to the JDBC specs), a PersistenceException is thrown. The specs in Statement say:

      By default, only one ResultSet object per Statement object can be open at the same time.
      Therefore, if the reading of one ResultSet object is interleaved with the reading of another,
      each must have been generated by different Statement objects.
      All execution methods in the Statement interface implicitly close a statement's current
      ResultSet object if an open one exists.
      
      Without this additional measure a "ResultSet closed" exception will be thrown by the JDBC-driver on the next usage of the first result set, and you wouldn't have any clue which result set forced the closing.
      Overrides:
      markReady in class StatementWrapper
    • setBatch

      protected void setBatch(DbBatch batch)
      Sets the statement batch if batched within the current transaction.
      Parameters:
      batch - the batch
    • getBatch

      protected DbBatch getBatch()
      Gets the statement batch.
      Returns:
      null if not batched
    • isBatched

      protected boolean isBatched()
      Returns whether the statement is batched.
      Returns:
      true if used in a batched transaction
    • clearParameters

      public void clearParameters()
      Clears the current parameter values immediately.
      See Also:
    • getParameters

      public Map<Integer,Object> getParameters()
      Gets the parameter map.
      Returns:
      the parameters
    • getBatchParameters

      public List<Map<Integer,Object>> getBatchParameters()
      Gets the parameter map for a batched statement.
      Returns:
      the parameter batch list, null if not batched
    • executeUpdateImpl

      protected int executeUpdateImpl(String sql) throws SQLException
      Implementation of executeUpdate.

      Overridden because sql-string isn't used.

      Overrides:
      executeUpdateImpl in class StatementWrapper
      Parameters:
      sql - the sql string
      Returns:
      the number of affected rows
      Throws:
      SQLException - if update failed
    • executeUpdate

      public int executeUpdate()
      Executes the update.
      Returns:
      the row count
    • executeUpdate

      public int executeUpdate(String sql)
      Method must not be invoked on a PreparedStatementWrapper.
      Overrides:
      executeUpdate in class StatementWrapper
      Parameters:
      sql - must be null, any non-null results in a PersistenceException
      Returns:
      the row count
    • addBatch

      public void addBatch(String sql)
      Method must not be invoked on a PreparedStatementWrapper.
      Always throws PersistenceException.
      Overrides:
      addBatch in class StatementWrapper
      Parameters:
      sql - ignored
    • addBatch

      public void addBatch()
      Adds a set of parameters to this PreparedStatement's batch of commands.
    • clearBatch

      public void clearBatch()
      Description copied from class: StatementWrapper
      Empties this Statement object's current list of batched SQL commands.
      Overrides:
      clearBatch in class StatementWrapper
    • executeBatch

      public int[] executeBatch(boolean finish)
      Description copied from class: StatementWrapper
      Submits a batch of commands.
      Overrides:
      executeBatch in class StatementWrapper
      Parameters:
      finish - true if this is the last invocation
      Returns:
      an array of update counts containing one element for each command in the batch
    • isExecutionPending

      public boolean isExecutionPending()
      Returns whether parameters have been set so that execution is pending.
      Returns:
      true if pending, false otherwise
    • getBatchCount

      public int getBatchCount()
      Gets the number of pending addBatch invocations.
      Returns:
      0 if nothing pending
    • executeQueryImpl

      protected ResultSet executeQueryImpl(String sql) throws SQLException
      Implementation of executeQuery.

      Overridden because sql-string isn't used.

      Overrides:
      executeQueryImpl in class StatementWrapper
      Parameters:
      sql - the sql string
      Returns:
      the result set
      Throws:
      SQLException - if query failed
    • executeQuery

      public ResultSetWrapper executeQuery(boolean withinTx)
      Executes the query.
      Parameters:
      withinTx - is true if start a transaction for this query.
      Returns:
      the result set as a ResultSetWrapper
    • executeQuery

      public ResultSetWrapper executeQuery()
      Executes the query.
      Returns:
      the result set as a ResultSetWrapper
    • setNull

      public void setNull(int p, int type)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to SQL NULL.
      Specified by:
      setNull in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      type - the SQL type code defined in java.sql.Types
    • set

      public <T> int set(DataType<T> dataType, int p, T object, boolean mapNull, Integer size)
      Description copied from interface: BackendPreparedStatement
      Sets the object into the statement via its DataType.
      This method is provided for application-specific types.
      Specified by:
      set in interface BackendPreparedStatement
      Type Parameters:
      T - the type
      Parameters:
      dataType - the datatype
      p - the positional index, starting at 1
      object - the object of given datatype
      mapNull - true if map null values
      size - the optional size from the model
      Returns:
      the number of columns set
    • set

      public <T> void set(DataType<T> dataType, int p, T object, int index, boolean mapNull, Integer size)
      Description copied from interface: BackendPreparedStatement
      Sets a column of an object into a prepared statement via its DataType.
      This method is provided for application-specific types.
      Specified by:
      set in interface BackendPreparedStatement
      Type Parameters:
      T - the type
      Parameters:
      dataType - the datatype
      p - the positional index, starting at 1
      object - the object of given datatype
      index - the column index
      mapNull - true if map null values
      size - the optional size from the model
    • set

      public void set(SqlType sqlType, int p, Object object)
      Description copied from interface: BackendPreparedStatement
      Generic setter for objects via known SqlType.
      Specified by:
      set in interface BackendPreparedStatement
      Parameters:
      sqlType - the sql type
      p - the positional index, starting at 1
      object - the object of given sql type
    • setArray

      public void setArray(int p, Class<?> type, int columnIndex, Collection<?> elements, String operator)
      Description copied from interface: BackendPreparedStatement
      Sets an array parameter.
      Used for array operators such as IN, ANY or ALL.
      Specified by:
      setArray in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      type - the type of the array's elements, or the inner type if elements implement Convertible
      columnIndex - the column index for multi-column DataTypes, -1 if type is a Convertible, ignored otherwise
      elements - the array elements
      operator - the array operator
    • setString

      public void setString(int p, String s, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java String value. The driver converts this to an SQL VARCHAR or LONGVARCHAR value (depending on the argument's size relative to the driver's limits on VARCHAR values) when it sends it to the database.
      Specified by:
      setString in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      s - the parameter value
      mapNull - true if null values should be mapped to the empty string, else SQL NULL
    • setString

      public void setString(int p, String s)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java String value. The driver converts this to an SQL VARCHAR or LONGVARCHAR value (depending on the argument's size relative to the driver's limits on VARCHAR values) when it sends it to the database.
      Specified by:
      setString in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      s - the parameter value, null if the value should be set to SQL NULL
    • setLargeString

      public void setLargeString(int p, String s, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets a very large string.
      This is usually converted to SQL CLOB.
      Specified by:
      setLargeString in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      s - the parameter value
      mapNull - true if null values should be mapped to the empty string, else SQL NULL
    • setLargeString

      public void setLargeString(int p, String s)
      Description copied from interface: BackendPreparedStatement
      Sets a very large string.
      This is usually converted to SQL CLOB.
      Specified by:
      setLargeString in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      s - the parameter value, null if the value should be set to SQL NULL
    • setBoolean

      public void setBoolean(int p, boolean b)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java boolean value. The driver converts this to an SQL BIT or BOOLEAN value when it sends it to the database.
      Specified by:
      setBoolean in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      b - the parameter value
    • setBoolean

      public void setBoolean(int p, Boolean b)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java Boolean value. The driver converts this to an SQL BIT or BOOLEAN value when it sends it to the database.
      Specified by:
      setBoolean in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      b - the parameter value, null if the value should be set to SQL NULL
    • setByte

      public void setByte(int p, byte b)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java byte value. The driver converts this to an SQL TINYINT value when it sends it to the database.
      Specified by:
      setByte in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      b - the parameter value
    • setByte

      public void setByte(int p, Byte b)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java Byte value. The driver converts this to an SQL TINYINT value when it sends it to the database.
      Specified by:
      setByte in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      b - the parameter value, null if the value should be set to SQL NULL
    • setChar

      public void setChar(int p, char c)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java char value. The driver converts this to an SQL VARCHAR when it sends it to the database.
      Specified by:
      setChar in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      c - the parameter value
    • setCharacter

      public void setCharacter(int p, Character c, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java Character value. The driver converts this to an SQL VARCHAR when it sends it to the database.
      Specified by:
      setCharacter in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      c - the parameter value, null if the value should be set to SQL NULL
      mapNull - true if null values should be mapped to BLANK, else SQL NULL
    • setCharacter

      public void setCharacter(int p, Character c)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java Character value. The driver converts this to an SQL VARCHAR when it sends it to the database.
      Specified by:
      setCharacter in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      c - the parameter value, null if the value should be set to SQL NULL
    • setShort

      public void setShort(int p, short s)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java short value. The driver converts this to an SQL SMALLINT value when it sends it to the database.
      Specified by:
      setShort in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      s - the parameter value
    • setShort

      public void setShort(int p, Short s)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java Short value. The driver converts this to an SQL SMALLINT value when it sends it to the database.
      Specified by:
      setShort in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      s - the parameter value, null if the value should be set to SQL NULL
    • setInt

      public void setInt(int p, int i)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java int value. The driver converts this to an SQL INTEGER value when it sends it to the database.
      Specified by:
      setInt in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      i - the parameter value
    • setInteger

      public void setInteger(int p, Integer i)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java Integer value. The driver converts this to an SQL INTEGER value when it sends it to the database.
      Specified by:
      setInteger in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      i - the parameter value, null if the value should be set to SQL NULL
    • setLocalDate

      public void setLocalDate(int p, LocalDate d, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.LocalDate value using the default time zone of the virtual machine that is running the application.
      Specified by:
      setLocalDate in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      d - the parameter value
      mapNull - to map null values to 1.1.1970 (epochal time zero), else SQL NULL
    • setLocalDate

      public void setLocalDate(int p, LocalDate d)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.LocalDate value using the default time zone of the virtual machine that is running the application.
      Specified by:
      setLocalDate in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      d - the parameter value, null if the value should be set to SQL NULL
    • setLocalDateTime

      public void setLocalDateTime(int p, LocalDateTime ts)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.LocalDateTime value.
      Specified by:
      setLocalDateTime in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value, null if the value should be set to SQL NULL
    • setLocalDateTime

      public void setLocalDateTime(int p, LocalDateTime ts, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.LocalDateTime value.
      Specified by:
      setLocalDateTime in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value
      mapNull - to map null values to 1.1.1970 00:00:00.000 (epochal time zero), else SQL NULL
    • setOffsetDateTime

      public void setOffsetDateTime(int p, OffsetDateTime ts)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.OffsetDateTime value.
      Specified by:
      setOffsetDateTime in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value, null if the value should be set to SQL NULL
    • setOffsetDateTime

      public void setOffsetDateTime(int p, OffsetDateTime ts, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.OffsetDateTime value.
      Specified by:
      setOffsetDateTime in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value
      mapNull - to map null values to 1.1.1970 00:00:00.000 (epochal time zero), else SQL NULL
    • setZonedDateTime

      public void setZonedDateTime(int p, ZonedDateTime ts)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.ZonedDateTime value.
      Specified by:
      setZonedDateTime in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value, null if the value should be set to SQL NULL
    • setZonedDateTime

      public void setZonedDateTime(int p, ZonedDateTime ts, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.ZonedDateTime value.
      Specified by:
      setZonedDateTime in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value
      mapNull - to map null values to 1.1.1970 00:00:00.000 GMT (epochal time zero), else SQL NULL
    • setInstant

      public void setInstant(int p, Instant ts)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.Instant value.
      Specified by:
      setInstant in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value, null if the value should be set to SQL NULL
    • setInstant

      public void setInstant(int p, Instant ts, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.Instant value.
      Specified by:
      setInstant in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value
      mapNull - to map null values to 1.1.1970 00:00:00.000 (epochal time zero), else SQL NULL
    • setLocalTime

      public void setLocalTime(int p, LocalTime t)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.LocalTime value.
      Specified by:
      setLocalTime in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      t - the parameter value, null if the value should be set to SQL NULL
    • setOffsetTime

      public void setOffsetTime(int p, OffsetTime t)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.time.OffsetTime value.
      Specified by:
      setOffsetTime in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      t - the parameter value, null if the value should be set to SQL NULL
    • setLong

      public void setLong(int p, long l)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java long value. The driver converts this to an SQL BIGINT value when it sends it to the database.
      Specified by:
      setLong in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      l - the parameter value
    • setLong

      public void setLong(int p, Long l)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java Long value. The driver converts this to an SQL BIGINT value when it sends it to the database.
      Specified by:
      setLong in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      l - the parameter value, null if the value should be set to SQL NULL
    • setFloat

      public void setFloat(int p, float f)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java float value. The driver converts this to an SQL REAL value when it sends it to the database.
      Specified by:
      setFloat in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      f - the parameter value
    • setFloat

      public void setFloat(int p, Float f)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java Float value. The driver converts this to an SQL REAL value when it sends it to the database.
      Specified by:
      setFloat in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      f - the parameter value, null if the value should be set to SQL NULL
    • setDouble

      public void setDouble(int p, double d)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java double value. The driver converts this to an SQL DOUBLE value when it sends it to the database.
      Specified by:
      setDouble in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      d - the parameter value
    • setDouble

      public void setDouble(int p, Double d)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given Java Double value. The driver converts this to an SQL DOUBLE value when it sends it to the database.
      Specified by:
      setDouble in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      d - the parameter value, null if the value should be set to SQL NULL
    • setBigDecimal

      public void setBigDecimal(int p, BigDecimal d)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.math.BigDecimal value. The driver converts this to an SQL NUMERIC value when it sends it to the database.
      Specified by:
      setBigDecimal in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      d - the parameter value, null if the value should be set to SQL NULL
    • setBMoney

      public void setBMoney(int p, BMoney m)
      Sets the designated parameter to a BMoney value.
      A BMoney will not be stored as a single field but as two fields:
      1. a double representing the value
      2. an int representing the scale
      This is due to most DBMS can't store arbitrary scaled decimals in a single column, i.e., all values in the column must have the same scale.
      Parameters:
      p - the SQL position
      m - the money value, null to set SQL NULL
      See Also:
    • setDMoney

      public void setDMoney(int p, DMoney m)
      Sets the designated parameter to a DMoney value.
      A DMoney will not be stored as a single field but as two fields:
      1. a BigDecimal with a scale of 0 representing the value
      2. an int representing the scale
      This is due to most DBMS can't store arbitrary scaled decimals in a single column, i.e., all values in the column must have the same scale.
      Parameters:
      p - the SQL position
      m - the money value, null to set SQL NULL
      See Also:
    • setDate

      public void setDate(int p, Date d, Calendar timezone, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application. The driver converts this to an SQL DATE value when it sends it to the database.
      Specified by:
      setDate in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      d - the parameter value
      timezone - the calendar providing the timezone configuration
      mapNull - to map null values to 1.1.1970 (epochal time zero), else SQL NULL
    • setDate

      public void setDate(int p, Date d, Calendar timezone)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application. The driver converts this to an SQL DATE value when it sends it to the database.
      Specified by:
      setDate in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      d - the parameter value
      timezone - the calendar providing the timezone configuration
    • setDate

      public void setDate(int p, Date d, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application. The driver converts this to an SQL DATE value when it sends it to the database.
      Specified by:
      setDate in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      d - the parameter value
      mapNull - to map null values to 1.1.1970 (epochal time zero), else SQL NULL
    • setDate

      public void setDate(int p, Date d)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application. The driver converts this to an SQL DATE value when it sends it to the database.
      Specified by:
      setDate in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      d - the parameter value, null if the value should be set to SQL NULL
    • setTimestamp

      public void setTimestamp(int p, Timestamp ts, Calendar timezone, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.sql.Timestamp value. The driver converts this to an SQL TIMESTAMP value when it sends it to the database.
      Specified by:
      setTimestamp in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value
      timezone - the calendar providing the timezone configuration
      mapNull - to map null values to 1.1.1970 00:00:00.000 (epochal time zero), else SQL NULL
    • setTimestamp

      public void setTimestamp(int p, Timestamp ts, Calendar timezone)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.sql.Timestamp value. The driver converts this to an SQL TIMESTAMP value when it sends it to the database.
      Specified by:
      setTimestamp in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value
      timezone - the calendar providing the timezone configuration else SQL NULL
    • setTimestamp

      public void setTimestamp(int p, Timestamp ts, boolean mapNull)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.sql.Timestamp value. The driver converts this to an SQL TIMESTAMP value when it sends it to the database.
      Specified by:
      setTimestamp in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value
      mapNull - to map null values to 1.1.1970 00:00:00.000 (epochal time zero), else SQL NULL
    • setTimestamp

      public void setTimestamp(int p, Timestamp ts)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.sql.Timestamp value. The driver converts this to an SQL TIMESTAMP value when it sends it to the database.
      Specified by:
      setTimestamp in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      ts - the parameter value, null if the value should be set to SQL NULL
    • setTime

      public void setTime(int p, Time t, Calendar timezone)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.sql.Time value. The driver converts this to an SQL TIME value when it sends it to the database.
      Specified by:
      setTime in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      t - the parameter value, null if the value should be set to SQL NULL
      timezone - the calendar providing the timezone configuration
    • setTime

      public void setTime(int p, Time t)
      Description copied from interface: BackendPreparedStatement
      Sets the designated parameter to the given java.sql.Time value. The driver converts this to an SQL TIME value when it sends it to the database.
      Specified by:
      setTime in interface BackendPreparedStatement
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      t - the parameter value, null if the value should be set to SQL NULL
    • setBinary

      public void setBinary(int p, Binary<?> b)
      Sets the designated parameter to the given Binary value. The driver converts it to a BLOB value when it sends it to the database. The implementation translates the Binary into an InputStream and invokes PreparedStatement.setBlob(int, java.io.InputStream, long).
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      b - the parameter value, null if the value should be set to SQL NULL
    • setTBinary

      public void setTBinary(int p, TBinary<?> b)
      Sets the designated parameter to the given TBinary value. The driver converts it to a BLOB value when it sends it to the database. The implementation translates the Binary into an InputStream and invokes PreparedStatement.setBlob(int, java.io.InputStream, long).
      Parameters:
      p - the first parameter is 1, the second is 2, ...
      b - the parameter value, null if the value should be set to SQL NULL