Class PreparedStatementWrapper
java.lang.Object
org.tentackle.dbms.StatementWrapper
org.tentackle.dbms.PreparedStatementWrapper
- All Implemented Interfaces:
AutoCloseable, BackendPreparedStatement
A wrapper for prepared statements.
Will catch and report SQLExceptions and keep track of being used only once after
Will catch and report SQLExceptions and keep track of being used only once after
Db.getPreparedStatement(StatementKey, boolean, int, int, SqlSupplier).- Author:
- harald
-
Field Summary
Fields inherited from class StatementWrapper
canceled, con, openResultSet, parallelOk, ready, running, sql, stackTrace, stmt -
Constructor Summary
ConstructorsConstructorDescriptionPreparedStatementWrapper(ManagedConnection con, PreparedStatement stmt, StatementKey statementKey, String sql) Creates a wrapper for a prepared statement. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBatch()Adds a set of parameters to thisPreparedStatement's batch of commands.voidvoidEmpties thisStatementobject's current list of batched SQL commands.voidClears the current parameter values immediately.voidclose()Closes this statement.protected voiddetachSession(Db db) Detaches the given session from the connection.
Nothing happens if the session is no longer attached to the connection of this statement.int[]executeBatch(boolean finish) Submits a batch of commands.Executes the query.executeQuery(boolean withinTx) Executes the query.protected ResultSetexecuteQueryImpl(String sql) Implementation of executeQuery.intExecutes the update.intexecuteUpdate(String sql) Method must not be invoked on aPreparedStatementWrapper.protected intexecuteUpdateImpl(String sql) Implementation of executeUpdate.protected DbBatchgetBatch()Gets the statement batch.intGets the number of pending addBatch invocations.Gets the parameter map for a batched statement.intGets the column offset.Gets the parameter map.Gets the wrapped prepared statement.Gets the statement key.protected booleanReturns whether the statement is batched.booleanReturns whether parameters have been set so that execution is pending.protected booleanReturns whether marking this statement ready again while not consumed yet is allowed.
Invoked byStatementWrapper.markReady()with the monitor held.protected booleanReturns whether this is a one-shot statement.
One-shot statements are created and closed by the application, whereas cached statements are closed by the connection.protected voidrememberParameter(int p, Object value) Sets the parameter to be remembered for diagnostics.<T> intSets the object into the statement via itsDataType.
This method is provided for application-specific types.<T> voidSets a column of an object into a prepared statement via itsDataType.
This method is provided for application-specific types.voidGeneric setter for objects via knownSqlType.voidsetArray(int p, Class<?> type, int columnIndex, Collection<?> elements, String operator) Sets an array parameter.
Used for array operators such as IN, ANY or ALL.protected voidSets the statement batch if batched within the current transaction.voidsetBigDecimal(int p, BigDecimal d) Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidSets the designated parameter to the givenBinaryvalue.voidSets the designated parameter to aBMoneyvalue.
A BMoney will not be stored as a single field but as two fields: a double representing the value a short representing the scale This is because most DBMS can't store arbitrary scaled decimals in a single column, i.e., all values in the column must have the same scale.voidsetBoolean(int p, boolean b) Sets the designated parameter to the given Javabooleanvalue.voidsetBoolean(int p, Boolean b) Sets the designated parameter to the given JavaBooleanvalue.voidsetByte(int p, byte b) Sets the designated parameter to the given Javabytevalue.voidSets the designated parameter to the given JavaBytevalue.voidsetBytes(int p, byte[] b) Sets the designated parameter to the givenbyte[]value.voidsetChar(int p, char c) Sets the designated parameter to the given Javacharvalue.voidsetCharacter(int p, Character c) Sets the designated parameter to the given JavaCharactervalue.voidsetCharacter(int p, Character c, boolean mapNull) Sets the designated parameter to the given JavaCharactervalue.voidsetColumnOffset(int columnOffset) Sets the column offset.voidSets the designated parameter to the givenjava.sql.Datevalue using the default time zone of the virtual machine that is running the application.voidSets the designated parameter to the givenjava.sql.Datevalue using the default time zone of the virtual machine that is running the application.voidSets the designated parameter to the givenjava.sql.Datevalue using the time zone of the given calendar.voidSets the designated parameter to the givenjava.sql.Datevalue using the time zone of the given calendar.voidSets the designated parameter to aDMoneyvalue.
A DMoney will not be stored as a single field but as two fields: a BigDecimal with a scale of 0 representing the value a short representing the scale This is because most DBMS can't store arbitrary scaled decimals in a single column, i.e., all values in the column must have the same scale.voidsetDouble(int p, double d) Sets the designated parameter to the given Javadoublevalue.voidSets the designated parameter to the given JavaDoublevalue.voidsetFloat(int p, float f) Sets the designated parameter to the given Javafloatvalue.voidSets the designated parameter to the given JavaFloatvalue.voidsetInstant(int p, Instant ts) Sets the designated parameter to the givenjava.time.Instantvalue.voidsetInstant(int p, Instant ts, boolean mapNull) Sets the designated parameter to the givenjava.time.Instantvalue.voidsetInt(int p, int i) Sets the designated parameter to the given Javaintvalue.voidsetInteger(int p, Integer i) Sets the designated parameter to the given JavaIntegervalue.voidSets a string holding a JSON document.
This is usually converted to a native JSON column, or emulated asCLOB/VARCHAR.voidSets a string holding a JSON document.
This is usually converted to a native JSON column, or emulated asCLOB/VARCHAR.voidsetLargeString(int p, String s) Sets a very large string.
This is usually converted to SQLCLOB.voidsetLargeString(int p, String s, boolean mapNull) Sets a very large string.
This is usually converted to SQLCLOB.voidsetLocalDate(int p, LocalDate d) Sets the designated parameter to the givenjava.time.LocalDatevalue using the default time zone of the virtual machine that is running the application.voidsetLocalDate(int p, LocalDate d, boolean mapNull) Sets the designated parameter to the givenjava.time.LocalDatevalue using the default time zone of the virtual machine that is running the application.voidsetLocalDateTime(int p, LocalDateTime ts) Sets the designated parameter to the givenjava.time.LocalDateTimevalue.voidsetLocalDateTime(int p, LocalDateTime ts, boolean mapNull) Sets the designated parameter to the givenjava.time.LocalDateTimevalue.voidsetLocalTime(int p, LocalTime t) Sets the designated parameter to the givenjava.time.LocalTimevalue.voidsetLong(int p, long l) Sets the designated parameter to the given Javalongvalue.voidSets the designated parameter to the given JavaLongvalue.voidsetNull(int p, int type) Sets the designated parameter to SQLNULL.voidsetOffsetDateTime(int p, OffsetDateTime ts) Sets the designated parameter to the givenjava.time.OffsetDateTimevalue.voidsetOffsetDateTime(int p, OffsetDateTime ts, boolean mapNull) Sets the designated parameter to the givenjava.time.OffsetDateTimevalue.voidsetOffsetTime(int p, OffsetTime t) Sets the designated parameter to the givenjava.time.OffsetTimevalue.voidsetShort(int p, short s) Sets the designated parameter to the given Javashortvalue.voidSets the designated parameter to the given JavaShortvalue.voidSets a string bridged through the JDBCSQLXMLinterface.
This is usually converted to a native XML column, or emulated asCLOB/VARCHAR.voidSets a string bridged through the JDBCSQLXMLinterface.
This is usually converted to a native XML column, or emulated asCLOB/VARCHAR.voidSets the designated parameter to the given JavaStringvalue.voidSets the designated parameter to the given JavaStringvalue.voidsetTBinary(int p, TBinary<?> b) Sets the designated parameter to the givenTBinaryvalue.voidSets the designated parameter to the givenjava.sql.Timevalue.voidSets the designated parameter to the givenjava.sql.Timevalue.voidsetTimestamp(int p, Timestamp ts) Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetTimestamp(int p, Timestamp ts, boolean mapNull) Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetTimestamp(int p, Timestamp ts, Calendar timezone) Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetTimestamp(int p, Timestamp ts, Calendar timezone, boolean mapNull) Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetZonedDateTime(int p, ZonedDateTime ts) Sets the designated parameter to the givenjava.time.ZonedDateTimevalue.voidsetZonedDateTime(int p, ZonedDateTime ts, boolean mapNull) Sets the designated parameter to the givenjava.time.ZonedDateTimevalue.toString()Methods inherited from class StatementWrapper
assertNotReadOnly, assertOpen, cancel, consume, createResultSetWrapper, detachSession, executeQuery, executeQuery, forceDetached, forgetResultSetWrapper, getAttachedSession, getConnection, getExecutingSession, getFetchDirection, getFetchSize, getMaxRows, getSession, getSql, getStackTrace, getUsingSession, isCanceled, isClosed, isMarkedReady, isParallelOk, isRunning, markReady, setFetchDirection, setFetchSize, setMaxRows, setParallelOk, setRunning, setStackTrace, unmarkReady
-
Constructor Details
-
PreparedStatementWrapper
public PreparedStatementWrapper(ManagedConnection con, PreparedStatement stmt, StatementKey statementKey, String sql) Creates a wrapper for a prepared statement.- Parameters:
con- the connectionstmt- the jdbc statementstatementKey- the statement key if not a one-shotsql- the original SQL string that created the stmt
-
-
Method Details
-
toString
- Overrides:
toStringin classStatementWrapper
-
close
public void close()Description copied from class:StatementWrapperCloses this statement.- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classStatementWrapper
-
getStatement
Gets the wrapped prepared statement.- Overrides:
getStatementin classStatementWrapper- Returns:
- the prepared statement, null if closed
-
getStatementKey
-
isOneShot
protected boolean isOneShot()Description copied from class:StatementWrapperReturns whether this is a one-shot statement.
One-shot statements are created and closed by the application, whereas cached statements are closed by the connection.- Overrides:
isOneShotin classStatementWrapper- Returns:
- true if one-shot (default for non-prepared statements)
-
setColumnOffset
public void setColumnOffset(int columnOffset) Sets the column offset. Useful for eager loading or joining in general.- Parameters:
columnOffset- the offset added to the column index (default is 0)
-
getColumnOffset
public int getColumnOffset()Gets the column offset.- Returns:
- the current columnOffset
-
rememberParameter
Sets the parameter to be remembered for diagnostics.- Parameters:
p- the effective SQL positionvalue- the value of the parameter
-
detachSession
Description copied from class:StatementWrapperDetaches the given session from the connection.
Nothing happens if the session is no longer attached to the connection of this statement. This is the case if the session was force-detached while the statement was still in use, and the connection may have been attached to another session in the meantime, which must not be detached by this statement.- Overrides:
detachSessionin classStatementWrapper- Parameters:
db- the session that used this statement, null if already cleaned up
-
isMarkReadyAgainAllowed
protected boolean isMarkReadyAgainAllowed()Description copied from class:StatementWrapperReturns whether marking this statement ready again while not consumed yet is allowed.
Invoked byStatementWrapper.markReady()with the monitor held.- Overrides:
isMarkReadyAgainAllowedin classStatementWrapper- Returns:
- true if allowed, false if a programming error (default)
-
setBatch
Sets the statement batch if batched within the current transaction.- Parameters:
batch- the batch
-
getBatch
-
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
-
getBatchParameters
-
executeUpdateImpl
Implementation of executeUpdate.Overridden because sql-string isn't used.
- Overrides:
executeUpdateImplin classStatementWrapper- Parameters:
sql- the SQL string- Returns:
- the number of affected rows
- Throws:
SQLException- if the update failed
-
executeUpdate
public int executeUpdate()Executes the update.- Returns:
- the row count
-
executeUpdate
Method must not be invoked on aPreparedStatementWrapper.- Overrides:
executeUpdatein classStatementWrapper- Parameters:
sql- must be null, any non-null results in aPersistenceException- Returns:
- the row count
-
addBatch
- Overrides:
addBatchin classStatementWrapper- Parameters:
sql- ignored
-
addBatch
public void addBatch()Adds a set of parameters to thisPreparedStatement's batch of commands. -
clearBatch
public void clearBatch()Description copied from class:StatementWrapperEmpties thisStatementobject's current list of batched SQL commands.- Overrides:
clearBatchin classStatementWrapper
-
executeBatch
public int[] executeBatch(boolean finish) Description copied from class:StatementWrapperSubmits a batch of commands.- Overrides:
executeBatchin classStatementWrapper- 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
Implementation of executeQuery.Overridden because sql-string isn't used.
- Overrides:
executeQueryImplin classStatementWrapper- Parameters:
sql- the SQL string- Returns:
- the result set
- Throws:
SQLException- if the query failed
-
executeQuery
Executes the query.- Parameters:
withinTx- true to run the query within a transaction, committed when the result set is closed- Returns:
- the result set as a ResultSetWrapper
-
executeQuery
Executes the query.- Returns:
- the result set as a ResultSetWrapper
-
setNull
public void setNull(int p, int type) Description copied from interface:BackendPreparedStatementSets the designated parameter to SQLNULL.- Specified by:
setNullin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...type- the SQL type code defined injava.sql.Types
-
set
Description copied from interface:BackendPreparedStatementSets the object into the statement via itsDataType.
This method is provided for application-specific types.- Specified by:
setin interfaceBackendPreparedStatement- Type Parameters:
T- the type- Parameters:
dataType- the datatypep- the positional index, starting at 1object- the object of given datatypemapNull- true if map null valuessize- 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:BackendPreparedStatementSets a column of an object into a prepared statement via itsDataType.
This method is provided for application-specific types.- Specified by:
setin interfaceBackendPreparedStatement- Type Parameters:
T- the type- Parameters:
dataType- the datatypep- the positional index, starting at 1object- the object of given datatypeindex- the column indexmapNull- true if map null valuessize- the optional size from the model
-
set
Description copied from interface:BackendPreparedStatementGeneric setter for objects via knownSqlType.- Specified by:
setin interfaceBackendPreparedStatement- Parameters:
sqlType- the sql typep- the positional index, starting at 1object- the object of given sql type
-
setArray
public void setArray(int p, Class<?> type, int columnIndex, Collection<?> elements, String operator) Description copied from interface:BackendPreparedStatementSets an array parameter.
Used for array operators such as IN, ANY or ALL.- Specified by:
setArrayin interfaceBackendPreparedStatement- 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 ConvertiblecolumnIndex- the column index for multi-columnDataTypes, -1 if type is a Convertible, ignored otherwiseelements- the array elementsoperator- the array operator
-
setString
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaStringvalue. The driver converts this to an SQLVARCHARorLONGVARCHARvalue (depending on the argument's size relative to the driver's limits onVARCHARvalues) when it sends it to the database.- Specified by:
setStringin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...s- the parameter valuemapNull- true if null values should be mapped to the empty string, else SQL NULL
-
setString
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaStringvalue. The driver converts this to an SQLVARCHARorLONGVARCHARvalue (depending on the argument's size relative to the driver's limits onVARCHARvalues) when it sends it to the database.- Specified by:
setStringin interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets a very large string.
This is usually converted to SQLCLOB.- Specified by:
setLargeStringin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...s- the parameter valuemapNull- true if null values should be mapped to the empty string, else SQL NULL
-
setLargeString
Description copied from interface:BackendPreparedStatementSets a very large string.
This is usually converted to SQLCLOB.- Specified by:
setLargeStringin interfaceBackendPreparedStatement- 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
-
setSqlxml
Description copied from interface:BackendPreparedStatementSets a string bridged through the JDBCSQLXMLinterface.
This is usually converted to a native XML column, or emulated asCLOB/VARCHAR.- Specified by:
setSqlxmlin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...s- the parameter valuemapNull- true if null values should be mapped to the empty string, else SQL NULL. Ignored if the backend stores the value in a native XML column, since the empty string is not an XML document
-
setSqlxml
Description copied from interface:BackendPreparedStatementSets a string bridged through the JDBCSQLXMLinterface.
This is usually converted to a native XML column, or emulated asCLOB/VARCHAR.- Specified by:
setSqlxmlin interfaceBackendPreparedStatement- 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
-
setJson
Description copied from interface:BackendPreparedStatementSets a string holding a JSON document.
This is usually converted to a native JSON column, or emulated asCLOB/VARCHAR. Notice that the document is not validated by tentackle, and that a backend with a native type may normalize it.- Specified by:
setJsonin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...s- the parameter valuemapNull- true if null values should be mapped to the empty string, else SQL NULL. Ignored if the backend stores the value in a native JSON column, since the empty string is not a JSON document
-
setJson
Description copied from interface:BackendPreparedStatementSets a string holding a JSON document.
This is usually converted to a native JSON column, or emulated asCLOB/VARCHAR.- Specified by:
setJsonin interfaceBackendPreparedStatement- 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:BackendPreparedStatementSets the designated parameter to the given Javabooleanvalue. The driver converts this to an SQLBITorBOOLEANvalue when it sends it to the database.- Specified by:
setBooleanin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...b- the parameter value
-
setBoolean
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaBooleanvalue. The driver converts this to an SQLBITorBOOLEANvalue when it sends it to the database.- Specified by:
setBooleanin interfaceBackendPreparedStatement- 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:BackendPreparedStatementSets the designated parameter to the given Javabytevalue. The driver converts this to an SQLTINYINTvalue when it sends it to the database.- Specified by:
setBytein interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...b- the parameter value
-
setByte
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaBytevalue. The driver converts this to an SQLTINYINTvalue when it sends it to the database.- Specified by:
setBytein interfaceBackendPreparedStatement- 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:BackendPreparedStatementSets the designated parameter to the given Javacharvalue. The driver converts this to an SQLVARCHARwhen it sends it to the database.- Specified by:
setCharin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...c- the parameter value
-
setCharacter
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaCharactervalue. The driver converts this to an SQLVARCHARwhen it sends it to the database.- Specified by:
setCharacterin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...c- the parameter value, null if the value should be set to SQL NULLmapNull- true if null values should be mapped to BLANK, else SQL NULL
-
setCharacter
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaCharactervalue. The driver converts this to an SQLVARCHARwhen it sends it to the database.- Specified by:
setCharacterin interfaceBackendPreparedStatement- 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:BackendPreparedStatementSets the designated parameter to the given Javashortvalue. The driver converts this to an SQLSMALLINTvalue when it sends it to the database.- Specified by:
setShortin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...s- the parameter value
-
setShort
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaShortvalue. The driver converts this to an SQLSMALLINTvalue when it sends it to the database.- Specified by:
setShortin interfaceBackendPreparedStatement- 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:BackendPreparedStatementSets the designated parameter to the given Javaintvalue. The driver converts this to an SQLINTEGERvalue when it sends it to the database.- Specified by:
setIntin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...i- the parameter value
-
setInteger
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaIntegervalue. The driver converts this to an SQLINTEGERvalue when it sends it to the database.- Specified by:
setIntegerin interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.LocalDatevalue using the default time zone of the virtual machine that is running the application.- Specified by:
setLocalDatein interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...d- the parameter valuemapNull- true to map null values to 1.1.1970 (epochal time zero), else SQL NULL
-
setLocalDate
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.LocalDatevalue using the default time zone of the virtual machine that is running the application.- Specified by:
setLocalDatein interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.LocalDateTimevalue.- Specified by:
setLocalDateTimein interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.LocalDateTimevalue.- Specified by:
setLocalDateTimein interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...ts- the parameter valuemapNull- true to map null values to 1.1.1970 00:00:00.000 (epochal time zero), else SQL NULL
-
setOffsetDateTime
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.OffsetDateTimevalue.- Specified by:
setOffsetDateTimein interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.OffsetDateTimevalue.- Specified by:
setOffsetDateTimein interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...ts- the parameter valuemapNull- true to map null values to 1.1.1970 00:00:00.000 (epochal time zero), else SQL NULL
-
setZonedDateTime
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.ZonedDateTimevalue.- Specified by:
setZonedDateTimein interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.ZonedDateTimevalue.- Specified by:
setZonedDateTimein interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...ts- the parameter valuemapNull- true to map null values to 1.1.1970 00:00:00.000 GMT (epochal time zero), else SQL NULL
-
setInstant
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.Instantvalue.- Specified by:
setInstantin interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.Instantvalue.- Specified by:
setInstantin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...ts- the parameter valuemapNull- true to map null values to 1.1.1970 00:00:00.000 (epochal time zero), else SQL NULL
-
setLocalTime
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.LocalTimevalue.- Specified by:
setLocalTimein interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.time.OffsetTimevalue.- Specified by:
setOffsetTimein interfaceBackendPreparedStatement- 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:BackendPreparedStatementSets the designated parameter to the given Javalongvalue. The driver converts this to an SQLBIGINTvalue when it sends it to the database.- Specified by:
setLongin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...l- the parameter value
-
setLong
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaLongvalue. The driver converts this to an SQLBIGINTvalue when it sends it to the database.- Specified by:
setLongin interfaceBackendPreparedStatement- 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:BackendPreparedStatementSets the designated parameter to the given Javafloatvalue. The driver converts this to an SQLREALvalue when it sends it to the database.- Specified by:
setFloatin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...f- the parameter value
-
setFloat
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaFloatvalue. The driver converts this to an SQLREALvalue when it sends it to the database.- Specified by:
setFloatin interfaceBackendPreparedStatement- 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:BackendPreparedStatementSets the designated parameter to the given Javadoublevalue. The driver converts this to an SQLDOUBLEvalue when it sends it to the database.- Specified by:
setDoublein interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...d- the parameter value
-
setDouble
Description copied from interface:BackendPreparedStatementSets the designated parameter to the given JavaDoublevalue. The driver converts this to an SQLDOUBLEvalue when it sends it to the database.- Specified by:
setDoublein interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.math.BigDecimalvalue. The driver converts this to an SQLNUMERICvalue when it sends it to the database.- Specified by:
setBigDecimalin interfaceBackendPreparedStatement- 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
Sets the designated parameter to aBMoneyvalue.
A BMoney will not be stored as a single field but as two fields:- a double representing the value
- a short representing the scale
- Parameters:
p- the SQL positionm- the money value, null to set SQL NULL- See Also:
-
setDMoney
Sets the designated parameter to aDMoneyvalue.
A DMoney will not be stored as a single field but as two fields:- a BigDecimal with a scale of 0 representing the value
- a short representing the scale
- Parameters:
p- the SQL positionm- the money value, null to set SQL NULL- See Also:
-
setDate
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.sql.Datevalue using the time zone of the given calendar. The driver converts this to an SQLDATEvalue when it sends it to the database.- Specified by:
setDatein interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...d- the parameter valuetimezone- the calendar providing the timezone configurationmapNull- true to map null values to 1.1.1970 (epochal time zero), else SQL NULL
-
setDate
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.sql.Datevalue using the time zone of the given calendar. The driver converts this to an SQLDATEvalue when it sends it to the database.- Specified by:
setDatein interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...d- the parameter valuetimezone- the calendar providing the timezone configuration
-
setDate
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.sql.Datevalue using the default time zone of the virtual machine that is running the application. The driver converts this to an SQLDATEvalue when it sends it to the database.- Specified by:
setDatein interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...d- the parameter valuemapNull- true to map null values to 1.1.1970 (epochal time zero), else SQL NULL
-
setDate
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.sql.Datevalue using the default time zone of the virtual machine that is running the application. The driver converts this to an SQLDATEvalue when it sends it to the database.- Specified by:
setDatein interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue. The driver converts this to an SQLTIMESTAMPvalue when it sends it to the database.- Specified by:
setTimestampin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...ts- the parameter valuetimezone- the calendar providing the timezone configurationmapNull- true to map null values to 1.1.1970 00:00:00.000 (epochal time zero), else SQL NULL
-
setTimestamp
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue. The driver converts this to an SQLTIMESTAMPvalue when it sends it to the database.- Specified by:
setTimestampin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...ts- the parameter valuetimezone- the calendar providing the timezone configuration
-
setTimestamp
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue. The driver converts this to an SQLTIMESTAMPvalue when it sends it to the database.- Specified by:
setTimestampin interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...ts- the parameter valuemapNull- true to map null values to 1.1.1970 00:00:00.000 (epochal time zero), else SQL NULL
-
setTimestamp
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.sql.Timestampvalue. The driver converts this to an SQLTIMESTAMPvalue when it sends it to the database.- Specified by:
setTimestampin interfaceBackendPreparedStatement- 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
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.sql.Timevalue. The driver converts this to an SQLTIMEvalue when it sends it to the database.- Specified by:
setTimein interfaceBackendPreparedStatement- Parameters:
p- the first parameter is 1, the second is 2, ...t- the parameter value, null if the value should be set to SQL NULLtimezone- the calendar providing the timezone configuration
-
setTime
Description copied from interface:BackendPreparedStatementSets the designated parameter to the givenjava.sql.Timevalue. The driver converts this to an SQLTIMEvalue when it sends it to the database.- Specified by:
setTimein interfaceBackendPreparedStatement- 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
Sets the designated parameter to the givenBinaryvalue. The driver converts it to aBLOBvalue when it sends it to the database. The implementation translates the binary into an InputStream and invokesPreparedStatement.setBinaryStream(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 (an empty binary is stored as is)
-
setBytes
public void setBytes(int p, byte[] b) Sets the designated parameter to the givenbyte[]value. The bytes are stored "as is", i.e. an empty array is not treated as null.- 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
Sets the designated parameter to the givenTBinaryvalue. The driver converts it to aBLOBvalue when it sends it to the database. The implementation translates the binary into an InputStream and invokesPreparedStatement.setBinaryStream(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 (an empty binary is stored as is)
-