public void testConvertResultSetToArray() { Connection connection = getJdbcConnection(); try { Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery("SELECT EMPNO, GENDER FROM EMP"); Object o = runQuery( "(select from resultSet as foo)", new OJStatement.Argument[] {new OJStatement.Argument("resultSet", resultSet)}); assertTrue(o instanceof Object[]); Object[] a = (Object[]) o; assertEquals(4, a.length); assertTrue(a[0] instanceof Row); Row row = (Row) a[0]; Object value = row.getObject(1); assertTrue(value instanceof Integer); assertEquals(100, ((Integer) value).intValue()); value = row.getObject(2); assertTrue(value instanceof String); assertEquals("M", value); } catch (SQLException e) { fail("received " + e); } }
public Statement createStatement() throws SQLException { return createTracingStatement(connection.createStatement(), pw); }