This commit is contained in:
zyyang 2021-02-20 15:19:02 +08:00
parent 9d773e1234
commit 2e2767c0ee
2 changed files with 14 additions and 2 deletions

View File

@ -109,6 +109,18 @@ public abstract class AbstractConnection extends WrapperImpl implements Connecti
public void setTransactionIsolation(int level) throws SQLException {
if (isClosed())
throw TSDBError.createSQLException(TSDBErrorNumbers.ERROR_CONNECTION_CLOSED);
switch (level) {
case Connection.TRANSACTION_NONE:
break;
case Connection.TRANSACTION_READ_UNCOMMITTED:
case Connection.TRANSACTION_READ_COMMITTED:
case Connection.TRANSACTION_REPEATABLE_READ:
case Connection.TRANSACTION_SERIALIZABLE:
throw new SQLFeatureNotSupportedException(TSDBConstants.UNSUPPORTED_METHOD_EXCEPTION_MSG);
default:
throw new SQLException(TSDBConstants.INVALID_VARIABLES);
}
//do nothing
}

View File

@ -122,6 +122,7 @@ public class TSDBConnectionTest {
@Test
public void getCatalog() throws SQLException {
conn.setCatalog("log");
Assert.assertEquals("log", conn.getCatalog());
}
@ -129,7 +130,6 @@ public class TSDBConnectionTest {
public void setTransactionIsolation() throws SQLException {
conn.setTransactionIsolation(Connection.TRANSACTION_NONE);
Assert.assertEquals(Connection.TRANSACTION_NONE, conn.getTransactionIsolation());
conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
}
@ -238,7 +238,7 @@ public class TSDBConnectionTest {
int status = rs.getInt("server_status()");
Assert.assertEquals(1, status);
conn.prepareStatement("select server_status", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
conn.prepareStatement("select server_status", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT);
}
@Test(expected = SQLFeatureNotSupportedException.class)