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