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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close
(Connection conn) No need to do anything on connection close.void
close
(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 created
-
Field Details
-
FACTORY
-
-
Constructor Details
-
DefaultStatementBuilder
public DefaultStatementBuilder()
-
-
Method Details
-
create
Description copied from interface:StatementBuilder
Called each time a statement needs to be created.- Specified by:
create
in 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:
create
in 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:
close
in interfaceStatementBuilder
- Parameters:
sql
- the translated SQL which was preparedstmt
- the statementconn
- the connection to close- Throws:
SQLException
- if anything goes wrong closing the statement
-
close
No need to do anything on connection close.- Specified by:
close
in interfaceStatementBuilder
- Parameters:
conn
- the connection to close.
-
createCall
public CallableStatement createCall(Connection conn, String sql, StatementContext ctx) throws SQLException Called each time a Callable statement needs to be created- Specified by:
createCall
in 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
-