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