-
Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement
Milestone
Description
While switching from deprecated SqlLobValue to SqlBinaryValue we encountered the problem that SqlLobValue fails to pass content given as InputStream if the the size isn't specified accurately, although JDBC could principally process InputStream without a given length, as it is used by DefaultLobHandler$DefaultLobCreator#setBlobAsBinaryStream for content length lower zero.
Therefore SqlBinaryValue should be changed as follows to fix the problem:
/**
* Create a new {@code SqlBinaryValue} for the given content.
* @param stream the content stream
*/
public SqlBinaryValue(InputStream stream) {
this(stream, -1);
}
private void setInputStream(PreparedStatement ps, int paramIndex, int sqlType, InputStream is, long length)
throws SQLException {
if (length >= 0) {
if (sqlType == Types.BLOB) {
ps.setBlob(paramIndex, is, length);
}
else {
ps.setBinaryStream(paramIndex, is, length);
}
return;
}
if (sqlType == Types.BLOB) {
ps.setBlob(paramIndex, is);
}
else {
ps.setBinaryStream(paramIndex, is);
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in: dataIssues in data modules (jdbc, orm, oxm, tx)Issues in data modules (jdbc, orm, oxm, tx)status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement