Пример #1
0
static void marshalKey(const NameID &id1, const NameID &id2, DbtOut &dbt)
{
	DBXML_ASSERT(id1 != 0 || id2 == 0);

	int size = 1;
	if(id1 != 0) size += id1.marshalSize();
	if(id2 != 0) size += id2.marshalSize();

	dbt.set(0, size);

	xmlbyte_t *ptr = (xmlbyte_t*)dbt.data;
	*ptr++ = KEY_PREFIX_BYTE;
	if(id1 != 0) ptr += id1.marshal(ptr);
	if(id2 != 0) ptr += id2.marshal(ptr);
}
Пример #2
0
// use DB prefix iterator to remove all index entries for the specified index.
// do both index and statistics databases.
// The prefix is <indexKeyPrefix>[<nameId>]
int SyntaxDatabase::removeIndex(OperationContext &context, const Index &index,
				const NameID &id)
{
	// key is <indexType><name ID>, which is one byte plus a marshaled integer.
	unsigned char keybuf[10];
	keybuf[0] = index.getKeyPrefix();
	u_int32_t sz = 1;
	if (id != 0) {
		// not a default index
		sz += id.marshal(keybuf+1);
	}
	int err = removeIndexEntries(context, *index_.get(), keybuf, sz);
	if (err == 0)
		err = removeIndexEntries(context, *statistics_.get(), keybuf, sz);
	return err;
}