Class PreparedStatementHelper
- java.lang.Object
-
- org.linuxforhealth.fhir.database.utils.common.PreparedStatementHelper
-
public class PreparedStatementHelper extends java.lang.Object
Collection of utility functions to simply setting values on a PreparedStatement
-
-
Constructor Summary
Constructors Constructor Description PreparedStatementHelper(java.sql.PreparedStatement ps)
Public constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBatch()
Add a new batch entry based on the current state of thePreparedStatement
.int
registerOutParameter(int parameterType)
Register an OUT parameter, assuming the delegate is a CallableStatementPreparedStatementHelper
setBinaryStream(java.io.InputStream value)
Set the (possibly null) InputStream value at the current position and increment the position by 1PreparedStatementHelper
setInt(java.lang.Integer value)
Set the (possibly null) int value at the current position and increment the position by 1PreparedStatementHelper
setLong(java.lang.Long value)
Set the (possibly null) long value at the current position and increment the position by 1PreparedStatementHelper
setShort(java.lang.Short value)
Set the (possibly null) long value at the current position and increment the position by 1PreparedStatementHelper
setString(java.lang.String value)
Set the (possibly null) String value at the current position and increment the position by 1PreparedStatementHelper
setTimestamp(java.sql.Timestamp value)
Set the (possibly null) int value at the current position and increment the position by 1
-
-
-
Method Detail
-
setInt
public PreparedStatementHelper setInt(java.lang.Integer value) throws java.sql.SQLException
Set the (possibly null) int value at the current position and increment the position by 1- Parameters:
value
-- Returns:
- this instance
- Throws:
java.sql.SQLException
-
setLong
public PreparedStatementHelper setLong(java.lang.Long value) throws java.sql.SQLException
Set the (possibly null) long value at the current position and increment the position by 1- Parameters:
value
-- Returns:
- this instance
- Throws:
java.sql.SQLException
-
setShort
public PreparedStatementHelper setShort(java.lang.Short value) throws java.sql.SQLException
Set the (possibly null) long value at the current position and increment the position by 1- Parameters:
value
-- Returns:
- this instance
- Throws:
java.sql.SQLException
-
setString
public PreparedStatementHelper setString(java.lang.String value) throws java.sql.SQLException
Set the (possibly null) String value at the current position and increment the position by 1- Parameters:
value
-- Returns:
- this instance
- Throws:
java.sql.SQLException
-
setBinaryStream
public PreparedStatementHelper setBinaryStream(java.io.InputStream value) throws java.sql.SQLException
Set the (possibly null) InputStream value at the current position and increment the position by 1- Parameters:
value
-- Returns:
- this instance
- Throws:
java.sql.SQLException
-
setTimestamp
public PreparedStatementHelper setTimestamp(java.sql.Timestamp value) throws java.sql.SQLException
Set the (possibly null) int value at the current position and increment the position by 1- Parameters:
value
-- Returns:
- this instance
- Throws:
java.sql.SQLException
-
registerOutParameter
public int registerOutParameter(int parameterType) throws java.sql.SQLException
Register an OUT parameter, assuming the delegate is a CallableStatement- Parameters:
parameterType
- fromTypes
- Returns:
- the parameter index of the OUT parameter
- Throws:
java.sql.SQLException
-
addBatch
public void addBatch() throws java.sql.SQLException
Add a new batch entry based on the current state of thePreparedStatement
. Note that we don't return this on purpose...because addBatch should be last in any sequence of setXX(...) calls.- Throws:
java.sql.SQLException
-
-