Package org.jdbi.v3.core.statement
Class DefaultStatementBuilder
java.lang.Object
org.jdbi.v3.core.statement.DefaultStatementBuilder
- All Implemented Interfaces:
StatementBuilder
A StatementBuilder which will always create a new PreparedStatement.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(Connection conn, String sql, Statement stmt) Called to close an individual prepared statement created from this builder.create(Connection conn, String sql, StatementContext ctx) Create a new DefaultStatementBuilder which will always create a new PreparedStatement from the Connectioncreate(Connection conn, StatementContext ctx) Called each time a statement needs to be created.createCall(Connection conn, String sql, StatementContext ctx) Called each time a Callable statement needs to be createdMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jdbi.v3.core.statement.StatementBuilder
close
-
Field Details
-
FACTORY
-
-
Constructor Details
-
DefaultStatementBuilder
public DefaultStatementBuilder()
-
-
Method Details
-
create
Description copied from interface:StatementBuilderCalled each time a statement needs to be created.- Specified by:
createin interfaceStatementBuilder- Parameters:
conn- the JDBC Connection the statement is being created forctx- Statement context associated with the SqlStatement this is building for- Returns:
- a Statement
- Throws:
SQLException- if anything goes wrong getting the statement
-
create
public PreparedStatement create(Connection conn, String sql, StatementContext ctx) throws SQLException Create a new DefaultStatementBuilder which will always create a new PreparedStatement from the Connection- Specified by:
createin interfaceStatementBuilder- Parameters:
conn- Used to prepare the statementsql- Translated SQL statementctx- Unused- Returns:
- a new PreparedStatement
- Throws:
SQLException- if anything goes wrong preparing the statement
-
close
Called to close an individual prepared statement created from this builder. In this case, it closes immediately.- Specified by:
closein interfaceStatementBuilder- Parameters:
conn- the JDBC Connection that this statement was created for.sql- the translated SQL which was preparedstmt- the statement- Throws:
SQLException- if anything goes wrong closing the statement
-
createCall
public CallableStatement createCall(Connection conn, String sql, StatementContext ctx) throws SQLException Called each time a Callable statement needs to be created- Specified by:
createCallin interfaceStatementBuilder- Parameters:
conn- the JDBC Connection the statement is being created forsql- the translated SQL which should be preparedctx- Statement context associated with the SqlStatement this is building for- Returns:
- a CallableStatement for the given arguments
- Throws:
SQLException- if anything goes wrong preparing the statement
-