X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsrwutil.c;h=47af17829cea89fa4fb0e7612b42f159e0dcfda0;hp=226b43aae874ebdfdfa904b9199633d1b34b09bc;hb=8dc67a9430644549801c18ec7e3a725e5a4ef782;hpb=073195289eb9b73d6793fa283e5a7dca7a24fba8 diff --git a/src/srwutil.c b/src/srwutil.c index 226b43a..47af178 100644 --- a/src/srwutil.c +++ b/src/srwutil.c @@ -2,7 +2,7 @@ * Copyright (c) 2002-2004, Index Data. * See the file LICENSE for details. * - * $Id: srwutil.c,v 1.8 2004-01-09 18:10:32 adam Exp $ + * $Id: srwutil.c,v 1.15 2004-03-24 10:14:24 adam Exp $ */ #include @@ -131,6 +131,18 @@ void yaz_uri_val_int(const char *path, const char *name, ODR o, int **intp) *intp = odr_intdup(o, atoi(v)); } +void yaz_mk_std_diagnostic(ODR o, Z_SRW_diagnostic *d, + int code, const char *details) +{ + d->uri = (char *) odr_malloc(o, 50); + sprintf(d->uri, "info:srw/diagnostic/1/%d", code); + d->message = 0; + if (details) + d->details = odr_strdup(o, details); + else + d->details = 0; +} + void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d, int *num, int code, const char *addinfo) { @@ -139,11 +151,8 @@ void yaz_add_srw_diagnostic(ODR o, Z_SRW_diagnostic **d, if (*num) memcpy (d_new, *d, *num *sizeof(**d)); *d = d_new; - (*d + *num)->code = odr_intdup(o, code); - if (addinfo) - (*d + *num)->details = odr_strdup(o, addinfo); - else - (*d + *num)->details = 0; + + yaz_mk_std_diagnostic(o, *d + *num, code, addinfo); (*num)++; } @@ -245,7 +254,7 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, char *scanClause = 0; char *recordXPath = 0; char *recordSchema = 0; - char *recordPacking = "xml"; + char *recordPacking = "xml"; /* xml packing is default for SRU */ char *maximumRecords = 0; char *startRecord = 0; char **uri_name; @@ -298,7 +307,7 @@ int yaz_sru_decode(Z_HTTP_Request *hreq, Z_SRW_PDU **srw_pdu, else if (!strcmp(n, "startRecord")) startRecord = v; else - yaz_add_srw_diagnostic(decode, diag, num_diag, 9, n); + yaz_add_srw_diagnostic(decode, diag, num_diag, 8, n); } } if (!version) @@ -532,22 +541,27 @@ static struct { {1, "Permanent system error"}, {2, "System temporarily unavailable"}, {3, "Authentication error"}, +{4, "Unsupported operation"}, +{5, "Unsupported version"}, +{6, "Unsupported parameter value"}, +{7, "Mandatory parameter not supplied"}, +{8, "Unsupported parameter"}, /* Diagnostics Relating to CQL */ {10, "Query syntax error"}, {11, "Unsupported query type"}, {12, "Too many characters in query"}, -{13, "Unbalanced or illegal use of parentheses"}, -{14, "Unbalanced or illegal use of quotes"}, -{15, "Illegal or unsupported context set"}, -{16, "Illegal or unsupported index"}, -{17, "Illegal or unsupported combination of index and context set"}, -{18, "Illegal or unsupported combination of indexes"}, -{19, "Illegal or unsupported relation"}, -{20, "Illegal or unsupported relation modifier"}, -{21, "Illegal or unsupported combination of relation modifers"}, -{22, "Illegal or unsupported combination of relation and index"}, +{13, "Invalid or unsupported use of parentheses"}, +{14, "Invalid or unsupported use of quotes"}, +{15, "Unsupported context set"}, +{16, "Unsupported index"}, +{17, "Unsupported combination of index and context set"}, +{18, "Unsupported combination of indexes"}, +{19, "Unsupported relation"}, +{20, "Unsupported relation modifier"}, +{21, "Unsupported combination of relation modifers"}, +{22, "Unsupported combination of relation and index"}, {23, "Too many characters in term"}, -{24, "Illegal combination of relation and term"}, +{24, "Unsupported combination of relation and term"}, {25, "Special characters not quoted in term"}, {26, "Non special character escaped in term"}, {27, "Empty term unsupported"}, @@ -555,19 +569,19 @@ static struct { {29, "Masked words too short"}, {30, "Too many masking characters in term"}, {31, "Anchoring character not supported"}, -{32, "Anchoring character in illegal or unsupported position"}, +{32, "Anchoring character in unsupported position"}, {33, "Combination of proximity/adjacency and masking characters not supported"}, {34, "Combination of proximity/adjacency and anchoring characters not supported"}, -{35, "Terms only exclusion (stop) words"}, +{35, "Terms only exclusion stopwords"}, {36, "Term in invalid format for index or relation"}, -{37, "Illegal or unsupported boolean operator"}, +{37, "Unsupported boolean operator"}, {38, "Too many boolean operators in query"}, {39, "Proximity not supported"}, -{40, "Illegal or unsupported proximity relation"}, -{41, "Illegal or unsupported proximity distance"}, -{42, "Illegal or unsupported proximity unit"}, -{43, "Illegal or unsupported proximity ordering"}, -{44, "Illegal or unsupported combination of proximity modifiers"}, +{40, "Unsupported proximity relation"}, +{41, "Unsupported proximity distance"}, +{42, "Unsupported proximity unit"}, +{43, "Unsupported proximity ordering"}, +{44, "Unsupported combination of proximity modifiers"}, {45, "context set name (prefix) assigned to multiple identifiers"}, /* Diagnostics Relating to Result Sets */ {50, "Result sets not supported"}, @@ -581,7 +595,7 @@ static struct { {58, "Result set created with unpredictable partial results available"}, {59, "Result set created with valid partial results available"}, /* Diagnostics Relating to Records */ -{60, "Too many records retrieved"}, +{60, "Result set no created: too many records retrieved"}, {61, "First record position out of range"}, {62, "Negative number of records requested"}, {63, "System error in retrieving records"}, @@ -592,24 +606,33 @@ static struct { {68, "Not authorised to send record"}, {69, "Not authorised to send record in this schema"}, {70, "Record too large to send"}, +{71, "Unsupported record packing"}, +{72, "XPath retrieval unsupported"}, +{73, "XPath expression contains unsupported feature"}, +{74, "Unable to evaluate XPath expression"}, /* Diagnostics Relating to Sorting */ {80, "Sort not supported"}, -{81, "Unsupported sort type (sortKeys vs xSortKeys)"}, -{82, "Illegal or unsupported sort sequence"}, -{83, "Too many records"}, -{84, "Too many sort keys"}, +{81, "Unsupported sort type"}, +{82, "Unsupported sort sequence"}, +{83, "Too many records to sort"}, +{84, "Too many sort keys to sort"}, {85, "Duplicate sort keys"}, -{86, "Incompatible record formats"}, +{86, "Cannot sort: incompatible record formats"}, {87, "Unsupported schema for sort"}, -{88, "Unsupported tag path for sort"}, -{89, "Tag path illegal or unsupported for schema"}, -{90, "Illegal or unsupported direction value"}, -{91, "Illegal or unsupported case value"}, -{92, "Illegal or unsupported missing value action"}, +{88, "Unsupported path for sort"}, +{89, "Path unsupported for schema"}, +{90, "Unsupported direction value"}, +{91, "Unsupported case value"}, +{92, "Unsupported missing value action"}, /* Diagnostics Relating to Explain */ {100, "Explain not supported"}, {101, "Explain request type not supported (SOAP vs GET)"}, {102, "Explain record temporarily unavailable"}, +/* Diagnostics Relating to Stylesheets */ +{110, "Stylesheets not supported"}, +{111, "Unsupported stylesheet"}, +/* Diagnostics relating to Scan */ +{120, "Response position out of range"}, {0, 0} }; @@ -672,7 +695,6 @@ static int srw_bib1_map[] = { 105, 3, 106, 66, 107, 11, - 108, 10, 108, 13, 108, 14, 108, 25, @@ -680,7 +702,7 @@ static int srw_bib1_map[] = { 108, 27, 108, 45, - 109, 1, + 109, 2, 110, 37, 111, 1, 112, 58, @@ -689,6 +711,7 @@ static int srw_bib1_map[] = { 115, 16, 116, 16, 117, 19, + 117, 20, 118, 22, 119, 32, 119, 31,