From a0c511bee52164f097c30d5e2598c0810605ff55 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 30 May 2008 13:23:25 +0200 Subject: [PATCH] Replaced some error code ints with proper defines (SRU / Bib-1). --- src/seshigh.c | 17 ++++++++--------- ztest/ztest.c | 17 +++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/seshigh.c b/src/seshigh.c index 3e10403..a70fbc5 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -767,8 +767,7 @@ static int cql2pqf(ODR odr, const char *cql, cql_transform_t ct, r = cql_parser_string(cp, cql); if (r) { - /* CQL syntax error */ - srw_errcode = 10; + srw_errcode = YAZ_SRW_QUERY_SYNTAX_ERROR; } if (!r) { @@ -777,7 +776,7 @@ static int cql2pqf(ODR odr, const char *cql, cql_transform_t ct, cql_parser_result(cp), rpn_buf, sizeof(rpn_buf)-1); if (r) - srw_errcode = cql_transform_error(ct, &add); + srw_errcode = cql_transform_error(ct, &add); } if (!r) { @@ -792,7 +791,7 @@ static int cql2pqf(ODR odr, const char *cql, cql_transform_t ct, int code = yaz_pqf_error(pp, &pqf_msg, &off); yaz_log(YLOG_WARN, "PQF Parser Error %s (code %d)", pqf_msg, code); - srw_errcode = 10; + srw_errcode = YAZ_SRW_QUERY_SYNTAX_ERROR; } else { @@ -814,14 +813,14 @@ static int cql2pqf_scan(ODR odr, const char *cql, cql_transform_t ct, if (srw_error) return srw_error; if (query.which != Z_Query_type_1 && query.which != Z_Query_type_101) - return 10; /* bad query type */ + return YAZ_SRW_QUERY_SYNTAX_ERROR; /* bad query type */ rpn = query.u.type_1; if (!rpn->RPNStructure) - return 10; /* must be structure */ + return YAZ_SRW_QUERY_SYNTAX_ERROR; /* must be structure */ if (rpn->RPNStructure->which != Z_RPNStructure_simple) - return 10; /* must be simple */ + return YAZ_SRW_QUERY_SYNTAX_ERROR; /* must be simple */ if (rpn->RPNStructure->u.simple->which != Z_Operand_APT) - return 10; /* must be attributes plus term node .. */ + return YAZ_SRW_QUERY_SYNTAX_ERROR; /* must be be attributes + term */ memcpy(result, rpn->RPNStructure->u.simple->u.attributesPlusTerm, sizeof(*result)); return 0; @@ -837,7 +836,7 @@ static int ccl2pqf(ODR odr, const Odr_oct *ccl, CCL_bibset bibset, ccl0 = odr_strdupn(odr, (char*) ccl->buf, ccl->len); if ((node = ccl_find_str(bibset, ccl0, &errcode, &pos)) == 0) { bsrr->errstring = (char*) ccl_err_msg(errcode); - return 10; /* Query syntax error */ + return YAZ_SRW_QUERY_SYNTAX_ERROR; /* Query syntax error */ } bsrr->query->which = Z_Query_type_1; diff --git a/ztest/ztest.c b/ztest/ztest.c index 0c77c76..6b0c11f 100644 --- a/ztest/ztest.c +++ b/ztest/ztest.c @@ -87,7 +87,7 @@ int ztest_search(void *handle, bend_search_rr *rr) { if (rr->num_bases != 1) { - rr->errcode = 23; + rr->errcode = YAZ_BIB1_COMBI_OF_SPECIFIED_DATABASES_UNSUPP; return 0; } /* Throw Database unavailable if other than Default or Slow */ @@ -112,7 +112,7 @@ int ztest_search(void *handle, bend_search_rr *rr) } else { - rr->errcode = 109; + rr->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE; rr->errstring = rr->basenames[0]; return 0; } @@ -353,7 +353,7 @@ int ztest_esrequest (void *handle, bend_esrequest_rr *rr) yaz_log (log_level, "database: %s", toKeep->databaseName); if (!strcmp(toKeep->databaseName, "fault")) { - rr->errcode = 109; + rr->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE; rr->errstring = toKeep->databaseName; } if (!strcmp(toKeep->databaseName, "accept")) @@ -686,7 +686,7 @@ int ztest_scan(void *handle, bend_scan_rr *q) } else { - q->errcode = 109; + q->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE; q->errstring = q->basenames[0]; return 0; } @@ -702,7 +702,7 @@ int ztest_scan(void *handle, bend_scan_rr *q) } if (q->num_entries > 200) { - q->errcode = 31; + q->errcode = YAZ_BIB1_RESOURCES_EXHAUSTED_NO_RESULTS_AVAILABLE; return 0; } if (q->term) @@ -710,12 +710,12 @@ int ztest_scan(void *handle, bend_scan_rr *q) int len; if (q->term->term->which != Z_Term_general) { - q->errcode = 229; /* unsupported term type */ + q->errcode = YAZ_BIB1_TERM_TYPE_UNSUPP; return 0; } if (*q->step_size != 0) { - q->errcode = 205; /*Only zero step size supported for Scan */ + q->errcode = YAZ_BIB1_ONLY_ZERO_STEP_SIZE_SUPPORTED_FOR_SCAN; return 0; } len = q->term->term->u.general->len; @@ -761,7 +761,8 @@ int ztest_scan(void *handle, bend_scan_rr *q) { list[q->num_entries].term = entries[pos]; list[q->num_entries].occurrences = -1; - list[q->num_entries].errcode = 233; + list[q->num_entries].errcode = + YAZ_BIB1_SCAN_UNSUPP_VALUE_OF_POSITION_IN_RESPONSE; list[q->num_entries].errstring = "SD for Scan Term"; } else -- 1.7.10.4