class CachedRunningQuery extends AbstractRunningQuery {

    public String buildOrderClause(String order) {
        if (order != null) {
            String[] commaSplit = tokenizeOutsideParens(order, ',');
            StringBuilder out = new StringBuilder();
            for (String s : commaSplit) {
                // in case its a function with a direction, separate them
                String[] spaceParsed = CachedRunningQuery.tokenizeOutsideParens(s, ' ');
                if (out.length() > 0)
                    out.append(",");
                for (int j = 0; j < spaceParsed.length; j++) {
                    // get rid of incoming back-tics
                    spaceParsed[j] = spaceParsed[j].replace("`", "").trim();
                    spaceParsed[j] = quoteField(spaceParsed[j]);
                    if (j > 0)
                        out.append(" ");
                    out.append(spaceParsed[j]);
                }
            }
            if (out.length() == 0) {
                order = null;
            } else {
                order = out.toString();
            }
        }
        return order;
    }

    private  CachedRunningQuery(QueryMetricFactory metricFactory);
    public  CachedRunningQuery(Query query, QueryLogic<?> queryLogic, String queryId, String alias, String user, String view, int pagesize,
                    String originalQueryId, Set<String> variableFields, Set<String> fixedFieldsInEvent, QueryMetricFactory metricFactory);
    public  CachedRunningQuery(Connection connection, Query query, QueryLogic<?> queryLogic, String queryId, String alias, String user, String view,
                    String fields, String conditions, String grouping, String order, int pagesize, Set<String> variableFields, Set<String> fixedFieldsInEvent,
                    QueryMetricFactory metricFactory);

}