private static String addSQLLmit( SchemaConfig schema, RouteResultset rrs, QueryTreeNode ast, String sql) throws SQLSyntaxErrorException { if (!rrs.hasPrimaryKeyToCache() && schema.getDefaultMaxLimit() != -1 && ast instanceof CursorNode && ((CursorNode) ast).getFetchFirstClause() == null) { String newstmt = SelectSQLAnalyser.addLimitCondtionForSelectSQL( rrs, (CursorNode) ast, schema.getDefaultMaxLimit()); if (newstmt != null) { return newstmt; } } return sql; }