mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-18 07:34:19 +01:00
feat(jdbc): implements setAsciiStream, setBinaryStream methods (int, InputStream, long)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user