prefix = getConstraintsOperator();
prefix = logicalOperator;
    public String buildQuery(INode home, INode nonvirtual, String kstr, String pre,                             boolean useOrder) throws SQLException {        StringBuffer q = new StringBuffer();        String prefix = pre;        if (kstr != null && !isComplexReference()) {            q.append(prefix);            String accessColumn = (accessName == null) ? otherType.getIDField() : accessName;            q.append(otherType.getTableName());            q.append(".");            q.append(accessColumn);            q.append(" = ");            // check if column is string type and value needs to be quoted            if (otherType.needsQuotes(accessColumn)) {                q.append("'");                q.append(escape(kstr));                q.append("'");            } else {                q.append(escape(kstr));            }            prefix = " AND ";        }        if (constraints.length > 1 && constraintsLogic != CONSTRAINTS_AND) {            q.append(prefix);            q.append("(");            prefix = "";        }        for (int i = 0; i < constraints.length; i++) {            q.append(prefix);            constraints[i].addToQuery(q, home, nonvirtual);            prefix = getConstraintsOperator();        }        if (constraints.length > 1 && constraintsLogic != CONSTRAINTS_AND) {            q.append(")");            prefix = " AND ";        }        if (filter != null) {            q.append(prefix);            q.append(filter);        }        if (groupby != null) {            q.append(" GROUP BY " + groupby);            if (useOrder && (groupbyOrder != null)) {                q.append(" ORDER BY " + groupbyOrder);            }        } else if (useOrder && (order != null)) {            q.append(" ORDER BY " + order);        }        return q.toString();    }