+}
+
+static void srw_bend_update(association *assoc, request *req,
+ Z_SRW_updateRequest *srw_req,
+ Z_SRW_updateResponse *srw_res,
+ int *http_code)
+{
+ yaz_log(YLOG_DEBUG, "Got SRW UpdateRequest");
+ yaz_log(YLOG_DEBUG, "num_diag = %d", srw_res->num_diagnostics );
+ *http_code = 404;
+ srw_bend_init(assoc, &srw_res->diagnostics, &srw_res->num_diagnostics);
+ if (assoc->init)
+ {
+ bend_update_rr rr;
+
+ rr.stream = assoc->encode;
+ rr.print = assoc->print;
+ rr.num_bases = 1;
+ rr.basenames = &srw_req->database;
+ rr.operation = srw_req->operation;
+ rr.operation_status = "failed";
+ rr.record_id = 0;
+ rr.record_version = 0;
+ rr.record_checksum = 0;
+ rr.record_old_version = 0;
+ rr.record_packing = "xml";
+ rr.record_schema = 0;
+ rr.record_data = 0;
+ rr.request_extra_record = 0;
+ rr.response_extra_record = 0;
+ rr.extra_request_data = 0;
+ rr.extra_response_data = 0;
+ rr.errcode = 0;
+ rr.errstring = 0;
+
+ yaz_log(YLOG_DEBUG, "basename = %s", rr.basenames[0] );
+ yaz_log(YLOG_DEBUG, "Operation = %s", rr.operation );
+ if ( !strcmp( rr.operation, "delete" ) ){
+ if ( !srw_req->recordId ){
+ yaz_add_srw_diagnostic(assoc->encode, &srw_res->diagnostics,
+ &srw_res->num_diagnostics,
+ 7, "recordId" );
+ }
+ else {
+ rr.record_id = srw_req->recordId;
+ }
+ if ( !srw_req->recordVersion ){
+ yaz_add_srw_diagnostic(assoc->encode, &srw_res->diagnostics,
+ &srw_res->num_diagnostics,
+ 7, "recordVersion" );
+ }
+ else {
+ rr.record_version = odr_strdup( assoc->encode,
+ srw_req->recordVersion );
+
+ }
+ if ( srw_req->recordOldVersion ){
+ rr.record_old_version = odr_strdup(assoc->encode,
+ srw_req->recordOldVersion );
+ }
+ if ( srw_req->extraRequestData ){
+ rr.extra_request_data = odr_strdup(assoc->encode,
+ srw_req->extraRequestData );
+ }
+ }
+ else if ( !strcmp( rr.operation, "replace" ) ){
+ if ( !srw_req->recordId ){
+ yaz_add_srw_diagnostic(assoc->encode, &srw_res->diagnostics,
+ &srw_res->num_diagnostics,
+ 7, "recordId" );
+ }
+ else {
+ rr.record_id = srw_req->recordId;
+ }
+ if ( srw_req->record.recordSchema == 0 ){
+ yaz_add_srw_diagnostic(assoc->encode, &srw_res->diagnostics,
+ &srw_res->num_diagnostics,
+ 7, "recordSchema" );
+ }
+ else {
+ rr.record_schema = odr_strdup(assoc->encode,
+ srw_req->record.recordSchema );
+ }
+ switch (srw_req->record.recordPacking)