1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2011 Index Data
3 * See the file LICENSE for details.
7 * \brief CQL sortkeys utilities
17 #include <yaz/wrbuf.h>
20 static void pr_n(void (*pr)(const char *buf, void *client_data),
21 const char *buf, int len, void *client_data)
28 if (left >= sizeof(tmp))
30 memcpy(tmp, buf, sizeof(tmp)-1);
31 tmp[sizeof(tmp)-1] = '\0';
32 left = left - (sizeof(tmp)-1);
43 int cql_sortby_to_sortkeys(struct cql_node *cn,
44 void (*pr)(const char *buf, void *client_data),
47 if (cn && cn->which == CQL_NODE_SORT)
49 for (; cn; cn = cn->u.sort.next)
52 int caseSensitive = 0;
53 const char *missingValue = 0;
54 const char *indx = cn->u.sort.index;
58 const char *s = strchr(indx, '.');
63 pr_n(pr, indx, s - indx, client_data);
67 pr(indx, client_data);
81 * c-file-style: "Stroustrup"
82 * indent-tabs-mode: nil
84 * vim: shiftwidth=4 tabstop=8 expandtab