@Test(expected = SQLException.class) public void getCount_illegalQuery_shouldThrowSQLException() throws SQLException { FreeformQuery query = new FreeformQuery("SELECT * FROM asdf", Arrays.asList("ID"), connectionPool); query.getResults(0, 50); }
@Override @SuppressWarnings({ "deprecation", "finally" }) public ResultSet getResults(int offset, int pagelength) throws SQLException { ensureTransaction(); String query = queryString; if (delegate != null) { if (delegate instanceof FreeformStatementDelegate) { try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getQueryStatement(offset, pagelength); PreparedStatement pstmt = getConnection().prepareStatement( sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); return pstmt.executeQuery(); } catch (UnsupportedOperationException e) { } } try { query = delegate.getQueryString(offset, pagelength); } catch (UnsupportedOperationException e) { } } Statement statement = getConnection().createStatement(); ResultSet rs; try { rs = statement.executeQuery(query); } catch (SQLException e) { try { statement.close(); } finally { throw e; } } return rs; }
FreeformQuery extends AbstractTransactionalQuery implements
        QueryDelegate { @Override @SuppressWarnings({ "deprecation", "finally" }) public ResultSet getResults(int offset, int pagelength) throws SQLException { ensureTransaction(); String query = queryString; if (delegate != null) { if (delegate instanceof FreeformStatementDelegate) { try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getQueryStatement(offset, pagelength); PreparedStatement pstmt = getConnection().prepareStatement( sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); return pstmt.executeQuery(); } catch (UnsupportedOperationException e) { } } try { query = delegate.getQueryString(offset, pagelength); } catch (UnsupportedOperationException e) { } } Statement statement = getConnection().createStatement(); ResultSet rs; try { rs = statement.executeQuery(query); } catch (SQLException e) { try { statement.close(); } finally { throw e; } } return rs; } }
FreeformQuery extends AbstractTransactionalQuery implements
        QueryDelegate { @Override @SuppressWarnings({ "deprecation", "finally" }) public ResultSet getResults(int offset, int pagelength) throws SQLException { ensureTransaction(); String query = queryString; if (delegate != null) { if (delegate instanceof FreeformStatementDelegate) { try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getQueryStatement(offset, pagelength); PreparedStatement pstmt = getConnection().prepareStatement( sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); return pstmt.executeQuery(); } catch (UnsupportedOperationException e) { } } try { query = delegate.getQueryString(offset, pagelength); } catch (UnsupportedOperationException e) { } } Statement statement = getConnection().createStatement(); ResultSet rs; try { rs = statement.executeQuery(query); } catch (SQLException e) { try { statement.close(); } finally { throw e; } } return rs; } @SuppressWarnings("unused") private  FreeformQuery(); @Deprecated  FreeformQuery(String queryString, List<String> primaryKeyColumns,
            JDBCConnectionPool connectionPool);  FreeformQuery(String queryString, JDBCConnectionPool connectionPool,
            String... primaryKeyColumns); }
FreeformQuery extends AbstractTransactionalQuery implements
        QueryDelegate { @Override @SuppressWarnings({ "deprecation", "finally" }) public ResultSet getResults(int offset, int pagelength) throws SQLException { ensureTransaction(); String query = queryString; if (delegate != null) { if (delegate instanceof FreeformStatementDelegate) { try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getQueryStatement(offset, pagelength); PreparedStatement pstmt = getConnection().prepareStatement( sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); return pstmt.executeQuery(); } catch (UnsupportedOperationException e) { } } try { query = delegate.getQueryString(offset, pagelength); } catch (UnsupportedOperationException e) { } } Statement statement = getConnection().createStatement(); ResultSet rs; try { rs = statement.executeQuery(query); } catch (SQLException e) { try { statement.close(); } finally { throw e; } } return rs; } @SuppressWarnings("unused") private  FreeformQuery(); @Deprecated  FreeformQuery(String queryString, List<String> primaryKeyColumns,
            JDBCConnectionPool connectionPool);  FreeformQuery(String queryString, JDBCConnectionPool connectionPool,
            String... primaryKeyColumns); @Override int getCount(); @Override @SuppressWarnings({ "deprecation", "finally" }) ResultSet getResults(int offset, int pagelength); @Override @SuppressWarnings("deprecation") boolean implementationRespectsPagingLimits(); @Override void setFilters(List<Filter> filters); @Override void setOrderBy(List<OrderBy> orderBys); @Override int storeRow(RowItem row); @Override boolean removeRow(RowItem row); @Override synchronized void beginTransaction(); @Override synchronized void commit(); @Override synchronized void rollback(); @Override List<String> getPrimaryKeyColumns(); String getQueryString(); FreeformQueryDelegate getDelegate(); void setDelegate(FreeformQueryDelegate delegate); @Override @SuppressWarnings("deprecation") boolean containsRowWithKey(Object... keys); }
FreeformQuery extends AbstractTransactionalQuery implements
        QueryDelegate { @Override @SuppressWarnings({ "deprecation", "finally" }) public ResultSet getResults(int offset, int pagelength) throws SQLException { ensureTransaction(); String query = queryString; if (delegate != null) { if (delegate instanceof FreeformStatementDelegate) { try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getQueryStatement(offset, pagelength); PreparedStatement pstmt = getConnection().prepareStatement( sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); return pstmt.executeQuery(); } catch (UnsupportedOperationException e) { } } try { query = delegate.getQueryString(offset, pagelength); } catch (UnsupportedOperationException e) { } } Statement statement = getConnection().createStatement(); ResultSet rs; try { rs = statement.executeQuery(query); } catch (SQLException e) { try { statement.close(); } finally { throw e; } } return rs; } @SuppressWarnings("unused") private  FreeformQuery(); @Deprecated  FreeformQuery(String queryString, List<String> primaryKeyColumns,
            JDBCConnectionPool connectionPool);  FreeformQuery(String queryString, JDBCConnectionPool connectionPool,
            String... primaryKeyColumns); @Override int getCount(); @Override @SuppressWarnings({ "deprecation", "finally" }) ResultSet getResults(int offset, int pagelength); @Override @SuppressWarnings("deprecation") boolean implementationRespectsPagingLimits(); @Override void setFilters(List<Filter> filters); @Override void setOrderBy(List<OrderBy> orderBys); @Override int storeRow(RowItem row); @Override boolean removeRow(RowItem row); @Override synchronized void beginTransaction(); @Override synchronized void commit(); @Override synchronized void rollback(); @Override List<String> getPrimaryKeyColumns(); String getQueryString(); FreeformQueryDelegate getDelegate(); void setDelegate(FreeformQueryDelegate delegate); @Override @SuppressWarnings("deprecation") boolean containsRowWithKey(Object... keys);  }