resultset_destroy(task->u.search.resultset);
xfree(task->u.search.syntax);
xfree(task->u.search.elementSetName);
+ xfree(task->u.search.schema);
break;
case ZOOM_TASK_RETRIEVE:
resultset_destroy(task->u.retrieve.resultset);
xfree(task->u.retrieve.syntax);
xfree(task->u.retrieve.elementSetName);
+ xfree(task->u.retrieve.schema);
break;
case ZOOM_TASK_CONNECT:
break;
r->odr = odr_createmem(ODR_ENCODE);
r->piggyback = 1;
r->setname = 0;
- r->schema = 0;
r->step = 0;
for (i = 0; i<RECORD_HASH_SIZE; i++)
r->record_hash[i] = 0;
ZOOM_task task;
const char *cp;
int start, count;
- const char *syntax, *elementSetName;
+ const char *syntax, *elementSetName, *schema;
#if ZOOM_RESULT_LISTS
ZOOM_resultsets set;
#endif
cp = ZOOM_options_get(r->options, "setname");
if (cp)
r->setname = xstrdup(cp);
- cp = ZOOM_options_get(r->options, "schema");
- if (cp)
- r->schema = xstrdup(cp);
r->databaseNames = ZOOM_connection_get_databases(c, c->options, &r->num_databaseNames,
r->odr);
syntax = ZOOM_options_get(r->options, "preferredRecordSyntax");
task->u.search.syntax = syntax ? xstrdup(syntax) : 0;
elementSetName = ZOOM_options_get(r->options, "elementSetName");
- task->u.search.elementSetName = elementSetName
- ? xstrdup(elementSetName) : 0;
+ task->u.search.elementSetName = elementSetName ?
+ xstrdup(elementSetName) : 0;
+ schema = ZOOM_options_get(r->options, "schema");
+ task->u.search.schema = schema ? xstrdup(schema) : 0;
ZOOM_resultset_addref(r);
ZOOM_options_destroy(r->options);
odr_destroy(r->odr);
xfree(r->setname);
- xfree(r->schema);
yaz_mutex_destroy(&r->mutex);
#if SHPTR
YAZ_SHPTR_DEC(r->record_wrbuf, wrbuf_destroy);
? xstrdup(elementSetName) : 0;
cp = ZOOM_options_get(r->options, "schema");
- if (cp)
- {
- if (!r->schema || strcmp(r->schema, cp))
- {
- xfree(r->schema);
- r->schema = xstrdup(cp);
- }
- }
+ task->u.retrieve.schema = cp ? xstrdup(cp) : 0;
ZOOM_resultset_addref(r);
ZOOM_options_get(s->options, "preferredRecordSyntax");
const char *elementSetName =
ZOOM_options_get(s->options, "elementSetName");
+ const char *schema =
+ ZOOM_options_get(s->options, "schema");
- return ZOOM_record_cache_lookup(s, pos, syntax, elementSetName);
+ return ZOOM_record_cache_lookup(s, pos, syntax, elementSetName, schema);
}
ZOOM_API(ZOOM_record)
int step;
int piggyback;
char *setname;
- char *schema;
ODR odr;
ZOOM_record_cache record_hash[RECORD_HASH_SIZE];
ZOOM_options options;
ZOOM_resultset resultset;
char *syntax;
char *elementSetName;
+ char *schema;
int recv_search_fired;
} search;
#define ZOOM_TASK_RETRIEVE 2
int count;
char *syntax;
char *elementSetName;
+ char *schema;
} retrieve;
#define ZOOM_TASK_CONNECT 3
#define ZOOM_TASK_SCAN 4
ZOOM_record ZOOM_record_cache_lookup(ZOOM_resultset r, int pos,
const char *syntax,
- const char *elementSetName);
+ const char *elementSetName,
+ const char *schema);
void ZOOM_record_cache_add(ZOOM_resultset r, Z_NamePlusRecord *npr,
int pos,
const char *syntax, const char *elementSetName,
for (rc = r->record_hash[record_hash(pos)]; rc; rc = rc->next)
{
if (pos == rc->pos
- && yaz_strcmp_null(r->schema, rc->schema) == 0
+ && yaz_strcmp_null(schema, rc->schema) == 0
&& yaz_strcmp_null(elementSetName,rc->elementSetName) == 0
&& yaz_strcmp_null(syntax, rc->syntax) == 0)
break;
rc->syntax = odr_strdup_null(r->odr, syntax);
- rc->schema = odr_strdup_null(r->odr, r->schema);
+ rc->schema = odr_strdup_null(r->odr, schema);
rc->pos = pos;
rc->next = r->record_hash[record_hash(pos)];
ZOOM_record ZOOM_record_cache_lookup(ZOOM_resultset r, int pos,
const char *syntax,
- const char *elementSetName)
+ const char *elementSetName,
+ const char *schema)
{
ZOOM_record_cache rc;
{
if (pos == rc->pos)
{
- if (yaz_strcmp_null(r->schema, rc->schema))
+ if (yaz_strcmp_null(schema, rc->schema))
continue;
if (yaz_strcmp_null(elementSetName,rc->elementSetName))
continue;
ZOOM_resultset resultset = 0;
Z_SRW_PDU *sr = 0;
const char *option_val = 0;
+ const char *schema = 0;
Z_Query *z_query;
Z_FacetList *facet_list = 0;
if (c->error) /* don't continue on error */
facets = ZOOM_options_get(resultset->options, "facets");
if (facets)
facet_list = yaz_pqf_parse_facet_list(c->odr_out, facets);
+ schema = c->tasks->u.search.schema;
break;
case ZOOM_TASK_RETRIEVE:
resultset = c->tasks->u.retrieve.resultset;
+ schema = c->tasks->u.retrieve.schema;
start = &c->tasks->u.retrieve.start;
count = &c->tasks->u.retrieve.count;
ZOOM_record rec =
ZOOM_record_cache_lookup(resultset, i + *start,
c->tasks->u.retrieve.syntax,
- c->tasks->u.retrieve.elementSetName);
+ c->tasks->u.retrieve.elementSetName,
+ schema);
if (!rec)
break;
else
sr->u.request->maximumRecords = odr_intdup(
c->odr_out, (resultset->step > 0 && resultset->step < *count) ?
resultset->step : *count);
- sr->u.request->recordSchema = resultset->schema;
+ sr->u.request->recordSchema = odr_strdup_null(c->odr_out, schema);
sr->u.request->facetList = facet_list;
option_val = ZOOM_resultset_option_get(resultset, "recordPacking");
ZOOM_resultset r;
int lslb, ssub, mspn;
const char *syntax;
+ const char *schema;
Z_APDU *apdu = zget_APDU(c->odr_out, Z_APDU_searchRequest);
Z_SearchRequest *search_req = apdu->u.searchRequest;
const char *elementSetName;
/* get syntax (no need to provide unless piggyback is in effect) */
syntax = c->tasks->u.search.syntax;
+ schema = c->tasks->u.search.schema;
+
lslb = ZOOM_options_get_int(r->options, "largeSetLowerBound", -1);
ssub = ZOOM_options_get_int(r->options, "smallSetUpperBound", -1);
mspn = ZOOM_options_get_int(r->options, "mediumSetPresentNumber", -1);
*search_req->mediumSetPresentNumber = mspn;
}
else if (c->tasks->u.search.start == 0 && c->tasks->u.search.count > 0
- && r->piggyback && !r->r_sort_spec && !r->schema)
+ && r->piggyback && !r->r_sort_spec && !schema)
{
/* Regular piggyback - do it unless we're going to do sort */
*search_req->largeSetLowerBound = 2000000000;
int i = 0;
const char *syntax = 0;
const char *elementSetName = 0;
- ZOOM_resultset resultset;
+ const char *schema = 0;
+ ZOOM_resultset resultset;
int *start, *count;
if (!c->tasks)
count = &c->tasks->u.search.count;
syntax = c->tasks->u.search.syntax;
elementSetName = c->tasks->u.search.elementSetName;
+ schema = c->tasks->u.search.schema;
break;
case ZOOM_TASK_RETRIEVE:
resultset = c->tasks->u.retrieve.resultset;
count = &c->tasks->u.retrieve.count;
syntax = c->tasks->u.retrieve.syntax;
elementSetName = c->tasks->u.retrieve.elementSetName;
+ schema = c->tasks->u.retrieve.schema;
break;
default:
return zoom_complete;
{
ZOOM_record rec =
ZOOM_record_cache_lookup(resultset, i + *start,
- syntax, elementSetName);
+ syntax, elementSetName, schema);
if (!rec)
break;
else
req->preferredRecordSyntax =
zoom_yaz_str_to_z3950oid(c, CLASS_RECSYN, syntax);
- if (resultset->schema && *resultset->schema)
+ if (schema && *schema)
{
Z_RecordComposition *compo = (Z_RecordComposition *)
odr_malloc(c->odr_out, sizeof(*compo));
compo->u.complex->generic->which = Z_Schema_oid;
compo->u.complex->generic->schema.oid = (Odr_oid *)
- zoom_yaz_str_to_z3950oid (c, CLASS_SCHEMA, resultset->schema);
+ zoom_yaz_str_to_z3950oid(c, CLASS_SCHEMA, schema);
if (!compo->u.complex->generic->schema.oid)
{
/* OID wasn't a schema! Try record syntax instead. */
compo->u.complex->generic->schema.oid = (Odr_oid *)
- zoom_yaz_str_to_z3950oid (c, CLASS_RECSYN, resultset->schema);
+ zoom_yaz_str_to_z3950oid(c, CLASS_RECSYN, schema);
}
if (elementSetName && *elementSetName)
{