+int Yaz_RecordCache::match (Yaz_RecordCache_Entry *entry,
+ Odr_oid *syntax, int offset,
+ Z_RecordComposition *comp)
+{
+ // See if our compspec match...
+ int match = 0;
+ ODR o1 = odr_createmem(ODR_ENCODE);
+ ODR o2 = odr_createmem(ODR_ENCODE);
+
+ z_RecordComposition(o1, &comp, 1, 0);
+ z_RecordComposition(o2, &entry->m_comp, 1, 0);
+
+ int len1 = -1;
+ char *buf1 = odr_getbuf(o1, &len1, 0);
+ int len2 = -1;
+ char *buf2 = odr_getbuf(o2, &len2, 0);
+
+ yaz_log(LOG_LOG, "buf1=%p buf2=%p len1=%d len2=%d", buf1, buf2, len1, len2);
+ if (buf1 && buf2 && len1 && len1 == len2 && !memcmp(buf1, buf2, len1))
+ match = 1;
+ else if (!buf1 && !buf2 && !len1 && !len2)
+ match = 1;
+
+ odr_destroy(o1);
+ odr_destroy(o2);
+ if (!match)
+ return 0;
+
+ // See if offset, OID match..
+ if (entry->m_offset == offset &&
+ entry->m_record->which == Z_NamePlusRecord_databaseRecord &&
+ !oid_oidcmp(entry->m_record->u.databaseRecord->direct_reference,
+ syntax))
+ return 1;
+ return 0;
+}
+