question: protected static String applyLimitClause ( final String query , int limit , final int queryResultSetLimit ) { Matcher matcher = SELECT_EXPR_PATTERN . matcher ( query ) ; if ( matcher . matches ( ) ) { Matcher limit_matcher = SELECT_WITH_LIMIT_EXPR_PATTERN . matcher ( query ) ; boolean queryAlreadyHasLimitClause = limit_matcher . matches ( ) ; if ( ! queryAlreadyHasLimitClause ) { if ( limit == 0 ) { limit = queryResultSetLimit ; } String result = query ; result += " LIMIT " + limit ; return result ; } } return query ; }
target:  Matches the input query with query with limit pattern. If limit is found in input query this function ignores. Else it will append a default limit .. 1000 If input limit is 0 then also it will append default limit of 1000