- }
- else
- {
- ZEBRA_RES r = ZEBRA_FAIL;
- switch(action) {
- case 1:
- r = zebra_insert_record(
- zh,
- 0, /* recordType */
- sysno,
- 0, /* match */
- 0, /* fname */
- (const char *) rec->u.octet_aligned->buf,
- rec->u.octet_aligned->len,
- 0);
- if (r == ZEBRA_FAIL)
- {
- rr->errcode =
- YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED;
- rr->errstring = "insert_record failed";
- }
- break;
- case 2:
- case 4:
- r = zebra_update_record(
- zh,
- 0, /* recordType */
- sysno,
- 0, /* match */
- 0, /* fname */
- (const char *) rec->u.octet_aligned->buf,
- rec->u.octet_aligned->len,
- 1);
- if (r == ZEBRA_FAIL)
- {
- rr->errcode =
- YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED;
- rr->errstring = "update_record failed";
- }
- break;
- case 3:
- r = zebra_delete_record(
- zh,
- 0, /* recordType */
- sysno,
- 0, /* match */
- 0, /* fname */
- (const char *) rec->u.octet_aligned->buf,
- rec->u.octet_aligned->len,
- 0);
- if (r == ZEBRA_FAIL)
- {
- rr->errcode =
- YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED;
- rr->errstring = "delete_record failed";
- }
- break;
- }
- }
+ memcpy(recid_str, opaque_recid->buf, l);
+ recid_str[l] = '\0';
+ match_criteria = recid_str;
+ }
+ res = zebra_update_record(
+ zh, action,
+ 0, /* recordType */
+ sysno, match_criteria, 0, /* fname */
+ (const char *) rec->u.octet_aligned->buf,
+ rec->u.octet_aligned->len);
+ if (res == ZEBRA_FAIL)
+ {
+ rr->errcode =
+ YAZ_BIB1_ES_IMMEDIATE_EXECUTION_FAILED;
+ rr->errstring = "update_record failed";
+ }