- Z_IUUpdate *up = rr->esr->taskSpecificParameters->u.update;
- yaz_log (LOG_LOG, "Received DB Update");
- if (up->which == Z_IUUpdate_esRequest)
- {
- Z_IUUpdateEsRequest *esRequest = up->u.esRequest;
- Z_IUOriginPartToKeep *toKeep = esRequest->toKeep;
- Z_IUSuppliedRecords *notToKeep = esRequest->notToKeep;
-
- yaz_log (LOG_LOG, "action");
- if (toKeep->action)
- {
- switch (*toKeep->action)
- {
- case Z_IUOriginPartToKeep_recordInsert:
- yaz_log (LOG_LOG, " recordInsert");
- break;
- case Z_IUOriginPartToKeep_recordReplace:
- yaz_log (LOG_LOG, " recordReplace");
- break;
- case Z_IUOriginPartToKeep_recordDelete:
- yaz_log (LOG_LOG, " recordDelete");
- break;
- case Z_IUOriginPartToKeep_elementUpdate:
- yaz_log (LOG_LOG, " elementUpdate");
- break;
- case Z_IUOriginPartToKeep_specialUpdate:
- yaz_log (LOG_LOG, " specialUpdate");
- break;
- default:
- yaz_log (LOG_LOG, " unknown (%d)", *toKeep->action);
- }
- }
- if (toKeep->databaseName)
- {
- yaz_log (LOG_LOG, "database: %s", toKeep->databaseName);
- if (!strcmp(toKeep->databaseName, "fault"))
- {
- rr->errcode = 109;
- rr->errstring = toKeep->databaseName;
- }
- if (!strcmp(toKeep->databaseName, "accept"))
- rr->errcode = -1;
- }
- if (toKeep)
- {
- Z_External *ext = (Z_External *)
- odr_malloc (rr->stream, sizeof(*ext));
- Z_IUOriginPartToKeep *keep = (Z_IUOriginPartToKeep *)
- odr_malloc (rr->stream, sizeof(*keep));
- Z_IUTargetPart *targetPart = (Z_IUTargetPart *)
- odr_malloc (rr->stream, sizeof(*targetPart));
-
- rr->taskPackage = (Z_TaskPackage *)
- odr_malloc (rr->stream, sizeof(*rr->taskPackage));
- rr->taskPackage->packageType =
- odr_oiddup (rr->stream, rr->esr->packageType);
- rr->taskPackage->packageName = 0;
- rr->taskPackage->userId = 0;
- rr->taskPackage->retentionTime = 0;
- rr->taskPackage->permissions = 0;
- rr->taskPackage->description = 0;
- rr->taskPackage->targetReference = (Odr_oct *)
- odr_malloc (rr->stream, sizeof(Odr_oct));
- rr->taskPackage->targetReference->buf =
- (unsigned char *) odr_strdup (rr->stream, "123");
- rr->taskPackage->targetReference->len =
- rr->taskPackage->targetReference->size =
- strlen((char *) (rr->taskPackage->targetReference->buf));
- rr->taskPackage->creationDateTime = 0;
- rr->taskPackage->taskStatus = odr_intdup(rr->stream, 0);
- rr->taskPackage->packageDiagnostics = 0;
- rr->taskPackage->taskSpecificParameters = ext;
-
- ext->direct_reference =
- odr_oiddup (rr->stream, rr->esr->packageType);
- ext->indirect_reference = 0;
- ext->descriptor = 0;
- ext->which = Z_External_update;
- ext->u.update = (Z_IUUpdate *)
- odr_malloc (rr->stream, sizeof(*ext->u.update));
- ext->u.update->which = Z_IUUpdate_taskPackage;
- ext->u.update->u.taskPackage = (Z_IUUpdateTaskPackage *)
- odr_malloc (rr->stream, sizeof(Z_IUUpdateTaskPackage));
- ext->u.update->u.taskPackage->originPart = keep;
- ext->u.update->u.taskPackage->targetPart = targetPart;
-
- keep->action = (int *) odr_malloc (rr->stream, sizeof(int));
- *keep->action = *toKeep->action;
- keep->databaseName =
- odr_strdup (rr->stream, toKeep->databaseName);
- keep->schema = 0;
- keep->elementSetName = 0;
- keep->actionQualifier = 0;
-
- targetPart->updateStatus = odr_intdup (rr->stream, 1);
- targetPart->num_globalDiagnostics = 0;
- targetPart->globalDiagnostics = (Z_DiagRec **) odr_nullval();
- targetPart->num_taskPackageRecords = 1;
- targetPart->taskPackageRecords =
+ Z_IUUpdate *up = rr->esr->taskSpecificParameters->u.update;
+ yaz_log(log_level, "Received DB Update");
+ if (up->which == Z_IUUpdate_esRequest)
+ {
+ Z_IUUpdateEsRequest *esRequest = up->u.esRequest;
+ Z_IUOriginPartToKeep *toKeep = esRequest->toKeep;
+ Z_IUSuppliedRecords *notToKeep = esRequest->notToKeep;
+
+ yaz_log(log_level, "action");
+ if (toKeep->action)
+ {
+ switch (*toKeep->action)
+ {
+ case Z_IUOriginPartToKeep_recordInsert:
+ yaz_log(log_level, " recordInsert");
+ break;
+ case Z_IUOriginPartToKeep_recordReplace:
+ yaz_log(log_level, " recordReplace");
+ break;
+ case Z_IUOriginPartToKeep_recordDelete:
+ yaz_log(log_level, " recordDelete");
+ break;
+ case Z_IUOriginPartToKeep_elementUpdate:
+ yaz_log(log_level, " elementUpdate");
+ break;
+ case Z_IUOriginPartToKeep_specialUpdate:
+ yaz_log(log_level, " specialUpdate");
+ break;
+ default:
+ yaz_log(log_level, " unknown (" ODR_INT_PRINTF ")",
+ *toKeep->action);
+ }
+ }
+ if (toKeep->databaseName)
+ {
+ yaz_log(log_level, "database: %s", toKeep->databaseName);
+ if (!strcmp(toKeep->databaseName, "fault"))
+ {
+ rr->errcode = YAZ_BIB1_DATABASE_UNAVAILABLE;
+ rr->errstring = toKeep->databaseName;
+ }
+ if (!strcmp(toKeep->databaseName, "accept"))
+ rr->errcode = -1;
+ }
+ if (toKeep)
+ {
+ Z_External *ext = (Z_External *)
+ odr_malloc(rr->stream, sizeof(*ext));
+ Z_IUOriginPartToKeep *keep = (Z_IUOriginPartToKeep *)
+ odr_malloc(rr->stream, sizeof(*keep));
+ Z_IUTargetPart *targetPart = (Z_IUTargetPart *)
+ odr_malloc(rr->stream, sizeof(*targetPart));
+
+ rr->taskPackage = (Z_TaskPackage *)
+ odr_malloc(rr->stream, sizeof(*rr->taskPackage));
+ rr->taskPackage->packageType =
+ odr_oiddup(rr->stream, rr->esr->packageType);
+ rr->taskPackage->packageName = 0;
+ rr->taskPackage->userId = 0;
+ rr->taskPackage->retentionTime = 0;
+ rr->taskPackage->permissions = 0;
+ rr->taskPackage->description = 0;
+ rr->taskPackage->targetReference = (Odr_oct *)
+ odr_malloc(rr->stream, sizeof(Odr_oct));
+ rr->taskPackage->targetReference->buf =
+ (unsigned char *) odr_strdup(rr->stream, "123");
+ rr->taskPackage->targetReference->len =
+ rr->taskPackage->targetReference->size =
+ strlen((char *) (rr->taskPackage->targetReference->buf));
+ rr->taskPackage->creationDateTime = 0;
+ rr->taskPackage->taskStatus = odr_intdup(rr->stream, 0);
+ rr->taskPackage->packageDiagnostics = 0;
+ rr->taskPackage->taskSpecificParameters = ext;
+
+ ext->direct_reference =
+ odr_oiddup(rr->stream, rr->esr->packageType);
+ ext->indirect_reference = 0;
+ ext->descriptor = 0;
+ ext->which = Z_External_update;
+ ext->u.update = (Z_IUUpdate *)
+ odr_malloc(rr->stream, sizeof(*ext->u.update));
+ ext->u.update->which = Z_IUUpdate_taskPackage;
+ ext->u.update->u.taskPackage = (Z_IUUpdateTaskPackage *)
+ odr_malloc(rr->stream, sizeof(Z_IUUpdateTaskPackage));
+ ext->u.update->u.taskPackage->originPart = keep;
+ ext->u.update->u.taskPackage->targetPart = targetPart;
+
+ keep->action = odr_intdup(rr->stream, *toKeep->action);
+ keep->databaseName =
+ odr_strdup(rr->stream, toKeep->databaseName);
+ keep->schema = 0;
+ keep->elementSetName = 0;
+ keep->actionQualifier = 0;
+
+ targetPart->updateStatus = odr_intdup(rr->stream, 1);
+ targetPart->num_globalDiagnostics = 0;
+ targetPart->globalDiagnostics = (Z_DiagRec **) odr_nullval();
+ targetPart->num_taskPackageRecords = 1;
+ targetPart->taskPackageRecords =