class CachedRunningQuery extends AbstractRunningQuery {

    private String quoteField(String field) {
        if (!field.equals("*") && field.contains(".")) {
            if (isFunction(field)) {
                if (!field.contains("(*)")) {
                    // Parse the arguments to the function
                    int startParen = field.lastIndexOf(LPAREN) + 1;
                    int endParen = field.indexOf(RPAREN);
                    String[] args = field.substring(startParen, endParen).split(",");
                    for (String arg : args) {
                        if (!arg.contains("'") && !arg.contains("\"")) {
                            if (this.viewColumnNames != null && this.viewColumnNames.contains(arg)) {
                                field = field.replaceAll(arg, BACKTICK + arg + BACKTICK);
                            }
                        }
                    }
                    return field;
                } else
                    return field;
            } else {
                return new StringBuilder().append(BACKTICK).append(field).append(BACKTICK).toString();
            }
        } else {
            return field;
        }
    }

    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);

}