Skip to content

Commit

Permalink
[misc] code coverage improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Oct 10, 2024
1 parent 3df9916 commit f7fc6aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 0 additions & 9 deletions src/main/java/org/mariadb/jdbc/BasePreparedStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,6 @@ public void updateMeta(ColumnDecoder[] ci) {

public abstract ParameterMetaData getParameterMetaData() throws SQLException;

/**
* Set all parameters
*
* @param parameters parameters
*/
public void setParameters(Parameters parameters) {
this.parameters = parameters;
}

/**
* Set parameter
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@ private void sendParam(Connection con) throws SQLException {
prep.execute();
prep.setObject(1, 2L);
prep.execute();
prep.setObject(1, 3L, Types.DECIMAL);
prep.execute();
prep.setObject(1, BigInteger.TEN);
prep.execute();
prep.setObject(1, null);
Expand All @@ -985,6 +987,7 @@ private void sendParam(Connection con) throws SQLException {
prep.execute();
prep.setObject(1, null, Types.BIGINT);
prep.execute();
assertThrowsContains(SQLSyntaxErrorException.class, () -> prep.setObject(1, 3L, Types.BLOB), "Could not convert");
}
ResultSet rs =
con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE)
Expand All @@ -1000,6 +1003,7 @@ private void sendParam(Connection con) throws SQLException {
rs.updateLong("t1", 60L);
rs.updateRow();
assertEquals(60L, rs.getLong(2));
assertTrue(rs.next());

assertTrue(rs.next());
assertEquals(10, rs.getLong(2));
Expand Down Expand Up @@ -1044,6 +1048,7 @@ private void sendParam(Connection con) throws SQLException {

assertTrue(rs.next());
assertEquals(60L, rs.getLong(2));
assertTrue(rs.next());

assertTrue(rs.next());
assertEquals(0L, rs.getLong(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,8 @@ private void sendParam(Connection con) throws SQLException {
prep.execute();
prep.setObject(1, "e🌟2");
prep.execute();
prep.setObject(1, '0', Types.BOOLEAN);
prep.execute();
prep.setObject(1, null);
prep.execute();
prep.setObject(1, "e🌟3", Types.VARCHAR);
Expand All @@ -922,6 +924,9 @@ private void sendParam(Connection con) throws SQLException {
prep.execute();
prep.setNString(1, "e🌟12");
prep.execute();
assertThrowsContains(SQLSyntaxErrorException.class, () -> prep.setObject(1, "e🌟12", Types.BLOB), "Cannot convert");
assertThrowsContains(SQLSyntaxErrorException.class, () -> prep.setObject(1, "e🌟12", Types.OTHER), "Could not convert");

}

ResultSet rs =
Expand All @@ -945,6 +950,7 @@ private void sendParam(Connection con) throws SQLException {
rs.updateString(2, null);
rs.updateRow();
assertNull(rs.getString(2));
assertTrue(rs.next());

assertTrue(rs.next());
assertNull(rs.getString(2));
Expand Down Expand Up @@ -1020,6 +1026,7 @@ private void sendParam(Connection con) throws SQLException {
assertTrue(rs.next());
assertNull(rs.getString(2));

assertTrue(rs.next());
assertTrue(rs.next());
assertEquals("f🌟12", rs.getString(2));

Expand Down

0 comments on commit f7fc6aa

Please sign in to comment.