@Test public void containsRowWithKeys_simpleQueryWithNonexistingKeys_returnsTrue() throws SQLException { FreeformQuery query = new FreeformQuery("SELECT * FROM people", Arrays.asList("ID"), connectionPool); Assert.assertFalse(query.containsRowWithKey(1337)); }
@Override @SuppressWarnings("deprecation") public boolean containsRowWithKey(Object... keys) throws SQLException { String query = null; boolean contains = false; if (delegate != null) { if (delegate instanceof FreeformStatementDelegate) { try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getContainsRowQueryStatement(keys); PreparedStatement pstmt = null; ResultSet rs = null; Connection c = getConnection(); try { pstmt = c.prepareStatement(sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); rs = pstmt.executeQuery(); contains = rs.next(); return contains; } finally { releaseConnection(c, pstmt, rs); } } catch (UnsupportedOperationException e) { } } try { query = delegate.getContainsRowQueryString(keys); } catch (UnsupportedOperationException e) { query = modifyWhereClause(keys); } } else { query = modifyWhereClause(keys); } Statement statement = null; ResultSet rs = null; Connection conn = getConnection(); try { statement = conn.createStatement(); rs = statement.executeQuery(query); contains = rs.next(); } finally { releaseConnection(conn, statement, rs); } return contains; }
FreeformQuery extends AbstractTransactionalQuery implements
        QueryDelegate { @Override @SuppressWarnings("deprecation") public boolean containsRowWithKey(Object... keys) throws SQLException { String query = null; boolean contains = false; if (delegate != null) { if (delegate instanceof FreeformStatementDelegate) { try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getContainsRowQueryStatement(keys); PreparedStatement pstmt = null; ResultSet rs = null; Connection c = getConnection(); try { pstmt = c.prepareStatement(sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); rs = pstmt.executeQuery(); contains = rs.next(); return contains; } finally { releaseConnection(c, pstmt, rs); } } catch (UnsupportedOperationException e) { } } try { query = delegate.getContainsRowQueryString(keys); } catch (UnsupportedOperationException e) { query = modifyWhereClause(keys); } } else { query = modifyWhereClause(keys); } Statement statement = null; ResultSet rs = null; Connection conn = getConnection(); try { statement = conn.createStatement(); rs = statement.executeQuery(query); contains = rs.next(); } finally { releaseConnection(conn, statement, rs); } return contains; } }
FreeformQuery extends AbstractTransactionalQuery implements
        QueryDelegate { @Override @SuppressWarnings("deprecation") public boolean containsRowWithKey(Object... keys) throws SQLException { String query = null; boolean contains = false; if (delegate != null) { if (delegate instanceof FreeformStatementDelegate) { try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getContainsRowQueryStatement(keys); PreparedStatement pstmt = null; ResultSet rs = null; Connection c = getConnection(); try { pstmt = c.prepareStatement(sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); rs = pstmt.executeQuery(); contains = rs.next(); return contains; } finally { releaseConnection(c, pstmt, rs); } } catch (UnsupportedOperationException e) { } } try { query = delegate.getContainsRowQueryString(keys); } catch (UnsupportedOperationException e) { query = modifyWhereClause(keys); } } else { query = modifyWhereClause(keys); } Statement statement = null; ResultSet rs = null; Connection conn = getConnection(); try { statement = conn.createStatement(); rs = statement.executeQuery(query); contains = rs.next(); } finally { releaseConnection(conn, statement, rs); } return contains; } @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") public boolean containsRowWithKey(Object... keys) throws SQLException { String query = null; boolean contains = false; if (delegate != null) { if (delegate instanceof FreeformStatementDelegate) { try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getContainsRowQueryStatement(keys); PreparedStatement pstmt = null; ResultSet rs = null; Connection c = getConnection(); try { pstmt = c.prepareStatement(sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); rs = pstmt.executeQuery(); contains = rs.next(); return contains; } finally { releaseConnection(c, pstmt, rs); } } catch (UnsupportedOperationException e) { } } try { query = delegate.getContainsRowQueryString(keys); } catch (UnsupportedOperationException e) { query = modifyWhereClause(keys); } } else { query = modifyWhereClause(keys); } Statement statement = null; ResultSet rs = null; Connection conn = getConnection(); try { statement = conn.createStatement(); rs = statement.executeQuery(query); contains = rs.next(); } finally { releaseConnection(conn, statement, rs); } return contains; } @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") public boolean containsRowWithKey(Object... keys) throws SQLException { String query = null; boolean contains = false; if (delegate != null) { if (delegate instanceof FreeformStatementDelegate) { try { StatementHelper sh = ((FreeformStatementDelegate) delegate) .getContainsRowQueryStatement(keys); PreparedStatement pstmt = null; ResultSet rs = null; Connection c = getConnection(); try { pstmt = c.prepareStatement(sh.getQueryString()); sh.setParameterValuesToStatement(pstmt); rs = pstmt.executeQuery(); contains = rs.next(); return contains; } finally { releaseConnection(c, pstmt, rs); } } catch (UnsupportedOperationException e) { } } try { query = delegate.getContainsRowQueryString(keys); } catch (UnsupportedOperationException e) { query = modifyWhereClause(keys); } } else { query = modifyWhereClause(keys); } Statement statement = null; ResultSet rs = null; Connection conn = getConnection(); try { statement = conn.createStatement(); rs = statement.executeQuery(query); contains = rs.next(); } finally { releaseConnection(conn, statement, rs); } return contains; } @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);  }