question: private Integer countFragmentFilteredPages ( List < String > templateFragments , boolean whitelist ) throws WikiApiException { try { int count = 0 ; PreparedStatement statement = null ; ResultSet result = null ; try { StringBuffer sqlString = new StringBuffer ( ) ; StringBuffer subconditions = new StringBuffer ( ) ; sqlString . append ( "SELECT distinct(count(*)) FROM " + GeneratorConstants . TABLE_TPLID_TPLNAME + " as tpl, " + GeneratorConstants . TABLE_TPLID_PAGEID + " AS p WHERE tpl.templateId = p.templateId " + ( whitelist ? "AND" : "AND NOT" ) + " (" ) ; for ( @ SuppressWarnings ( "unused" ) String fragment : templateFragments ) { if ( subconditions . length ( ) != 0 ) { subconditions . append ( "OR " ) ; } subconditions . append ( "tpl.templateName LIKE ?" ) ; } sqlString . append ( subconditions ) ; sqlString . append ( ")" ) ; statement = connection . prepareStatement ( sqlString . toString ( ) ) ; int curIdx = 1 ; for ( String fragment : templateFragments ) { fragment = fragment . toLowerCase ( ) ; fragment = fragment . trim ( ) ; fragment = fragment . replaceAll ( " " , "_" ) ; statement . setString ( curIdx ++ , fragment + "%" ) ; } result = execute ( statement ) ; if ( result == null ) { return 0 ; } if ( result . next ( ) ) { count = result . getInt ( 1 ) ; } } finally { if ( statement != null ) { statement . close ( ) ; } if ( result != null ) { result . close ( ) ; } } return count ; } catch ( Exception e ) { throw new WikiApiException ( e ) ; } }
target:  Returns the number of all pages that contain a template the name of which starts with any of the the given Strings.