SOLR-8810: Implement Connection.setReadOnly, Statement.set/getFetchSize, ResultSet.getType

This commit is contained in:
Kevin Risden 2016-03-23 17:02:05 -05:00
parent 97b6270337
commit a0da40204a
5 changed files with 17 additions and 5 deletions

View File

@ -495,6 +495,9 @@ Other Changes
* SOLR-8819: Implement DatabaseMetaDataImpl getTables() and fix getSchemas(). (Trey Cahill, * SOLR-8819: Implement DatabaseMetaDataImpl getTables() and fix getSchemas(). (Trey Cahill,
Joel Bernstein, Kevin Risden) Joel Bernstein, Kevin Risden)
* SOLR-8810: Implement Connection.setReadOnly, Statement.set/getFetchSize,
ResultSet.getType (Kevin Risden)
================== 5.5.1 ================== ================== 5.5.1 ==================
Bug Fixes Bug Fixes

View File

@ -152,7 +152,7 @@ class ConnectionImpl implements Connection {
@Override @Override
public void setReadOnly(boolean readOnly) throws SQLException { public void setReadOnly(boolean readOnly) throws SQLException {
throw new UnsupportedOperationException();
} }
@Override @Override

View File

@ -560,7 +560,7 @@ class ResultSetImpl implements ResultSet {
@Override @Override
public int getType() throws SQLException { public int getType() throws SQLException {
throw new UnsupportedOperationException(); return ResultSet.TYPE_FORWARD_ONLY;
} }
@Override @Override

View File

@ -26,7 +26,6 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.Random; import java.util.Random;
@ -240,12 +239,12 @@ class StatementImpl implements Statement {
@Override @Override
public void setFetchSize(int rows) throws SQLException { public void setFetchSize(int rows) throws SQLException {
throw new UnsupportedOperationException();
} }
@Override @Override
public int getFetchSize() throws SQLException { public int getFetchSize() throws SQLException {
throw new UnsupportedOperationException(); return 0;
} }
@Override @Override

View File

@ -492,6 +492,10 @@ public class JdbcTest extends AbstractFullDistribZkTestBase {
assertFalse(rs.next()); assertFalse(rs.next());
} }
assertTrue(con.isReadOnly());
con.setReadOnly(true);
assertTrue(con.isReadOnly());
assertNull(con.getWarnings()); assertNull(con.getWarnings());
con.clearWarnings(); con.clearWarnings();
assertNull(con.getWarnings()); assertNull(con.getWarnings());
@ -503,6 +507,10 @@ public class JdbcTest extends AbstractFullDistribZkTestBase {
statement.clearWarnings(); statement.clearWarnings();
assertNull(statement.getWarnings()); assertNull(statement.getWarnings());
assertEquals(0, statement.getFetchSize());
statement.setFetchSize(0);
assertEquals(0, statement.getFetchSize());
try (ResultSet rs = statement.executeQuery(sql)) { try (ResultSet rs = statement.executeQuery(sql)) {
assertEquals(statement, rs.getStatement()); assertEquals(statement, rs.getStatement());
@ -564,6 +572,8 @@ public class JdbcTest extends AbstractFullDistribZkTestBase {
} }
private void checkResultSet(ResultSet rs) throws Exception { private void checkResultSet(ResultSet rs) throws Exception {
assertEquals(ResultSet.TYPE_FORWARD_ONLY, rs.getType());
assertNull(rs.getWarnings()); assertNull(rs.getWarnings());
rs.clearWarnings(); rs.clearWarnings();
assertNull(rs.getWarnings()); assertNull(rs.getWarnings());