X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fcql2ccl.c;h=331b6dbfc14e23bba0664bed14681e595d118023;hb=9732f4e8ccecd91b43de8eea00b62830b65cc0c5;hp=6a69c8e958dd4724e14ad21b796ef2ae641a0601;hpb=5242cb5a8634bfa38b9333ff7f903e718ac6e292;p=yaz-moved-to-github.git diff --git a/src/cql2ccl.c b/src/cql2ccl.c index 6a69c8e..331b6db 100644 --- a/src/cql2ccl.c +++ b/src/cql2ccl.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2012 Index Data + * Copyright (C) 1995-2013 Index Data * See the file LICENSE for details. */ /** @@ -91,6 +91,7 @@ static int node(struct cql_node *cn, const char *split_op = 0; const char *ccl_rel = 0; const char *rel = cn->u.st.relation; + const char *cp; if (cn->u.st.index && strcmp(cn->u.st.index, "cql.serverChoice")) @@ -121,38 +122,26 @@ static int node(struct cql_node *cn, /* unsupported relation */ return -1; } - for (; cn; cn = cn->u.st.extra_terms) + cp = cn->u.st.term; + while (1) { - const char *cp = cn->u.st.term; - while (1) + if (ccl_field && ccl_rel) { - if (ccl_field && ccl_rel) - { - pr(ccl_field, client_data); - pr(ccl_rel, client_data); - if (!split_op) - ccl_rel = 0; - } - pr_term(&cp, split_op ? 1 : 0, pr, client_data); - while (*cp == ' ') - cp++; - if (*cp == '\0') - break; - pr(" ", client_data); - if (split_op) - { - pr(split_op, client_data); - pr(" ", client_data); - } + pr(ccl_field, client_data); + pr(ccl_rel, client_data); + if (!split_op) + ccl_rel = 0; } - if (cn->u.st.extra_terms) + pr_term(&cp, split_op ? 1 : 0, pr, client_data); + while (*cp == ' ') + cp++; + if (*cp == '\0') + break; + pr(" ", client_data); + if (split_op) { + pr(split_op, client_data); pr(" ", client_data); - if (split_op) - { - pr(split_op, client_data); - pr(" ", client_data); - } } } return 0;