Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/yaz
[yaz-moved-to-github.git] / src / cqlstrer.c
1 /* This file is part of the YAZ toolkit.
2  * Copyright (C) 1995-2010 Index Data
3  * See the file LICENSE for details.
4  */
5
6 /**
7  * \file cqlstrer.c
8  * \brief Implements CQL error code map to description string.
9  */
10
11 #include <yaz/cql.h>
12
13 /*
14  * The error-messages associated with these codes are taken from
15  * the SRW diagnostic specifications at
16  *      http://www.loc.gov/standards/sru/diagnostics-list.html
17  */
18 const char *cql_strerror(int code) {
19     static char buf[80];
20     switch (code) {
21     case 10: return "Illegal query";
22     case 11: return "Unsupported query type (XCQL vs CQL)";
23     case 12: return "Too many characters in query";
24     case 13: return "Unbalanced or illegal use of parentheses";
25     case 14: return "Unbalanced or illegal use of quotes";
26     case 15: return "Illegal or unsupported context set";
27     case 16: return "Illegal or unsupported index";
28     case 17: return "Illegal or unsupported combination of index and context set";
29     case 18: return "Illegal or unsupported combination of indexes";
30     case 19: return "Illegal or unsupported relation";
31     case 20: return "Illegal or unsupported relation modifier";
32     case 21: return "Illegal or unsupported combination of relation modifers";
33     case 22: return "Illegal or unsupported combination of relation and index";
34     case 23: return "Too many characters in term";
35     case 24: return "Illegal combination of relation and term";
36     case 25: return "Special characters not quoted in term";
37     case 26: return "Non special character escaped in term";
38     case 27: return "Empty term unsupported";
39     case 28: return "Masking character not supported";
40     case 29: return "Masked words too short";
41     case 30: return "Too many masking characters in term";
42     case 31: return "Anchoring character not supported";
43     case 32: return "Anchoring character in illegal or unsupported position";
44     case 33: return "Combination of proximity/adjacency and masking characters not supported";
45     case 34: return "Combination of proximity/adjacency and anchoring characters not supported";
46     case 35: return "Terms only exclusion (stop) words";
47     case 36: return "Term in invalid format for index or relation";
48     case 37: return "Illegal or unsupported boolean operator";
49     case 38: return "Too many boolean operators in query";
50     case 39: return "Proximity not supported";
51     case 40: return "Illegal or unsupported proximity relation";
52     case 41: return "Illegal or unsupported proximity distance";
53     case 42: return "Illegal or unsupported proximity unit";
54     case 43: return "Illegal or unsupported proximity ordering";
55     case 44: return "Illegal or unsupported combination of proximity modifiers";
56     case 45: return "Context set name (prefix) assigned to multiple identifiers";
57     default: break;
58     }
59
60     sprintf(buf, "Unknown CQL error #%d", code);
61     return buf;
62 }
63 /*
64  * Local variables:
65  * c-basic-offset: 4
66  * c-file-style: "Stroustrup"
67  * indent-tabs-mode: nil
68  * End:
69  * vim: shiftwidth=4 tabstop=8 expandtab
70  */
71