private static void convertNode(final PrintableNode oldNode, final SqlBuilder sql) {
        if (oldNode instanceof TermNode) {
            convertTermNode((TermNode) oldNode, sql);
        } else if (oldNode instanceof OperatorNode) {
            convertOperatorNode((OperatorNode) oldNode, sql);

        } else {
            throw new RuntimeException(
                    "Node is of a type that we don't expect: " + oldNode.getClass().getCanonicalName());
        }
    }
Recursive method to build up a where clause string (and associated list
of bind variables) from a tree of {@link PrintableNode} objects
stroom-statistics/stroom-statistics-impl-sql/src/main/java/stroom/statistics/impl/sql/search/SQLTagValueWhereClauseConverter.java