private String [ ] getPIDs ( String whereClause ) throws StorageDeviceException { Connection conn = null ; PreparedStatement s = null ; ResultSet results = null ; try { conn = m_connectionPool . getReadOnlyConnection ( ) ; String query = "SELECT doPID FROM doRegistry " + whereClause ; s = conn . prepareStatement ( query ) ; logger . debug ( "Executing db query: {}" , query ) ; results = s . executeQuery ( ) ; if ( results . next ( ) ) { ArrayList < String > pidList = new ArrayList < String > ( ) ; do { pidList . add ( results . getString ( "doPID" ) ) ; } while ( results . next ( ) ) ; return pidList . toArray ( EMPTY_STRING_ARRAY ) ; } else { return EMPTY_STRING_ARRAY ; } } catch ( SQLException sqle ) { throw new StorageDeviceException ( "Unexpected error from SQL database: " + sqle . getMessage ( ) , sqle ) ; } finally { try { if ( results != null ) { results . close ( ) ; } if ( s != null ) { s . close ( ) ; } if ( conn != null ) { m_connectionPool . free ( conn ) ; } } catch ( SQLException sqle ) { throw new StorageDeviceException ( "Unexpected error from SQL database: " + sqle . getMessage ( ) , sqle ) ; } finally { results = null ; s = null ; } } }
whereClause is a WHERE clause starting with where