spring-framework / org.springframework.jdbc.core / PreparedStatementCreatorFactory

PreparedStatementCreatorFactory

open class PreparedStatementCreatorFactory

Helper class that efficiently creates multiple PreparedStatementCreator objects with different parameters based on a SQL statement and a single set of parameter declarations.

Author
Rod Johnson

Author
Thomas Risberg

Author
Juergen Hoeller

Constructors

<init>

PreparedStatementCreatorFactory(sql: String)

Create a new factory. Will need to add parameters via the #addParameter method or have no parameters.

PreparedStatementCreatorFactory(sql: String, vararg types: Int)

Create a new factory with the given SQL and JDBC types.

PreparedStatementCreatorFactory(sql: String, declaredParameters: MutableList<SqlParameter>)

Create a new factory with the given SQL and parameters.

Functions

addParameter

open fun addParameter(param: SqlParameter): Unit

Add a new declared parameter.

Order of parameter addition is significant.

newPreparedStatementCreator

open fun newPreparedStatementCreator(params: MutableList<*>): PreparedStatementCreator
open fun newPreparedStatementCreator(params: Array<Any>): PreparedStatementCreator
open fun newPreparedStatementCreator(sqlToUse: String, params: Array<Any>): PreparedStatementCreator

Return a new PreparedStatementCreator for the given parameters.

newPreparedStatementSetter

open fun newPreparedStatementSetter(params: MutableList<*>): PreparedStatementSetter
open fun newPreparedStatementSetter(params: Array<Any>): PreparedStatementSetter

Return a new PreparedStatementSetter for the given parameters.

setGeneratedKeysColumnNames

open fun setGeneratedKeysColumnNames(vararg names: String): Unit

Set the column names of the auto-generated keys.

setResultSetType

open fun setResultSetType(resultSetType: Int): Unit

Set whether to use prepared statements that return a specific type of ResultSet.

setReturnGeneratedKeys

open fun setReturnGeneratedKeys(returnGeneratedKeys: Boolean): Unit

Set whether prepared statements should be capable of returning auto-generated keys.

setUpdatableResults

open fun setUpdatableResults(updatableResults: Boolean): Unit

Set whether to use prepared statements capable of returning updatable ResultSets.