Search in sources :

Example 1 with CallableStatementWrapper

use of com.mysql.cj.jdbc.CallableStatementWrapper in project aws-mysql-jdbc by awslabs.

the class CallableStatementTest method testClosedWrapper.

@SuppressWarnings("deprecation")
@Test
public void testClosedWrapper() throws Exception {
    String sql = "SELECT 1";
    int autoGeneratedKeys = 0;
    int[] columnIndexes = new int[] { 0 };
    String[] columnNames = new String[] { "f1" };
    int parameterIndex = 1;
    String parameterName = "p1";
    Calendar cal = new GregorianCalendar();
    Map<String, Class<?>> typeMap = new HashMap<>();
    typeMap.put("1", String.class);
    int scale = 3;
    String typeName = String.class.getName();
    InputStream istr = new InputStream() {

        @Override
        public int read() throws IOException {
            return 0;
        }
    };
    Reader reader = new StringReader(sql);
    MysqlPooledConnection con = new MysqlPooledConnection((JdbcConnection) this.conn);
    CallableStatementWrapper w = new CallableStatementWrapper(new ConnectionWrapper(con, (JdbcConnection) this.conn, false), con, null);
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.addBatch();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.addBatch(sql);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.cancel();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.clearBatch();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.clearParameters();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.clearWarnings();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.closeOnCompletion();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.enableStreamingResults();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.execute();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.execute("SELECT 1");
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.execute(sql, autoGeneratedKeys);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.execute(sql, columnIndexes);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.execute(sql, columnNames);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeBatch();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeLargeBatch();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeLargeUpdate();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeLargeUpdate(sql);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeLargeUpdate(sql, autoGeneratedKeys);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeLargeUpdate(sql, columnIndexes);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeLargeUpdate(sql, columnNames);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeQuery();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeQuery(sql);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeUpdate();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeUpdate(sql);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeUpdate(sql, autoGeneratedKeys);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeUpdate(sql, columnIndexes);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.executeUpdate(sql, columnNames);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getArray(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getArray(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getBigDecimal(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getBigDecimal(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getBigDecimal(parameterIndex, 10);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getBlob(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getBlob(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getBoolean(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getBoolean(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getByte(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getByte(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getBytes(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getCharacterStream(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getCharacterStream(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getClob(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getClob(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getDate(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getDate(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getDate(parameterIndex, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getDate(parameterName, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getDouble(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getDouble(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getFloat(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getFloat(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getInt(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getInt(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getLong(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getLong(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getNCharacterStream(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getNCharacterStream(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getNClob(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getNClob(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getNString(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getNString(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getObject(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getObject(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getObject(parameterIndex, String.class);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getObject(parameterName, String.class);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getObject(parameterIndex, typeMap);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getObject(parameterName, typeMap);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getParameterMetaData();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getQueryTimeout();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getRef(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getRef(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getResultSet();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getResultSetConcurrency();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getResultSetHoldability();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getResultSetType();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getRowId(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getRowId(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getShort(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getShort(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getSQLXML(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getSQLXML(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getString(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getString(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getTime(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getTime(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getTime(parameterIndex, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getTime(parameterName, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getTimestamp(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getTimestamp(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getTimestamp(parameterIndex, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getTimestamp(parameterName, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getUpdateCount();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getURL(parameterIndex);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getURL(parameterName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getWarnings();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getConnection();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getFetchDirection();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getFetchSize();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getGeneratedKeys();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getLargeMaxRows();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getLargeUpdateCount();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getMaxFieldSize();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getMaxRows();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getMetaData();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getMoreResults();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.getMoreResults(0);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.isClosed();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.isCloseOnCompletion();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.isPoolable();
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterIndex, Types.VARCHAR);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterIndex, MysqlType.VARCHAR);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterName, Types.VARCHAR);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterName, MysqlType.VARCHAR);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterIndex, Types.VARCHAR, scale);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterIndex, MysqlType.VARCHAR, scale);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterIndex, Types.VARCHAR, typeName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterIndex, MysqlType.VARCHAR, typeName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterName, Types.VARCHAR, scale);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterName, Types.VARCHAR, typeName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterName, MysqlType.VARCHAR, scale);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.registerOutParameter(parameterName, MysqlType.VARCHAR, typeName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setArray(parameterIndex, (java.sql.Array) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setAsciiStream(parameterIndex, istr);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setAsciiStream(parameterName, istr);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setAsciiStream(parameterIndex, istr, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setAsciiStream(parameterIndex, istr, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setAsciiStream(parameterName, istr, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setAsciiStream(parameterName, istr, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBigDecimal(parameterIndex, BigDecimal.valueOf(1L));
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBigDecimal(parameterName, BigDecimal.valueOf(1L));
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBinaryStream(parameterIndex, istr);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBinaryStream(parameterName, istr);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBinaryStream(parameterIndex, istr, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBinaryStream(parameterIndex, istr, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBinaryStream(parameterName, istr, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBinaryStream(parameterName, istr, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBlob(parameterIndex, (Blob) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBlob(parameterIndex, istr);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBlob(parameterName, (Blob) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBlob(parameterName, istr);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBlob(parameterIndex, istr, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBlob(parameterName, istr, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBoolean(parameterIndex, true);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBoolean(parameterName, true);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setByte(parameterIndex, (byte) 0);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setByte(parameterName, (byte) 0);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBytes(parameterIndex, (byte[]) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setBytes(parameterName, (byte[]) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setCharacterStream(parameterIndex, reader);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setCharacterStream(parameterName, reader);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setCharacterStream(parameterIndex, reader, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setCharacterStream(parameterIndex, reader, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setCharacterStream(parameterName, reader, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setCharacterStream(parameterName, reader, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setClob(parameterIndex, (Clob) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setClob(parameterIndex, reader);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setClob(parameterName, (Clob) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setClob(parameterName, reader);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setClob(parameterIndex, reader, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setClob(parameterName, reader, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setCursorName("qqq");
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setDate(parameterIndex, (Date) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setDate(parameterName, (Date) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setDate(parameterIndex, (Date) null, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setDate(parameterName, (Date) null, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setDouble(parameterIndex, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setDouble(parameterName, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setEscapeProcessing(true);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setFetchDirection(ResultSet.FETCH_FORWARD);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setFetchSize(1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setFloat(parameterIndex, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setFloat(parameterName, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setInt(parameterIndex, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setInt(parameterName, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setLargeMaxRows(1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setLong(parameterIndex, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setLong(parameterName, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setMaxFieldSize(1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setMaxRows(1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNCharacterStream(parameterIndex, reader);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNCharacterStream(parameterName, reader);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNCharacterStream(parameterIndex, reader, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNCharacterStream(parameterName, reader, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNClob(parameterIndex, (NClob) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNClob(parameterIndex, reader);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNClob(parameterName, (NClob) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNClob(parameterName, reader);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNClob(parameterIndex, reader, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNClob(parameterName, reader, 1L);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNString(parameterIndex, "");
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNString(parameterName, "");
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNull(parameterIndex, Types.VARCHAR);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNull(parameterName, Types.VARCHAR);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNull(parameterIndex, Types.VARCHAR, typeName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setNull(parameterName, Types.VARCHAR, typeName);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setObject(parameterIndex, (Object) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setObject(parameterName, (Object) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setObject(parameterIndex, (Object) null, Types.VARCHAR);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setObject(parameterIndex, (Object) null, MysqlType.VARCHAR);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setObject(parameterName, (Object) null, Types.VARCHAR);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setObject(parameterName, (Object) null, MysqlType.VARCHAR);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setObject(parameterIndex, (Object) null, Types.VARCHAR, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setObject(parameterIndex, (Object) null, MysqlType.VARCHAR, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setObject(parameterName, (Object) null, Types.VARCHAR, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setObject(parameterName, (Object) null, MysqlType.VARCHAR, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setPoolable(true);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setQueryTimeout(5);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setRef(parameterIndex, (Ref) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setRowId(parameterIndex, (RowId) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setRowId(parameterName, (RowId) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setShort(parameterIndex, (short) 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setShort(parameterName, (short) 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setSQLXML(parameterIndex, (SQLXML) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setSQLXML(parameterName, (SQLXML) null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setString(parameterIndex, "");
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setString(parameterName, "");
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setTime(parameterIndex, null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setTime(parameterName, null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setTime(parameterIndex, null, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setTime(parameterName, null, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setTimestamp(parameterIndex, null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setTimestamp(parameterName, null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setTimestamp(parameterIndex, null, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setTimestamp(parameterName, null, cal);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setUnicodeStream(parameterIndex, istr, 1);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setURL(parameterIndex, null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.setURL(parameterName, null);
            return null;
        }
    });
    assertThrows(SQLException.class, "No operations allowed after statement closed.", new Callable<Void>() {

        public Void call() throws Exception {
            w.wasNull();
            return null;
        }
    });
    w.close();
}
Also used : NClob(java.sql.NClob) RowId(java.sql.RowId) HashMap(java.util.HashMap) Reader(java.io.Reader) StringReader(java.io.StringReader) JdbcConnection(com.mysql.cj.jdbc.JdbcConnection) CallableStatementWrapper(com.mysql.cj.jdbc.CallableStatementWrapper) StringReader(java.io.StringReader) ConnectionWrapper(com.mysql.cj.jdbc.ConnectionWrapper) MysqlPooledConnection(com.mysql.cj.jdbc.MysqlPooledConnection) Blob(java.sql.Blob) InputStream(java.io.InputStream) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) GregorianCalendar(java.util.GregorianCalendar) SQLException(java.sql.SQLException) IOException(java.io.IOException) Date(java.sql.Date) Ref(java.sql.Ref) SQLXML(java.sql.SQLXML) NClob(java.sql.NClob) Clob(java.sql.Clob) Test(org.junit.jupiter.api.Test)

Aggregations

CallableStatementWrapper (com.mysql.cj.jdbc.CallableStatementWrapper)1 ConnectionWrapper (com.mysql.cj.jdbc.ConnectionWrapper)1 JdbcConnection (com.mysql.cj.jdbc.JdbcConnection)1 MysqlPooledConnection (com.mysql.cj.jdbc.MysqlPooledConnection)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1 Blob (java.sql.Blob)1 Clob (java.sql.Clob)1 Date (java.sql.Date)1 NClob (java.sql.NClob)1 Ref (java.sql.Ref)1 RowId (java.sql.RowId)1 SQLException (java.sql.SQLException)1 SQLXML (java.sql.SQLXML)1 Calendar (java.util.Calendar)1 GregorianCalendar (java.util.GregorianCalendar)1 HashMap (java.util.HashMap)1 Test (org.junit.jupiter.api.Test)1