@Test public void testPrepareStatementEmptyValues() throws Exception { final ExpectProxy<Connection> tpc = new ExpectProxy<Connection>(); final ExpectProxy<PreparedStatement> tps = new ExpectProxy<PreparedStatement>(); final PreparedStatement xps = tps.getProxy(PreparedStatement.class); tpc.expectAndReturn("prepareStatement", xps); DatabaseConnection dbc = new DatabaseConnection(tpc.getProxy(Connection.class)); dbc.prepareStatement(TEST_SQL_STATEMENT, new ArrayList<SQLParam>()); assertTrue("statement created", tpc.isDone()); assertTrue("value binded", tps.isDone()); }
public PreparedStatement prepareStatement(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("prepareStatement: statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final PreparedStatement prepareStatement = getConnection().prepareStatement(nomalized); SQLUtil.setParams(prepareStatement, out); LOG.ok("prepareStatement: normalizzed statement {0} prepared", nomalized); return prepareStatement; }
DatabaseConnection { public PreparedStatement prepareStatement(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("prepareStatement: statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final PreparedStatement prepareStatement = getConnection().prepareStatement(nomalized); SQLUtil.setParams(prepareStatement, out); LOG.ok("prepareStatement: normalizzed statement {0} prepared", nomalized); return prepareStatement; } }
DatabaseConnection { public PreparedStatement prepareStatement(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("prepareStatement: statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final PreparedStatement prepareStatement = getConnection().prepareStatement(nomalized); SQLUtil.setParams(prepareStatement, out); LOG.ok("prepareStatement: normalizzed statement {0} prepared", nomalized); return prepareStatement; } DatabaseConnection();  DatabaseConnection(final Connection conn); }
DatabaseConnection { public PreparedStatement prepareStatement(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("prepareStatement: statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final PreparedStatement prepareStatement = getConnection().prepareStatement(nomalized); SQLUtil.setParams(prepareStatement, out); LOG.ok("prepareStatement: normalizzed statement {0} prepared", nomalized); return prepareStatement; } DatabaseConnection();  DatabaseConnection(final Connection conn); @SuppressWarnings("deprecation") void dispose(); void test(); Connection getConnection(); void setConnection(final Connection connection); PreparedStatement prepareStatement(final String sql, final List<SQLParam> params); PreparedStatement prepareStatement(DatabaseQueryBuilder query); CallableStatement prepareCall(final String sql, final List<SQLParam> params); void commit(); }
DatabaseConnection { public PreparedStatement prepareStatement(final String sql, final List<SQLParam> params) throws SQLException { LOG.ok("prepareStatement: statement {0}", sql); final List<SQLParam> out = new ArrayList<SQLParam>(); final String nomalized = SQLUtil.normalizeNullValues(sql, params, out); final PreparedStatement prepareStatement = getConnection().prepareStatement(nomalized); SQLUtil.setParams(prepareStatement, out); LOG.ok("prepareStatement: normalizzed statement {0} prepared", nomalized); return prepareStatement; } DatabaseConnection();  DatabaseConnection(final Connection conn); @SuppressWarnings("deprecation") void dispose(); void test(); Connection getConnection(); void setConnection(final Connection connection); PreparedStatement prepareStatement(final String sql, final List<SQLParam> params); PreparedStatement prepareStatement(DatabaseQueryBuilder query); CallableStatement prepareCall(final String sql, final List<SQLParam> params); void commit();  }