Possible compatibility problems with earlier versions marked with '*'.
+New member 'schema' in struct bend_fetch_rr which the name of requested
+schema (SRW/SRU) for record (or NULL if none was given). The fetch
+handler MAY set this to reflect the schema of the returned record.
+
+New member 'display_term' in struct scan_entry. GFS now sets member entries
+and allocates scan entries to be filled by user scan handler. In previous
+version, entries member was allocated by the scan handler. That still works,
+but the GFS will ignore member display_term - assuming it was NOT set by
+the handler. The fact that the GFS now allocates the entries both allows
+for new members and makes a scan handler easier to write.
+
Fix CQL lex buffer overflow.
SRW/SRU recordPacking. For SRW default recordPacking is string. For
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
- * $Id: backend.h,v 1.20 2003-03-24 22:26:50 adam Exp $
+ * $Id: backend.h,v 1.21 2003-04-24 13:30:32 adam Exp $
*/
#ifndef BACKEND_H
int errcode; /* 0==success */
char *errstring; /* system error string or NULL */
int surrogate_flag; /* surrogate diagnostic */
+ char *schema; /* string record schema input/output */
} bend_fetch_rr;
struct scan_entry {
int occurrences; /* no of occurrences or -1 if error (see below) */
int errcode; /* Bib-1 diagnostic code; only used when occur.= -1 */
char *errstring; /* Additional string */
+ char *display_term;
};
typedef enum {
int term_position; /* desired index of term in result list/returned */
int num_entries; /* number of entries requested/returned */
+ /* scan term entries. The called handler does not have
+ to allocate this. Size of entries is num_entries (see above) */
struct scan_entry *entries;
bend_scan_status status;
int errcode;
* Copyright (c) 1995-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: seshigh.c,v 1.153 2003-04-18 15:11:04 adam Exp $
+ * $Id: seshigh.c,v 1.154 2003-04-24 13:30:32 adam Exp $
*/
/*
rr.errcode = 0;
rr.errstring = 0;
rr.surrogate_flag = 0;
+ rr.schema = srw_req->recordSchema;
if (!assoc->init->bend_fetch)
return 1;
record->recordData_buf = rr.record;
record->recordData_len = rr.len;
record->recordPosition = odr_intdup(o, pos);
- record->recordSchema = 0;
- if (srw_req->recordSchema)
- record->recordSchema = odr_strdup(o, srw_req->recordSchema);
+ if (rr.schema)
+ record->recordSchema = odr_strdup(o, rr.schema);
+ else
+ record->recordSchema = 0;
}
return rr.errcode;
}
freq.output_format_raw = 0;
freq.stream = a->encode;
freq.print = a->print;
- freq.surrogate_flag = 0;
freq.referenceId = referenceId;
+ freq.schema = 0;
(*a->init->bend_fetch)(a->backend, &freq);
/* backend should be able to signal whether error is system-wide
or only pertaining to current record */
oident *attset;
bend_scan_rr *bsrr = (bend_scan_rr *)
odr_malloc (assoc->encode, sizeof(*bsrr));
+ struct scan_entry *save_entries;
yaz_log(LOG_LOG, "Got ScanRequest");
bsrr->stream = assoc->encode;
bsrr->print = assoc->print;
bsrr->step_size = res->stepSize;
+ bsrr->entries = 0;
+ /* Note that version 2.0 of YAZ and older did not set entries ..
+ We do now. And when we do it's easier to extend the scan entry
+ We know that if the scan handler did set entries, it will
+ not know of new member display_term.
+ */
+ if (bsrr->num_entries > 0)
+ {
+ int i;
+ bsrr->entries = odr_malloc(assoc->decode, sizeof(*bsrr->entries) *
+ bsrr->num_entries);
+ for (i = 0; i<bsrr->num_entries; i++)
+ {
+ bsrr->entries[i].term = 0;
+ bsrr->entries[i].occurrences = 0;
+ bsrr->entries[i].errcode = 0;
+ bsrr->entries[i].errstring = 0;
+ bsrr->entries[i].display_term = 0;
+ }
+ }
+ save_entries = bsrr->entries; /* save it so we can compare later */
+
if (req->attributeSet &&
(attset = oid_getentbyoid(req->attributeSet)) &&
(attset->oclass == CLASS_ATTSET || attset->oclass == CLASS_GENERAL))
odr_malloc(assoc->encode, sizeof(*t));
t->suggestedAttributes = 0;
t->displayTerm = 0;
+ if (save_entries == bsrr->entries &&
+ bsrr->entries[i].display_term)
+ {
+ /* the entries was NOT set by the handler. So it's
+ safe to test for new member display_term. It is
+ NULL'ed by us.
+ */
+ t->displayTerm = odr_strdup(assoc->encode,
+ bsrr->entries[i].display_term);
+ }
t->alternativeTerm = 0;
t->byAttributes = 0;
t->otherTermInfo = 0;