feat(jdbc): implements setAsciiStream, setBinaryStream methods (int, InputStream, long)

This commit is contained in:
Orange flavored banana
2025-11-12 13:51:41 +09:00
parent dad7feffca
commit fe16786038

View File

@@ -22,6 +22,7 @@ import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
@@ -435,12 +436,14 @@ public final class JDBC4PreparedStatement extends JDBC4Statement implements Prep
@Override
public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException {
// TODO
requireLengthIsPositiveInt(length);
setAsciiStream(parameterIndex, x, (int) length);
}
@Override
public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException {
// TODO
requireLengthIsPositiveInt(length);
setBinaryStream(parameterIndex, x, (int) length);
}
@Override
@@ -449,6 +452,13 @@ public final class JDBC4PreparedStatement extends JDBC4Statement implements Prep
// TODO
}
private void requireLengthIsPositiveInt(long length) throws SQLFeatureNotSupportedException {
if (length > Integer.MAX_VALUE || length < 0) {
throw new SQLFeatureNotSupportedException(
"Data must have a length between 0 and Integer.MAX_VALUE");
}
}
@Override
public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException {
// TODO