Class DefaultStatementBuilder

java.lang.Object
org.jdbi.v3.core.statement.DefaultStatementBuilder
All Implemented Interfaces:
StatementBuilder

public class DefaultStatementBuilder extends Object implements StatementBuilder
A StatementBuilder which will always create a new PreparedStatement.
  • Field Details Link icon

  • Constructor Details Link icon

    • DefaultStatementBuilder Link icon

      public DefaultStatementBuilder()
  • Method Details Link icon

    • create Link icon

      public Statement create(Connection conn, StatementContext ctx) throws SQLException
      Description copied from interface: StatementBuilder
      Called each time a statement needs to be created.
      Specified by:
      create in interface StatementBuilder
      Parameters:
      conn - the JDBC Connection the statement is being created for
      ctx - Statement context associated with the SqlStatement this is building for
      Returns:
      a Statement
      Throws:
      SQLException - if anything goes wrong getting the statement
    • create Link icon

      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 interface StatementBuilder
      Parameters:
      conn - Used to prepare the statement
      sql - Translated SQL statement
      ctx - Unused
      Returns:
      a new PreparedStatement
      Throws:
      SQLException - if anything goes wrong preparing the statement
    • close Link icon

      public void close(Connection conn, String sql, Statement stmt) throws SQLException
      Called to close an individual prepared statement created from this builder. In this case, it closes immediately.
      Specified by:
      close in interface StatementBuilder
      Parameters:
      conn - the JDBC Connection that this statement was created for.
      sql - the translated SQL which was prepared
      stmt - the statement
      Throws:
      SQLException - if anything goes wrong closing the statement
    • createCall Link icon

      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 interface StatementBuilder
      Parameters:
      conn - the JDBC Connection the statement is being created for
      sql - the translated SQL which should be prepared
      ctx - 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