Skip to content

Commit

Permalink
[CONJ-1150] adding test case for #190
Browse files Browse the repository at this point in the history
additionally, keeping StringCodec.INSTANCE in place of Parameter.NULL_PARAMETER for optimization in case of using batch instance (BULK operations send a packet each time parameter datatype change)
  • Loading branch information
rusher committed Jan 12, 2024
1 parent 2f9738f commit 5b2a40c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/main/java/org/mariadb/jdbc/BasePreparedStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -890,11 +890,7 @@ public void setNull(int parameterIndex, int sqlType, String typeName) throws SQL
@Override
public void setURL(int parameterIndex, URL x) throws SQLException {
checkIndex(parameterIndex);
if (x == null) {
parameters.set(parameterIndex - 1, Parameter.NULL_PARAMETER);
} else {
parameters.set(parameterIndex - 1, new Parameter<>(StringCodec.INSTANCE, x.toString()));
}
parameters.set(parameterIndex - 1, new Parameter<>(StringCodec.INSTANCE, x == null ? null : x.toString()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ public void checkParameters(org.mariadb.jdbc.Connection con, boolean text) throw
ps -> ps.setURL(1, new URL("https://www.someUrl.com")),
rs -> assertEquals("https://www.someUrl.com", rs.getString(1)),
con);
checkSendString(
ps -> ps.setURL(1, (URL) null),
rs -> assertNull(rs.getString(1)),
con);
// TODO SET OBJECT
}

Expand Down

0 comments on commit 5b2a40c

Please sign in to comment.