private static TIntSet getIdsForCondition(
        String tableName,
        String keyField,
        String keyValue,
        Connection connection
    ) throws SQLException {
        String idCheckSql = String.format("select id from %s where %s = ?", tableName, keyField);
        // Create statement for counting rows selected
        PreparedStatement statement = connection.prepareStatement(idCheckSql);
        statement.setString(1, keyValue);
        LOG.info(statement.toString());
        ResultSet resultSet = statement.executeQuery();
        // Keep track of number of records found with key field
        TIntSet uniqueIds = new TIntHashSet();
        while (resultSet.next()) {
            int uniqueId = resultSet.getInt(1);
            uniqueIds.add(uniqueId);
            LOG.info("entity id: {}, where {}: {}", uniqueId, keyField, keyValue);
        }
        return uniqueIds;
    }
private static TIntSet getIdsForCondition(
        String tableName,
        String keyField,
        String keyValue,
        Connection connection
    ) throws SQLException {
        String idCheckSql = String.format("select id from %s where %s = ?", tableName, keyField);
        
        PreparedStatement statement = connection.prepareStatement(idCheckSql);
        statement.setString(1, keyValue);
        LOG.info(statement.toString());
        ResultSet resultSet = statement.executeQuery();
        
        TIntSet uniqueIds = new TIntHashSet();
        while (resultSet.next()) {
            int uniqueId = resultSet.getInt(1);
            uniqueIds.add(uniqueId);
            LOG.info("entity id: {}, where {}: {}", uniqueId, keyField, keyValue);
        }
        return uniqueIds;
    }
private static TIntSet getIdsForCondition ( String tableName , String keyField , String keyValue , Connection connection ) throws SQLException { String idCheckSql = String . format ( "select id from %s where %s = ?" , tableName , keyField ) ; // Create statement for counting rows selected PreparedStatement statement = connection . prepareStatement ( idCheckSql ) ; statement . setString ( 1 , keyValue ) ; LOG . info ( statement . toString ( ) ) ; ResultSet resultSet = statement . executeQuery ( ) ; // Keep track of number of records found with key field TIntSet uniqueIds = new TIntHashSet ( ) ; while ( resultSet . next ( ) ) { int uniqueId = resultSet . getInt ( 1 ) ; uniqueIds . add ( uniqueId ) ; LOG . info ( "entity id: {}, where {}: {}" , uniqueId , keyField , keyValue ) ; } return uniqueIds ; }
For some condition (where field = string value), return the set of unique int IDs for the records that match.
For some condition ( where field = string value ) return the set of unique int IDs for the records that match .