X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fcqltransform.c;h=2f2f35319f38edc9f94cf6d7afe3ee091c13a5b0;hb=be821514c869d68186361b5aab6bbfd1aa60e087;hp=133db946baeb2d465f676e2d461dc71a8c3d188c;hpb=66ab37e39c6f32575526ffa2347ededb7ebf7bd0;p=yaz-moved-to-github.git diff --git a/src/cqltransform.c b/src/cqltransform.c index 133db94..2f2f353 100644 --- a/src/cqltransform.c +++ b/src/cqltransform.c @@ -1,5 +1,5 @@ -/* $Id: cqltransform.c,v 1.25 2006-10-25 09:58:19 adam Exp $ - Copyright (C) 1995-2005, Index Data ApS +/* $Id: cqltransform.c,v 1.28 2007-03-29 11:14:11 mike Exp $ + Copyright (C) 1995-2007, Index Data ApS Index Data Aps This file is part of the YAZ toolkit. @@ -195,6 +195,7 @@ int cql_pr_attr_uri(cql_transform_t ct, const char *category, const char *cp0 = res, *cp1; while ((cp1 = strchr(cp0, '='))) { + int i; while (*cp1 && *cp1 != ' ') cp1++; if (cp1 - cp0 >= sizeof(buf)) @@ -202,7 +203,19 @@ int cql_pr_attr_uri(cql_transform_t ct, const char *category, memcpy (buf, cp0, cp1 - cp0); buf[cp1-cp0] = 0; (*pr)("@attr ", client_data); - (*pr)(buf, client_data); + + for (i = 0; buf[i]; i++) + { + if (buf[i] == '*') + (*pr)(eval, client_data); + else + { + char tmp[2]; + tmp[0] = buf[i]; + tmp[1] = '\0'; + (*pr)(tmp, client_data); + } + } (*pr)(" ", client_data); cp0 = cp1; while (*cp0 == ' ') @@ -340,6 +353,18 @@ static const char *wcchar(const char *term, int length) } +/* ### checks for CQL relation-name rather than Type-1 attribute */ +static int has_modifier(struct cql_node *cn, const char *name) { + struct cql_node *mod; + for (mod = cn->u.st.modifiers; mod != 0; mod = mod->u.st.modifiers) { + if (!strcmp(mod->u.st.index, name)) + return 1; + } + + return 0; +} + + void emit_term(cql_transform_t ct, struct cql_node *cn, const char *term, int length, @@ -348,10 +373,11 @@ void emit_term(cql_transform_t ct, { int i; const char *ns = cn->u.st.index_uri; + int process_term = !has_modifier(cn, "regexp"); assert(cn->which == CQL_NODE_ST); - if (length > 0) + if (process_term && length > 0) { if (length > 1 && term[0] == '^' && term[length-1] == '^') { @@ -380,7 +406,7 @@ void emit_term(cql_transform_t ct, } } - if (length > 0) + if (process_term && length > 0) { /* Check for well-known globbing patterns that represent * simple truncation attributes as expected by, for example,