Package org.jdbi.v3.core.statement
Class DefaultStatementBuilder
- java.lang.Object
-
- org.jdbi.v3.core.statement.DefaultStatementBuilder
-
- All Implemented Interfaces:
StatementBuilder
public class DefaultStatementBuilder extends java.lang.Object implements StatementBuilder
A StatementBuilder which will always create a new PreparedStatement.
-
-
Field Summary
Fields Modifier and Type Field Description static StatementBuilderFactoryFACTORY
-
Constructor Summary
Constructors Constructor Description DefaultStatementBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose(java.sql.Connection conn, java.lang.String sql, java.sql.Statement stmt)Called to close an individual prepared statement created from this builder.java.sql.PreparedStatementcreate(java.sql.Connection conn, java.lang.String sql, StatementContext ctx)Create a new DefaultStatementBuilder which will always create a new PreparedStatement from the Connectionjava.sql.Statementcreate(java.sql.Connection conn, StatementContext ctx)Called each time a statement needs to be created.java.sql.CallableStatementcreateCall(java.sql.Connection conn, java.lang.String sql, StatementContext ctx)Called each time a Callable statement needs to be created-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jdbi.v3.core.statement.StatementBuilder
close
-
-
-
-
Field Detail
-
FACTORY
public static final StatementBuilderFactory FACTORY
-
-
Method Detail
-
create
public java.sql.Statement create(java.sql.Connection conn, StatementContext ctx) throws java.sql.SQLExceptionDescription 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:
java.sql.SQLException- if anything goes wrong getting the statement
-
create
public java.sql.PreparedStatement create(java.sql.Connection conn, java.lang.String sql, StatementContext ctx) throws java.sql.SQLExceptionCreate 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:
java.sql.SQLException- if anything goes wrong preparing the statement
-
close
public void close(java.sql.Connection conn, java.lang.String sql, java.sql.Statement stmt) throws java.sql.SQLExceptionCalled to close an individual prepared statement created from this builder. In this case, it closes immediately.- Specified by:
closein interfaceStatementBuilder- Parameters:
sql- the translated SQL which was preparedstmt- the statementconn- the JDBC Connection that this statement was created for.- Throws:
java.sql.SQLException- if anything goes wrong closing the statement
-
createCall
public java.sql.CallableStatement createCall(java.sql.Connection conn, java.lang.String sql, StatementContext ctx) throws java.sql.SQLExceptionCalled 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:
java.sql.SQLException- if anything goes wrong preparing the statement
-
-