From: Adam Dickmeiss Date: Wed, 4 May 2011 14:05:05 +0000 (+0200) Subject: CQL: handle SORT node in a few places X-Git-Tag: v4.2.0~34 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=ea44785920112e329fbc94c2e70758e6378eb775;p=yaz-moved-to-github.git CQL: handle SORT node in a few places In particular, CQL to PQF transform was broken after introduction of the SORT node. --- diff --git a/src/cqltransform.c b/src/cqltransform.c index 35101ae..f015650 100644 --- a/src/cqltransform.c +++ b/src/cqltransform.c @@ -876,7 +876,9 @@ void cql_transform_r(cql_transform_t ct, cql_transform_r(ct, cn->u.boolean.left, pr, client_data); cql_transform_r(ct, cn->u.boolean.right, pr, client_data); break; - + case CQL_NODE_SORT: + cql_transform_r(ct, cn->u.sort.search, pr, client_data); + break; default: fprintf(stderr, "Fatal: impossible CQL node-type %d\n", cn->which); abort(); diff --git a/src/cqlutil.c b/src/cqlutil.c index 7dba5a7..5e94a60 100644 --- a/src/cqlutil.c +++ b/src/cqlutil.c @@ -43,6 +43,11 @@ struct cql_node *cql_node_dup (NMEM nmem, struct cql_node *cp) cn = cql_node_mk_boolean(nmem, cp->u.boolean.value); cn->u.boolean.left = cql_node_dup(nmem, cp->u.boolean.left); cn->u.boolean.right = cql_node_dup(nmem, cp->u.boolean.right); + break; + case CQL_NODE_SORT: + cn = cql_node_mk_sort(nmem, cp->u.sort.index, cp->u.sort.modifiers); + cn->u.sort.next = cql_node_dup(nmem, cp->u.sort.next); + cn->u.sort.search = cql_node_dup(nmem, cp->u.sort.search); } return cn; } @@ -141,6 +146,10 @@ struct cql_node *cql_apply_prefix(NMEM nmem, cql_apply_prefix(nmem, n->u.boolean.left, prefix, uri); cql_apply_prefix(nmem, n->u.boolean.right, prefix, uri); } + else if (n->which == CQL_NODE_SORT) + { + cql_apply_prefix(nmem, n->u.sort.search, prefix, uri); + } return n; }