@Test public void testBindValue_empty() throws Exception { Connection conn = new MockConnection(); PreparedStatement ps = conn .prepareStatement("select * from a where b = ?"); BlobType blobType = new BlobType(); blobType.bindValue(ps, 1, ""); }
public void bindValue(PreparedStatement ps, int index, String value) throws SQLException { if (value == null) { ps.setNull(index, Types.BLOB); } else if (value.length() == 0) { ps.setBinaryStream(index, new ByteArrayInputStream(EMPTY_BYTES), 0); } else { byte[] bytes = Base64Util.decode(value); ps.setBinaryStream(index, new ByteArrayInputStream(bytes), bytes.length); } }
BlobType extends AbstractSqlType { public void bindValue(PreparedStatement ps, int index, String value) throws SQLException { if (value == null) { ps.setNull(index, Types.BLOB); } else if (value.length() == 0) { ps.setBinaryStream(index, new ByteArrayInputStream(EMPTY_BYTES), 0); } else { byte[] bytes = Base64Util.decode(value); ps.setBinaryStream(index, new ByteArrayInputStream(bytes), bytes.length); } } }
BlobType extends AbstractSqlType { public void bindValue(PreparedStatement ps, int index, String value) throws SQLException { if (value == null) { ps.setNull(index, Types.BLOB); } else if (value.length() == 0) { ps.setBinaryStream(index, new ByteArrayInputStream(EMPTY_BYTES), 0); } else { byte[] bytes = Base64Util.decode(value); ps.setBinaryStream(index, new ByteArrayInputStream(bytes), bytes.length); } } BlobType();  BlobType(String dataType); }
BlobType extends AbstractSqlType { public void bindValue(PreparedStatement ps, int index, String value) throws SQLException { if (value == null) { ps.setNull(index, Types.BLOB); } else if (value.length() == 0) { ps.setBinaryStream(index, new ByteArrayInputStream(EMPTY_BYTES), 0); } else { byte[] bytes = Base64Util.decode(value); ps.setBinaryStream(index, new ByteArrayInputStream(bytes), bytes.length); } } BlobType();  BlobType(String dataType); void bindValue(PreparedStatement ps, int index, String value); String getValue(ResultSet resultSet, int index); }
BlobType extends AbstractSqlType { public void bindValue(PreparedStatement ps, int index, String value) throws SQLException { if (value == null) { ps.setNull(index, Types.BLOB); } else if (value.length() == 0) { ps.setBinaryStream(index, new ByteArrayInputStream(EMPTY_BYTES), 0); } else { byte[] bytes = Base64Util.decode(value); ps.setBinaryStream(index, new ByteArrayInputStream(bytes), bytes.length); } } BlobType();  BlobType(String dataType); void bindValue(PreparedStatement ps, int index, String value); String getValue(ResultSet resultSet, int index);  }