1 package org.collectionspace.services.common.storage;
3 import java.sql.Connection;
4 import java.sql.PreparedStatement;
6 * Per http://stackoverflow.com/a/7127189
9 import java.sql.SQLException;
11 public class PreparedStatementBuilder
15 public PreparedStatementBuilder(final String sql) {
19 protected void preparePrepared(final PreparedStatement preparedStatement)
21 // This virtual method lets us declare how, when we generate our
22 // PreparedStatement, we want it to be set up.
24 // Note that at the time this method is overridden, the
25 // PreparedStatement has not yet been created.
28 public PreparedStatement build(final Connection conn)
31 // Fetch the PreparedStatement
32 final PreparedStatement returnable = conn.prepareStatement(sql);
33 // Perform setup directives
34 preparePrepared(returnable);